Closed hsa closed 13 years ago
It happens to me too.
The same for me, doing this works:
Update.subject_or_body_contains "list"
But this does not:
Update.search(:subject_or_body_contains => "list").all
Rails 2.3.4, SL 2.3.3: Update.search(:subject_or_body_contains => "list") produces:
Same for me Rails 2.3.4 and SL 2.3.3
User.name_or_email_like('Gade').size => 2 User.search(:name_or_email_like => 'Gade').all.size => 379
?
There will be exacly the some with: s = User.search s.name_or_email_like('Gade') That's because in Search model in "or" conditions is some bug that set any "or" condition to false(it is visible as I showed earlier but value = false) so no filtering by that condition. Right now I can't find the exact line, but I think that it is somehow connected to validating scope "or" spliting (lib/searchlogic/named_scopes/or_conditions.rb) Any ideas?
Confirming:
User.last_name_like_or_first_name_like('tom').size => 1 User.search(:last_name_like_or_first_name_like => 'tom').size => 3
Same for me:
>> User.login_or_email_like('lec').size
SQL (0.4ms) SELECT count(*) AS count_all FROM `users` WHERE ((users.email LIKE '%lec%') OR (users.login LIKE '%lec%'))
=> 2
>> User.search(:login_or_email_like => "lec").size
SQL (0.3ms) SELECT count(*) AS count_all FROM `users`
=> 23
I'm having the same problem.
Same here.
Ok… I encountered the same problem and checked the source code (quite impressive). After some digging and testing I found the problem, but so far I did not came up with a perfect solution for it. Until then, I have a partial quick fix which I provide at: http://github.com/namxam/searchlogic/ This fix is only working for fully qualified conditions:
I hope I can provide a fix for the remaining problem as well
Hi! I finally fixed this problem even for not fully qualified conditions. And also added type convertion, so User.search(:id_or_age_lte, '10') will now work properly.
The fix is here: http://github.com/nebolsin/searchlogic/
That's great news. I hope it will be pulled into the master repository soon!
I am running 2.3.5, but it still appears to be present in this version as well. I am new to searchlogic, so if a work around has been mentioned - I apologize, and point me in the right direction.
note: I did see nebolsins repo above, but have not tried it yet.
First off , thanks for the awesome search dsl !
Is there any chance of the fix in http://github.com/nebolsin/searchlogic/ being pulled into the official repo ? I keep running into this problem and do not want to create yet another fork for this one issue.
thanks .
Awesome job on searchlogic, but I agree, this one is bugging me too!
Seems like my fix is included by 00aab642be72171aa098108002d2fd43b6092f05 and this issue could be closed.
Indeed, closing, thanks for fix.
It seems its not working from the form:
It works from the console, using Report.name_or_description_like but when I use it in the form I just get a "false" result in the text field, and no filters are applied (I checked the logs).
Let me know if you need any more info (I'm using the latest version of searchlogic and rails 2.3.2).
I also run a test creating a new rails app from scratch with rails 2.3.3 and exactly the same happens, it doesn't get filtered and it shows a "false" string in the form (as a response).
Thanks a lot for a great plugin!