-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Profile api test PR #3224
Profile api test PR #3224
Conversation
…ecentPeople endpoint
Locally, this gives me, on mysql: ActiveRecord::StatementInvalid: ActiveRecord::StatementInvalid: Mysql2::Error: Expression #1 of ORDER BY clause is not in SELECT list, references column 'plots.node_revisions.timestamp' which is not in SELECT list; this is incompatible with DISTINCT: SELECT DISTINCT `node`.`nid` FROM `node` LEFT OUTER JOIN `node_revisions` ON `node_revisions`.`nid` = `node`.`nid` LEFT OUTER JOIN `community_tags` ON `community_tags`.`nid` = `node`.`nid` LEFT OUTER JOIN `term_data` ON `term_data`.`tid` = `community_tags`.`tid` WHERE (`node`.`nid`) IN (1, 8, 1, 2, 8, 9, 10, 15) AND ((created >= 1533839387 AND created <= 1533846587) OR (timestamp >= 1533839387 AND timestamp <= 1533846587)) ORDER BY node_revisions.timestamp DESC
test/unit/user_test.rb:97:in `block in <class:UserTest>'
23/23: [================================================] 100% Time: 00:00:07, Time: 00:00:07 |
That's related to this terrible obscure issue: https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html |
Er, wait, not that one. But something similar, let me look... |
The error is on this line: (line 97)
|
Huh... what do you know... a pretty similar error to in #3217... Lines 371 to 376 in 04d5bbc
|
Generated by 🚫 Danger |
The Travis tests are failing on the functional test for
on requesting: `get '/api/srch/profiles?srchString=steff' I'm going to try this locally... |
OK, locally, on mysql, i get, for {"items":[{"docId":0,"docType":"user","docUrl":"/profile/jeffrey","docTitle":"jeffrey","docSummary":"","docScore":0},{"docId":0,"docType":"user","docUrl":"/profile/jeff","docTitle":"jeff","docSummary":"","docScore":0}],"srchParams":{"srchString":"jeff","seq":null,"showCount":null,"pageNum":null,"tagName":null}} |
OK, so I tried putting a
If this doesn't work, i'll test against just |
@jywarren that was the error, yeah... if you also change this line https://github.com/publiclab/plots2/blob/master/test/unit/user_test.rb#L37 to 'jeff' or any other username on fixtures, it will show the same error. |
Let me know anything that you find, I have to work now so I'll get back to this later, thanks for the help! |
ok, trying on the unit test as it's a simpler usage of the code, so maybe
we can track it there...
…On Thu, Aug 9, 2018 at 5:07 PM Stefanni ***@***.***> wrote:
Let me know anything that you find, I have to work now so I'll get back to
this later, thanks for the help!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3224 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABfJzpefpiRyAsD6Xj3wx8tTEioZim8ks5uPKSGgaJpZM4V2bik>
.
|
Restarting this build as it errored for unrelated reasons. |
I restarted the build, but I realized your code is slightly different from our version, you will have some errors because of that . Could try your files with our latest commit that works? you are on the |
app/models/user.rb
Outdated
@@ -42,7 +43,7 @@ class User < ActiveRecord::Base | |||
after_destroy :destroy_drupal_user | |||
|
|||
def self.search(query) | |||
User.where('MATCH(username, bio) AGAINST(?)', query) | |||
User.where('MATCH(username, bio) AGAINST (?)', query) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this didn't work, you need to use like this:
def self.search(query)
User.where('MATCH(username) AGAINST((?) IN BOOLEAN MODE)', query + '*')
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, I clicked on review instead of add a comment!
app/services/srch_scope.rb
Outdated
User.order('id DESC') | ||
.where('username LIKE ? AND status = 1', '%' + input + '%') | ||
User.where('username LIKE ? AND rusers.status = 1', '%' + input + '%') | ||
.order('id DESC') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is our Search Scope find users method:
def self.find_users(query, limit)
if ActiveRecord::Base.connection.adapter_name == 'Mysql2'
User.search_by_username(query)
.where('rusers.status = ?', 1)
.limit(limit)
else
User.where('username LIKE ? AND rusers.status = 1', '%' + input + '%')
.limit(limit)
end
end
…ilaaraujo/plots2 into profiles-endpoint-most-recently-people
can I close this one? :) @jywarren |
yes please!
…On Wed, Aug 15, 2018 at 8:01 AM Stefanni ***@***.***> wrote:
can I close this one? :) @jywarren <https://github.com/jywarren>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3224 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABfJ56ucvaDoFcTmuD1vuS2e4oM2pKkks5uQ6sSgaJpZM4V2bik>
.
|
closed via #3134 |
Just testing something for #3134!