I have SOLR and it works, indexing data through DIH and correctly returning results for queries. I am trying to configure another kernel to run an examiner in order to autocomplete geographic locations. We have a web application that should take the city, state / region, country. We would like to do it in one window. Here are some examples:
Brooklyn, New York, United States
Philadelphia, Pennsylvania, USA
Barcelona, โโCatalonia, Spain
Suppose now that every place around the world can be divided into this 3-element entrance. I installed DIH to create a TemplateTransformer field that combines 4 tables (city, state, and country โ all independent tables connected to each other by the wizard table) in a field called "fullplacename":
<field column="fullplacename" template="${city_join.plainname}, ${region_join.plainname}, ${country_join.plainname}"/>
I defined the text_auto field in schema.xml:
<fieldType class="solr.TextField" name="text_auto"> <analyzer> <tokenizer class="solr.KeywordTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory"/> </analyzer> </fieldType>
and also defined these two fields:
<field name="name_autocomplete" type="text_auto" indexed="true" stored="true" multiValued="true" /> <copyField source="fullplacename" dest="name_autocomplete" />
Now, here is my problem. This works fine for the first term, i.e. If I type "brooklyn", I get the expected results using this URL for the query:
http: // localhost: 8983 / solr / places / suggest? q = brooklyn
However, as soon as I put a comma and / or space there, it breaks them into 2 sentences, and I get a sentence for each:
http: // localhost: 8983 / solr / places / suggest? q = brooklyn% 2C% 20ny
Gives me a sentence for "brooklyn" and a sentence for "ny" instead of a sentence that matches "brooklyn, ny". I tried every solution I can find through Google and I was out of luck. Is there something simple that I missed, or is this the wrong approach?
Thanks!
EDIT: Just in case, here is the definition of searchComponent and requestHandler:
<requestHandler name="/suggest" class="org.apache.solr.handler.component.SearchHandler"> <lst name="defaults"> <str name="spellcheck">true</str> <str name="spellcheck.dictionary">suggest</str> <str name="spellcheck.count">10</str> </lst> <arr name="components"> <str>suggest</str> </arr> </requestHandler> <searchComponent name="suggest" class="solr.SpellCheckComponent"> <lst name="spellchecker"> <str name="name">suggest</str> <str name="classname">org.apache.solr.spelling.suggest.Suggester</str> <str name="lookupImpl">org.apache.solr.spelling.suggest.tst.TSTLookup</str> <str name="field">name_autocomplete</str>`<br/> </lst> </searchComponent>