-
Notifications
You must be signed in to change notification settings - Fork 78
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
Searching for 'marco' finds too much #51
Comments
You can define the following: |
Is marco march in another language? I just had a try and english and german returned the same results: irb(main):007:0> Date.parse 'march'
=> #<Date: 2013-03-01 ((2456353j,0s,0n),+0s,2299161j)>
irb(main):008:0> Date.parse 'marsch'
=> #<Date: 2013-03-01 ((2456353j,0s,0n),+0s,2299161j)> If that's the case it might just be possible to disable those other On 10/04/13 22:14, abenari wrote:
|
It happens as soon as you use 1.9.3p392 :006 > DateTime.parse 'aprilia'
=> #<DateTime: 2013-04-01T00:00:00+00:00 ((2456384j,0s,0n),+0s,2299161j)>
1.9.3p392 :007 > DateTime.parse '20001'
=> #<DateTime: 2020-01-01T00:00:00+00:00 ((2458850j,0s,0n),+0s,2299161j)> |
Using the definition mentioned by @abenari works. But I think this needs a change anyway as |
If you keep the date columns only explicit, it also give you great flexibility in searching for dates |
Maybe we should only attempt |
I seem to recall some of the tests explicitly testing that it worked On 15/04/13 15:05, Willem van Bergen wrote:
|
The date functionality also has timezone issues: #43. Not sure what the best way forward is to make this more robust. |
@brocktimus Yes, or we handle Today and Yesterday explicitly.What other values do we want to support? |
You're right. Today and Yesterday are handled explicitly. I'm not sure what values we'd like to support, my main use for this library is the really basic text searching stuff. I'm also normally super explicit, but that is more me than an average user. I think the behaviour at the moment is a bit unintuitive. If anything I would expect 'March' to span all of March. Does it ever work that well as a search library for dates or times when it isn't explicitly mentioned? I would be tempted to do a simple regex like /\d[:- ]\d/ to check it has at least two digits and a separator before parsing it into DateTime.parse unless the field is explicitly mentioned. Somewhat unrelated but should we be using Time.zone.parse instead of DateTime.parse ? |
Following scoped_search definition:
If you search for
marco
it finds every record which has been created or updated on 1st of March 2013.Caused by the following SQL:
It works, if I remove
created_at
andupdated_at
from the definition.The bug is in defintion.rb#L217.
DateTime#parse
parses 'marco' as the first of March...:My purpose would be to use DateTime#parse only if there is an operator in front...
The text was updated successfully, but these errors were encountered: