You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Priti Solanki <pr...@gmail.com> on 2014/03/13 11:45:23 UTC

regex in Solr Query

Hi,


I am trying to fetch all the record for 2005

I have field(int) "pubdateraw": 20130508

Not working - select?q=pubdateraw:/2013*/

Not working - select?q=pubdateraw:/.2013*./

Is it possible to have regex on int field in solr 4.5??

to get the record with "20130508" how am i suppose to write my query in
solr.
Any reading links will be very much helpful.

Regards,
Priti

Re: regex in Solr Query

Posted by Ahmet Arslan <io...@yahoo.com>.
Hi Priti,

Thats an interesting question, I wonder the answer by myself too. Does prefix query work with int?
q=pubdateraw:2013*  ?

By mean time, as a workaround, try range queries. q=pubdateraw:{20130101 TO 20131231}



On Thursday, March 13, 2014 12:45 PM, Priti Solanki <pr...@gmail.com> wrote:
Hi,


I am trying to fetch all the record for 2005

I have field(int) "pubdateraw": 20130508

Not working - select?q=pubdateraw:/2013*/

Not working - select?q=pubdateraw:/.2013*./

Is it possible to have regex on int field in solr 4.5??

to get the record with "20130508" how am i suppose to write my query in
solr.
Any reading links will be very much helpful.

Regards,
Priti


Re: regex in Solr Query

Posted by Priti Solanki <pr...@gmail.com>.
Both works!!

pubdateraw:[20050000 TO 20059999]
pubdateraw:[20050101 TO 20051231]

Thanks Raymond for sharing the useful info as well.


On Thu, Mar 13, 2014 at 4:30 PM, Raymond Wiker <rw...@gmail.com> wrote:

> Regular expressions is a text-matching mechanism, so you shouldn't expect
> to be able to use it on numeric data. If your timestamps are of the form
> you indicate, you should be able to filter on pubdateraw:[20050000 TO
> 20059999].
>
>
> On Thu, Mar 13, 2014 at 11:45 AM, Priti Solanki <pritiatwork@gmail.com
> >wrote:
>
> > Hi,
> >
> >
> > I am trying to fetch all the record for 2005
> >
> > I have field(int) "pubdateraw": 20130508
> >
> > Not working - select?q=pubdateraw:/2013*/
> >
> > Not working - select?q=pubdateraw:/.2013*./
> >
> > Is it possible to have regex on int field in solr 4.5??
> >
> > to get the record with "20130508" how am i suppose to write my query in
> > solr.
> > Any reading links will be very much helpful.
> >
> > Regards,
> > Priti
> >
>

Re: regex in Solr Query

Posted by Raymond Wiker <rw...@gmail.com>.
Regular expressions is a text-matching mechanism, so you shouldn't expect
to be able to use it on numeric data. If your timestamps are of the form
you indicate, you should be able to filter on pubdateraw:[20050000 TO
20059999].


On Thu, Mar 13, 2014 at 11:45 AM, Priti Solanki <pr...@gmail.com>wrote:

> Hi,
>
>
> I am trying to fetch all the record for 2005
>
> I have field(int) "pubdateraw": 20130508
>
> Not working - select?q=pubdateraw:/2013*/
>
> Not working - select?q=pubdateraw:/.2013*./
>
> Is it possible to have regex on int field in solr 4.5??
>
> to get the record with "20130508" how am i suppose to write my query in
> solr.
> Any reading links will be very much helpful.
>
> Regards,
> Priti
>