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 darniz <rn...@edmunds.com> on 2009/05/19 23:10:56 UTC

query with string search and ranges

Hi All
i am having a query being constructed at runtime. For example from
freemarker i am getting a string like
vehicleType:Sedan+features:mast antenna+msrp:[10000 TO 20000].
When i make a solrJ call i have to manually check the data type of the
field. For text search i have to append double quotes and for ranges as it
is. hence my solrJ Query String will be like
"vehicleType:\"Sedan\" AND features:\"mast antenna\" AND msrp:[10000 TO
20000]"
Is there any easy way of doing the query with out any changes, or i can use
any inbuilt solr feature which is smart enough to do full text search and i
dont have to exclusively give the double quotes.
For example msrp is of type slong, which brings me to the question of
difference between long and slong.
Can any body please anwer this

-- 
View this message in context: http://www.nabble.com/query-with-string-search-and-ranges-tp23624101p23624101.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: query with string search and ranges

Posted by Avlesh Singh <av...@gmail.com>.
>
> Is there any easy way of doing the query with out any changes, or i can use
> any inbuilt solr feature which is smart enough to do full text search and i
> dont have to exclusively give the double quotes.
>

>From the query I can make out that you always want to do a phrase* *query.
You have to construct one if your field is of type text/string.

For example msrp is of type slong, which brings me to the question of
> difference between long and slong.
>

A field of type sortable (int | long | double | float) helps you in doing
range queries on your field, which you are actually doing for your field
msrp. Read more here -
http://www.lucidimagination.com/blog/2009/02/09/sorting-faceting-and-schema-design-in-solr/

Cheers
Avlesh

On Wed, May 20, 2009 at 2:40 AM, darniz <rn...@edmunds.com> wrote:

>
> Hi All
> i am having a query being constructed at runtime. For example from
> freemarker i am getting a string like
> vehicleType:Sedan+features:mast antenna+msrp:[10000 TO 20000].
> When i make a solrJ call i have to manually check the data type of the
> field. For text search i have to append double quotes and for ranges as it
> is. hence my solrJ Query String will be like
> "vehicleType:\"Sedan\" AND features:\"mast antenna\" AND msrp:[10000 TO
> 20000]"
> Is there any easy way of doing the query with out any changes, or i can use
> any inbuilt solr feature which is smart enough to do full text search and i
> dont have to exclusively give the double quotes.
> For example msrp is of type slong, which brings me to the question of
> difference between long and slong.
> Can any body please anwer this
>
> --
> View this message in context:
> http://www.nabble.com/query-with-string-search-and-ranges-tp23624101p23624101.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>