You can also use phrase queries as title_search:"new york" if your
intent is to find the words "new" and "york" right next to each other.
There's also "slop", as "new york"~3 if you want to find the two words
within 3 (in this example) positions of each other.

Take a look at the admin/analysis page for questions like this, it'll
_really_
help.

Best,
Erick


On Wed, Jan 8, 2014 at 4:38 AM, Ahmet Arslan <iori...@yahoo.com> wrote:

> Hi Peter,
>
> q=title_search:new york parsed as title_search:new
> default_search_field:york.
> If you use a tokenized type, use parenthesis q=title_search:(new york)
>
> If you use string type, use term query parser q={!term f=city_search}new
> york
>
> Ahmet
>
>
>
> On Wednesday, January 8, 2014 11:22 AM, PeterKerk <vettepa...@hotmail.com>
> wrote:
> My query on finding a cityname does not show the closest matching value,
> but
> instead gives priority to the first word in the searchquery.
>
> I believe it has something to do with the whitespace tokenenization, but I
> don't know which fields to change to what type.
>
>
> Here's what happens when I search on "new york"
>
>
> http://localhost:8983/solr/tt-cities/select/?indent=off&facet=false&fl=id,title&q=title_search:*new%20york*&defType=lucene&start=0&rows=10
>
> <result name="response" numFound="810" start="0">
>     <doc>
>     <str name="title">New Golden Beach</str>
>     </doc>
>     <doc>
>     <str name="title">New Auckland</str>
>     </doc>
>     <doc>
>     <str name="title">New Waverly</str>
>     </doc>
>     <doc>
>     <str name="title">New Market Village Mobile Home Park</str>
>     </doc>
>     <doc>
>     <str name="title">New Centerville</str>
>     </doc>
>     <doc>
>     <str name="title">New Meadows</str>
>     </doc>
>     <doc>
>     <str name="title">New Plymouth</str>
>     </doc>
>     <doc>
>     <str name="title">New Hope Mobile Home Park</str>
>     </doc>
>     <doc>
>     <str name="title">New Light</str>
>     </doc>
>     <doc>
>     <str name="title">New Vienna</str>
>     </doc>
> </result>
>
>
> My schema.xml
>
>     <fieldType name="text_ws" class="solr.TextField"
> positionIncrementGap="100">
>       <analyzer>
>         <tokenizer class="solr.WhitespaceTokenizerFactory"/>
>       </analyzer>
>     </fieldType>
>
>
>     <field name="title" type="text_ws" indexed="true" stored="true"/>
>     <field name="title_search" type="string" indexed="true" stored="true"/>
>
>     <copyField source="title" dest="title_search"/>
>
> I also tried:
>
>     <field name="title_search" type="text" indexed="true"
> stored="true"/>
>
> And:
>     <field name="title" type="string" indexed="true" stored="true"/>
>     <field name="title_search" type="string" indexed="true" stored="true"/>
>
>
>
> What to do?
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Searchquery-on-field-that-contains-space-tp4110166.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>

Reply via email to