I am using Solr version 8.8.1 in a docker container. I use an address query system based on a CSV file. I want to get a city in relation to the street name. The fields in my managed-schema are looking like this:
<fieldType name="text_suggest" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
<field name="sugAddress" type="text_suggest" multiValued="true" indexed="true" stored="true"/>
<field name="sugCity" type="text_suggest" indexed="true" stored="true"/>
<copyField source="CITY" dest="sugAddress"/>
<copyField source="POSTCODE" dest="sugAddress"/>
<copyField source="STREET" dest="sugAddress"/>
<copyField source="CITY" dest="sugCity"/>
My solrconfig.xml is looking like this:
<searchComponent name="solr_suggest" class="solr.SuggestComponent">
<lst name="suggester">
<str name="name">sugCitySuggester</str>
<str name="lookupImpl">BlendedInfixLookupFactory</str>
<str name="highlight">false</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">sugCity</str>
<str name="buildOnOptimize">true</str>
<str name="weightField">sugAddress</str>
<str name="contextField">sugAddress</str>
<str name="suggestAnalyzerFieldType">text_suggest</str>
<str name="buildOnCommit">true</str>
</lst>
</searchComponent>
<requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy">
<lst name="defaults">
<str name="suggest">true</str>
<str name="suggest.count">10</str>
</lst>
<arr name="components">
<str>solr_suggest</str>
</arr>
</requestHandler>
The result of a normal query (without a suggester) looks like this:
{
"sugAddress":["Am Bahndamm",
"3",
"3",
"65432",
"Testcity"],
"sugStreet":"Am Bahndamm",
"sugPostcode":"65432",
"sugCity":"Testcity",
"id":"1e470f44-fe3a-4fb9-b71d-ca556a48c55f",
"_version_":1695636026132791297,
"NO_FROM":[3],
"NO_TO":[3],
"POSTCODE":[65432]
},
{
"sugAddress":["Teststreet",
"4",
"4",
"65432",
"Testcity"],
"sugStreet":"Teststreet",
"sugPostcode":"65432",
"sugCity":"Testcity",
"id":"1e470f44-fe3a-4fb9-b71d-ca556a48c55f",
"_version_":1695636026132791297,
"NO_FROM":[4],
"NO_TO":[4],
"POSTCODE":[65432]
}
All indexes are build.
The following query brings correctly one result:
http://localhost:8983/solr/addrescore/suggest?suggest=true&suggest.dictionary=sugCitySuggester&suggest.q=Test&suggest.cfq=Teststreet
But the following returns no results:
http://localhost:8983/solr/addrescore/suggest?suggest=true&suggest.dictionary=sugCitySuggester&suggest.q=Test&suggest.cfq=Am%20Bahndamm
There seems to be a problem with spaces in the context query. Has someone had an idea?