Re: Solr partial date range search

2016-01-28 Thread Alessandro Benedetti
I agree with Erick,
converting dates into String is really a bad idea.

This "custom component" makes me curious, I assume you have :
Front End - Search-api -Solr or something similar.
If you want the front end to send the partial date, then the search-api can
handle the conversion.
If you want the front end to do the conversion, do at that time.
I can't see any problem in that, part if you are manually using Solr
without any middle layer ( which would surprise me) .
Can you give us more explanation  ?
This "custom component" sounds me wrong, how are you currently using solr ?

Cheers

On 28 January 2016 at 06:09, Jeyaprakash Singarayar <jpsingara...@gmail.com>
wrote:

> Hi Sriram,
>
> Add the tag 'propertyWriter' directly under the 'dataConfig' tag. The
> property "last_index_time" is converted to text and stored in the
> properties file and is available for the next import as the variable
> '${dih.last_index_time}' . This tag gives control over how this properties
> file is written.
>
> Its available in all 4.X versions.
>
> Hope it helps.
>
> On Thu, Jan 28, 2016 at 1:41 AM, vsriram30 <vsrira...@gmail.com> wrote:
>
> > I am actually using one such component to take in the partial dates like
> > 2015-10 and create full UTC dates out of it and query using that. But
> since
> > I was checking on that wiki about partial date search and since I
> couldn't
> > find that it is available only from 5.x, I was curious to know if by some
> > way I can make it work in 4.6.1 without need of my custom component.
> >
> > Thanks,
> > Sriram
> >
> >
> >
> > --
> > View this message in context:
> >
> http://lucene.472066.n3.nabble.com/Solr-partial-date-range-search-tp4253226p4253649.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
> >
>



-- 
--

Benedetti Alessandro
Visiting card : http://about.me/alessandro_benedetti

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England


Re: Solr partial date range search

2016-01-28 Thread vsriram30
Hi Benedetti Alessandro,

Thanks for your comments. In our application, Solr search is used in
multiple places. With respect to using a middle layer, our online requests
go through the search API (Middle layer) which is built on top of solr,
whereas the editorial tool, along with few other custom tools directly
contact Solr. 

Hence instead of implementing the partial date search in multiple frontends,
I have implemented a SearchComponent which would parse the incoming query,
identify data fields out of it, take the partial date value and construct
full UTC date out of it and send the query to search the underlying index.

Thanks,
Sriram



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Solr-partial-date-range-search-tp4253226p4253973.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Solr partial date range search

2016-01-28 Thread vsriram30
Hi Jeyaprakash,

Thanks for your suggestions. Are you referring to Dataimporthandler
properties, to configure this in data-config.xml? Since I am currently
referring to partial date search in my online queries, I am not sure whether
this will help achieve that. Can you please explain bit more?

Thanks,
Sriram



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Solr-partial-date-range-search-tp4253226p4253974.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Solr partial date range search

2016-01-27 Thread Jeyaprakash Singarayar
Hi Sriram,

Add the tag 'propertyWriter' directly under the 'dataConfig' tag. The
property "last_index_time" is converted to text and stored in the
properties file and is available for the next import as the variable
'${dih.last_index_time}' . This tag gives control over how this properties
file is written.

Its available in all 4.X versions.

Hope it helps.

On Thu, Jan 28, 2016 at 1:41 AM, vsriram30 <vsrira...@gmail.com> wrote:

> I am actually using one such component to take in the partial dates like
> 2015-10 and create full UTC dates out of it and query using that. But since
> I was checking on that wiki about partial date search and since I couldn't
> find that it is available only from 5.x, I was curious to know if by some
> way I can make it work in 4.6.1 without need of my custom component.
>
> Thanks,
> Sriram
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Solr-partial-date-range-search-tp4253226p4253649.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>


Re: Solr partial date range search

2016-01-27 Thread Jeyaprakash Singarayar
Hi Sriram,

Add the tag 'propertyWriter' directly under the 'dataConfig' tag. The
property "last_index_time" is converted to text and stored in the
properties file and is available for the next import as the variable
'${dih.last_index_time}' . This tag gives control over how this properties
file is written.

Its available in all 4.X versions.

Hope it helps.

On Thu, Jan 28, 2016 at 1:41 AM, vsriram30 <vsrira...@gmail.com> wrote:

> I am actually using one such component to take in the partial dates like
> 2015-10 and create full UTC dates out of it and query using that. But since
> I was checking on that wiki about partial date search and since I couldn't
> find that it is available only from 5.x, I was curious to know if by some
> way I can make it work in 4.6.1 without need of my custom component.
>
> Thanks,
> Sriram
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Solr-partial-date-range-search-tp4253226p4253649.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>


Re: Solr partial date range search

2016-01-27 Thread vsriram30
I am actually using one such component to take in the partial dates like
2015-10 and create full UTC dates out of it and query using that. But since
I was checking on that wiki about partial date search and since I couldn't
find that it is available only from 5.x, I was curious to know if by some
way I can make it work in 4.6.1 without need of my custom component.

Thanks,
Sriram



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Solr-partial-date-range-search-tp4253226p4253649.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Solr partial date range search

2016-01-26 Thread vsriram30
Thanks Shawn for providing more info. The looks like for supporting partial
date range search, I would need to rely on String regex search like
fieldName:2016-01*

Though this can support part of the functionality, but if I would like to
search between start and end date, this might not come good, like
fieldName:[2016-01-10 TO 2016-01-21]. This cannot be achieved by indexing
the date in String field.

Hence as you mentioned, I would need to upgrade my solr to 5.x to fully
support this. Thanks again.

-Sriram



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Solr-partial-date-range-search-tp4253226p4253412.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Solr partial date range search

2016-01-26 Thread vsriram30
Probably, I should not have mentioned, it cannot be achieved, as still we can
achieve that by using multiple OR queries with regex matching on that String
field, though it doesn't look good :-)

-Sriram



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Solr-partial-date-range-search-tp4253226p4253415.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Solr partial date range search

2016-01-26 Thread Erick Erickson
You do not have to upgrade or use strings to support this use-case,
just specify the full date format.

i.e. instead of this:
2016-01-10 TO 2016-01-21

use this:
2016-01-10T00:00:00Z TO 2016-01-21T00:00:00Z

Your performance will be much worse with string types and regexes
 than either tdate or dateRange.

Best,
Erick

On Tue, Jan 26, 2016 at 10:13 AM, vsriram30 <vsrira...@gmail.com> wrote:
> Probably, I should not have mentioned, it cannot be achieved, as still we can
> achieve that by using multiple OR queries with regex matching on that String
> field, though it doesn't look good :-)
>
> -Sriram
>
>
>
> --
> View this message in context: 
> http://lucene.472066.n3.nabble.com/Solr-partial-date-range-search-tp4253226p4253415.html
> Sent from the Solr - User mailing list archive at Nabble.com.


Re: Solr partial date range search

2016-01-26 Thread vsriram30
Yes Eric. I am using that full date form based date range query till now and
we have a requirement change to search based on partial date ranges. Hence
was looking at these options.

Kind Regards,
-Sriram



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Solr-partial-date-range-search-tp4253226p4253488.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Solr partial date range search

2016-01-26 Thread Erick Erickson
Still, I have to ask why bother? Presumably you have some kind of front-end
that takes the dates. Simply have that form the proper full date specification.

Or create a query component that intercepts the query on the Solr side and
massages it enough to form the full date. Or

Using strings and wildcards is the _last_ thing I'd do, and that only
in extremis.

Best,
Erick

On Tue, Jan 26, 2016 at 2:55 PM, vsriram30 <vsrira...@gmail.com> wrote:
> Yes Eric. I am using that full date form based date range query till now and
> we have a requirement change to search based on partial date ranges. Hence
> was looking at these options.
>
> Kind Regards,
> -Sriram
>
>
>
> --
> View this message in context: 
> http://lucene.472066.n3.nabble.com/Solr-partial-date-range-search-tp4253226p4253488.html
> Sent from the Solr - User mailing list archive at Nabble.com.


Re: Solr partial date range search

2016-01-25 Thread Shawn Heisey
On 1/25/2016 5:59 PM, vsriram30 wrote:
> I am using solr 4.6.1. I have a date field (TrieDateField) in my schema and
> I am trying to perform partial date range search as given in
> https://cwiki.apache.org/confluence/display/solr/Working+with+Dates 
> Query = date_field:[2016-01-11 TO NOW]
> But I am getting,
> "error": {
> "msg": "Invalid Date String:'2016-01-11'",
> "code": 400
>   }
>
> If I use full UTC date, it works good. So is the partial date range search
> feature introduced in versions greater than 4.6.1?

If you want to use a partial date string, you cannot use TrieDateField.

You will need to upgrade to at least version 5.0, and use the
|DateRangeField|type instead.  This schema change will require a
reindex.  When TrieDateField is used, it will only accept the full
date/time specification.  The documentation page does not make this very
clear.  I will try to remember to update it.

The Reference Guide does not mention that version 5.x is required for
DateRangeField, because it is not a historical document -- it only
applies to a specific version.  When a new minor version of Solr is
released, the full reference guide is issued with the same version
number as the Solr release.

Thanks,
Shawn



Solr partial date range search

2016-01-25 Thread vsriram30
Hi, 
I am using solr 4.6.1. I have a date field (TrieDateField) in my schema and
I am trying to perform partial date range search as given in
https://cwiki.apache.org/confluence/display/solr/Working+with+Dates 
Query = date_field:[2016-01-11 TO NOW]
But I am getting,
"error": {
"msg": "Invalid Date String:'2016-01-11'",
"code": 400
  }

If I use full UTC date, it works good. So is the partial date range search
feature introduced in versions greater than 4.6.1?

Thanks,
Sriram



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Solr-partial-date-range-search-tp4253226.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Date Range Search

2009-01-06 Thread Sourabh1

For date range search, use alldate:[date1 T23:59:59Z TO date2
T23:59:59Z]. 

Thanks,
Sourabh

Gavin-39 wrote:
 
 Hi,
   Can some one tell me how I can achieve date range searches? For
 instance if I save the DOB as a solr date field how can I do a search to
 get the people,
   1. Who are older than 30 years
   2. Who were born in 1975
 
 etc. Greatly appreciate your help.
 
 Thanks,
 -- 
 Gavin Selvaratnam,
 Project Leader
 
 hSenid Mobile Solutions
 Phone: +94-11-2446623/4 
 Fax: +94-11-2307579 
 
 Web: http://www.hSenidMobile.com 
  
 Make it happen
 
 Disclaimer: This email and any files transmitted with it are confidential
 and intended solely for 
 the use of the individual or entity to which they are addressed. The
 content and opinions 
 contained in this email are not necessarily those of hSenid Software
 International. 
 If you have received this email in error please contact the sender.
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Date-Range-Search-tp15305477p21314862.html
Sent from the Solr - User mailing list archive at Nabble.com.



date range search

2007-05-09 Thread Will Johnson
does solr support date range searching?  i've tried all the examples on
the lucene site as well as using the solr response format and a few
others that seemed nifty but so far I always get query parsing errors.
i know i can easily convert the dates to ints and do ranges that way but
all the documentation seemed to imply it was possibly to do range
searches on real dates, it just didn't give an example that i could see.

 

- will