Filter query doesn't always work...

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Filter query doesn't always work...

escher2k
I have a strange problem, and I don't seem to see any issue with the data. I am filtering
on a field called reviews_positive_6_mos. The field is declared as an integer.

If I specify -
(a) fq=reviews_positive_6mos%3A[*+TO+*] => 36033 records are retrieved.
(b) fq=reviews_positive_6mos%3A[*+TO+100] => 35996 records are retrieved.
(c) fq=reviews_positive_6mos%3A[80+TO+100] => 0 records are retrieved.
(d) fq=reviews_positive_6mos%3A[80+TO+*] => 9 records are retrieved.
(e) fq=reviews_positive_6mos%3A[100+TO+100] => 764 records are retrieved.

I am not sure what could be wrong in cases (c) and (d), especially when there is a lot of data where
reviews_positive_6mos = 100. Any suggestions would be most appreciated.

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Filter query doesn't always work...

mirko-9
Hi,

you might want to use the sint (sortable integer) fieldtype instead.  If you use
 the integer fieldtype I guess the range queries are treated as string prefixes
(like in [Ab TO Ch]).

You can find some documentation about it in the example schema.xml:
http://svn.apache.org/viewvc/lucene/solr/trunk/example/solr/conf/schema.xml

mirko


Quoting escher2k <[hidden email]>:

>
> I have a strange problem, and I don't seem to see any issue with the data. I
> am filtering
> on a field called reviews_positive_6_mos. The field is declared as an
> integer.
>
> If I specify -
> (a) fq=reviews_positive_6mos%3A[*+TO+*] => 36033 records are retrieved.
> (b) fq=reviews_positive_6mos%3A[*+TO+100] => 35996 records are retrieved.
> (c) fq=reviews_positive_6mos%3A[80+TO+100] => 0 records are retrieved.
> (d) fq=reviews_positive_6mos%3A[80+TO+*] => 9 records are retrieved.
> (e) fq=reviews_positive_6mos%3A[100+TO+100] => 764 records are retrieved.
>
> I am not sure what could be wrong in cases (c) and (d), especially when
> there is a lot of data where
> reviews_positive_6mos = 100. Any suggestions would be most appreciated.
>
> Thanks.
> --
> View this message in context:
>
http://www.nabble.com/Filter-query-doesn%27t-always-work...-tf3474766.html#a9698269
> Sent from the Solr - User mailing list archive at Nabble.com.
>


Reply | Threaded
Open this post in threaded view
|

Re: Filter query doesn't always work...

escher2k
Thanks a lot Mirklo. That seems to work.

mirko-9 wrote
Hi,

you might want to use the sint (sortable integer) fieldtype instead.  If you use
 the integer fieldtype I guess the range queries are treated as string prefixes
(like in [Ab TO Ch]).

You can find some documentation about it in the example schema.xml:
http://svn.apache.org/viewvc/lucene/solr/trunk/example/solr/conf/schema.xml

mirko


Quoting escher2k <escher2k@yahoo.com>:

>
> I have a strange problem, and I don't seem to see any issue with the data. I
> am filtering
> on a field called reviews_positive_6_mos. The field is declared as an
> integer.
>
> If I specify -
> (a) fq=reviews_positive_6mos%3A[*+TO+*] => 36033 records are retrieved.
> (b) fq=reviews_positive_6mos%3A[*+TO+100] => 35996 records are retrieved.
> (c) fq=reviews_positive_6mos%3A[80+TO+100] => 0 records are retrieved.
> (d) fq=reviews_positive_6mos%3A[80+TO+*] => 9 records are retrieved.
> (e) fq=reviews_positive_6mos%3A[100+TO+100] => 764 records are retrieved.
>
> I am not sure what could be wrong in cases (c) and (d), especially when
> there is a lot of data where
> reviews_positive_6mos = 100. Any suggestions would be most appreciated.
>
> Thanks.
> --
> View this message in context:
>
http://www.nabble.com/Filter-query-doesn%27t-always-work...-tf3474766.html#a9698269
> Sent from the Solr - User mailing list archive at Nabble.com.
>