Spaces, if there in a term query, should be escaped before searching. myField:quick\ brown\ fox is the correct way to search for quick brown fox in myField using TermQuery.
You can always add &debugQuery=on your search url. The response will contain a lot of helpful information on how the incoming query was parsed into a Lucene query, thereby giving you a good idea as to what might have gone wrong. Cheers Avlesh On Thu, Sep 3, 2009 at 5:36 AM, Adam Allgaier <allgai...@yahoo.com> wrote: > I think I understand what happened..... > > The query "+specific_LIST_s:For Sale" is processed and broken into "For" > and "Sale". The specific_LIST_s field is a "string", so it is not > tokenized, but remains indexed as "For Sale", which matches neither "For" > nor "Sale". Hence, no results. > > This query solves the problem: > +specific_LIST_s:"For Sale" > > Cheers, > Adam :-) > > > > > ----- Original Message ---- > From: Dan A. Dickey <dan.dic...@savvis.net> > To: solr-user@lucene.apache.org > Cc: Adam Allgaier <allgai...@yahoo.com> > Sent: Wednesday, September 2, 2009 6:20:13 PM > Subject: Re: Problem querying for a value with a "space" > > On Wednesday 02 September 2009 15:15:42 Adam Allgaier wrote: > > Touch gently with the Solr newbie....I've searched trying to find an > answer to this problem with no success. I'm sure it's something small and > easy. > > > > I'm using Solr 1.3 with Solrj client > > > > <fieldType name="string" class="solr.StrField" sortMissingLast="true" > omitNorms="true"/> > > ... > > <dynamicField name="*_s" type="string" indexed="true" stored="true"/> > > > > I am indexing the "specific_LIST_s" with the value "For Sale". > > The document indexes just fine. A query returns the document with the > proper value: > > <str name="specific_LIST_s">For Sale</str> > > > > However, when I try to query on that field.... > > +specific_LIST_s:For Sale > > +specific_LIST_s:For+Sale > > +specific_LIST_s:For%20Sale > > > > ....I get no results with any one of those three queries. > > Your problem looks *very* much like what I just went through. > Not sure, but... > > You are searching specific_LIST_s for "For". The "Sale" part is being > searched > for in your defaultSearchField. Putting "'s around the For Sale won't help > either. > You need to query something like: > specific_LIST_s:For OR specific_LIST_s:Sale > At least, that's what I ended up doing. In my case, I could have changed > the > defaultSearchField to what I wanted to search on in this situation - but I > chose to > explicitly set the query string. YMMV. > -Dan > > > > > If I index the value "ForSale" (no space), then execute the query.... > > +specific_LIST_s:ForSale > > > > ...returns the expected document. > > > > What am I missing? > > > > Thanks in advance, > > Adam :-) > > > > > > > > > > -- > Dan A. Dickey | Senior Software Engineer > > Savvis > 10900 Hampshire Ave. S., Bloomington, MN 55438 > Office: 952.852.4803 | Fax: 952.852.4951 > E-mail: dan.dic...@savvis.net > > > > >