Comments (10)
You can define the following:
scoped_search :on => [:id, :name, :content]
scoped_search :on => [:created_at, :updated_at], :only_explicit => true
from scoped_search.
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.
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.
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.
If you keep the date columns only explicit, it also give you great flexibility in searching for dates
from scoped_search.
Maybe we should only attempt DateTime.parse
if the query word starts with a digit?
from scoped_search.
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.
The date functionality also has timezone issues: #43. Not sure what the best way forward is to make this more robust.
from scoped_search.
@brocktimus Yes, or we handle Today and Yesterday explicitly.What other values do we want to support?
from scoped_search.
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)
- Searching for future dates by relative days HOT 5
- Request for new gem release HOT 3
- A new release required HOT 5
- Exception when searching for words together with a field defined with ext_method HOT 1
- Question: Can the advanced query language be disabled? HOT 1
- Not compatible with Postgres citext column type HOT 4
- Problems searching for resources belonging to STI
- exception during autocomplete for virtual field not defined in DB HOT 8
- Query language - Temporal comparisons do not support seconds
- Postgres adapter not picked up when using PostGIS HOT 1
- "scoped_search relation:" does not pay attention to "has_many ..., primary_key:" overrides. HOT 1
- Boolean fields with complete_value hash generates AR::PreparedStatementInvalid exceptions
- undefined method `join_keys' for class `ActiveRecord::Reflection::HasManyReflection' - ActiveRecord 6.1 HOT 4
- has_rich_text relation is not supported HOT 4
- "undefined method `to_sym' for {:on=>:looking_for}:Hash\nDid you mean? to_s\n to_set" HOT 2
- Deprecated functionality for Ruby 2.7 HOT 7
- Optional sanitizing of _ and % in search values
- scoped_search not working with Ruby 3.0.2 HOT 6
- rubygems.org version differs from master branch, Ruby 3 support not included HOT 2
- Inconsistency in quoted field name interpretation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scoped_search.