Giter Club home page Giter Club logo

Comments (10)

abenari avatar abenari commented on August 16, 2024

You can define the following:
scoped_search :on => [:id, :name, :content]
scoped_search :on => [:created_at, :updated_at], :only_explicit => true

from scoped_search.

brocktimus avatar brocktimus commented on August 16, 2024

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
languages if you don't want them parsed? Unsure if that is a good fix or
not...

On 10/04/13 22:14, abenari wrote:

You can define the following:
scoped_search :on => [:id, :name, :content]
scoped_search :on => [:created_at, :updated_at], :only_explicit => true


Reply to this email directly or view it on GitHub
#51 (comment).

from scoped_search.

luxflux avatar luxflux commented on August 16, 2024

It happens as soon as you use mar, apr or even with a number...:

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)>

from scoped_search.

luxflux avatar luxflux commented on August 16, 2024

Using the definition mentioned by @abenari works. But I think this needs a change anyway as DateTime.parse will always return strange values.

from scoped_search.

abenari avatar abenari commented on August 16, 2024

If you keep the date columns only explicit, it also give you great flexibility in searching for dates

from scoped_search.

wvanbergen avatar wvanbergen commented on August 16, 2024

Maybe we should only attempt DateTime.parse if the query word starts with a digit?

from scoped_search.

brocktimus avatar brocktimus commented on August 16, 2024

I seem to recall some of the tests explicitly testing that it worked
with things like "Today" and "Yesterday". So your idea is possible,
would just require removing that functionality.

On 15/04/13 15:05, Willem van Bergen wrote:

Maybe we should only attempt |DateTime.parse| if the query word starts
with a digit?


Reply to this email directly or view it on GitHub
#51 (comment).

from scoped_search.

wvanbergen avatar wvanbergen commented on August 16, 2024

The date functionality also has timezone issues: #43. Not sure what the best way forward is to make this more robust.

from scoped_search.

wvanbergen avatar wvanbergen commented on August 16, 2024

@brocktimus Yes, or we handle Today and Yesterday explicitly.What other values do we want to support?

from scoped_search.

brocktimus avatar brocktimus commented on August 16, 2024

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 ?

from scoped_search.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.