1

I have a schema as below

 <fieldType name="text" class="solr.TextField" positionIncrementGap="100">
    <analyzer type="index">
       <tokenizer class="solr.KeywordTokenizerFactory"/>
       <filter class="solr.LowerCaseFilterFactory"/>
    </analyzer>
 <analyzer type="query">
    <tokenizer class="solr.KeywordTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
 </fieldType>

And my document will be:

  1. Koh Samui
  2. Koh Chang
  3. Koh Lanta

When i do the search Koh* It returns 3 results. it accepted. But when i search koh S*. it return zero result. I want the result would be only Koh Samui

Roney Michael
  • 3,964
  • 5
  • 30
  • 45
Anh Tuan
  • 7
  • 2
  • Seems like a [duplicate][1] . You need to escape the whitespace. [1]: http://stackoverflow.com/questions/10023133/solr-wildcard-query-with-whitespace – Okke Klein Nov 29 '13 at 11:02

1 Answers1

0

I assume you want to use a wildcard query. This depends on the Query Parser you are using. If you are using the Standard Query Parser, Dismax, or eDismax, all of these don't support wild card queries.

And to be honest if you are using Solr to search for wildcard queries, you might be using the wrong tool as the solution, you can use any SQL Database and use text like 'Koh S%' in the where clause, and this will give you what you want.

But anyway, to use a wild card Query in Solr you need to use the Lucene query parser directly. To do this, use the following query:

http://localhost:8983/solr/core/select?q={!lucene df=text}Koh S*
Emad
  • 544
  • 2
  • 6