lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan A. Dickey" <>
Subject Re: Problem querying for a value with a "space"
Date Wed, 02 Sep 2009 23:20:13 GMT
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.

> 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

10900 Hampshire Ave. S., Bloomington, MN  55438
Office: 952.852.4803 | Fax: 952.852.4951

View raw message