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">
   <tokenizer class="solr.KeywordTokenizerFactory"/>
            <filter class="solr.LowerCaseFilterFactory"/>

<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>

<requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy">
  <lst name="defaults">
      <str name="suggest">true</str>
      <str name="suggest.count">10</str>
  <arr name="components">

The result of normal query (without suggester) looks like this:

 "sugAddress":["Am Bahndamm",
        "sugStreet":"Am Bahndamm",

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 an idea?

  • Is there missprint? <copyField source="STREET" dest="sugAddress"/> should be <copyField source="STREET" dest="sugStreet"/> ?
    – Anton
    Apr 1, 2021 at 9:52
  • from my understanding you need these 2 lines in your code: <field name="sugstreet" type="text_suggest" indexed="true" stored="true"/> and <copyField source="STREET" dest="sugStreet"/> to achieve what you need
    – Anton
    Apr 1, 2021 at 9:59

1 Answer 1


Suggester works on terms. That is why, first of all, open Solr admin console and check terms for sugStreet field. According to your question, this information should be availably by this URL: http://localhost:8983/solr/#/addrescore/schema?field=sugStreet

I expect that "Am Bahnda" will not be on that list. Then your goal will be to define, why this street is not on the list of terms. I suspect that it can be because of how sugStreet field is configured. In order to have "Am Bahndamm" as one term, you need to make it untokenized(by default all Sitecore search fields are tokenized). Tokenized field means that your string is split by dividers(spaces, tabs, commas). I expect that "Am Bahndamm" was divided into 2 terms: "Am" and "Bahndamm". And "Am" was ignored due to length shorter than the 3 symbols.

You will need to change sugStreet field configuration and make it untokenized.


Then rebuild indexes and check your terms on Solr admin console to make sure that it started to work.

UPDATE: As far as I understand, you want to achieve it without touching Sitecore configuration.

I this case you need to define your sugStreet field with new type without tokenizer by spaces:

<field name="sugStreet" type="text_suggest" indexed="true" stored="true"/>

Then you need to copy source field to destination:

<copyField source="STREET" dest="sugStreet"/>

Afterward, you need to rebuild the index. Copying of field value happens after analisis, so it should work. You should be able to get untokenized terms in sugStreet field and tokenized in STREET field.

  • I have tried this by adding this property to the field: <field name="sugStreet" type="text_suggest" indexed="true" stored="true" indexType="UNTOKENIZED"/> But when starting, i get the error message: Can't load schema /var/solr/data/saddresscore/conf/managed-schema: Invalid field property: indexType
    – tho
    Mar 30, 2021 at 10:37
  • @tho I mean to put this configuration to Sitecore config, not directly to the managed scheme. Then, after putting it to Sitecore configuration, you can populate the scheme from Sitecore doc.sitecore.com/developers/90/… If for some reason you want to do it directly in Solr configuration then you need to make sure that your field sugStreet uses text_suggest field type. (or any other, but with solr.KeywordTokenizerFactory to make sure that your terms are not split by space)
    – Anton
    Mar 30, 2021 at 11:51
  • We use solr in a docker environment, so there is no way to use Sitecore. We already use the solr.KeywordTokenizerFactory in the field for the suggester and the context. But the context query suggester.cfq seems to not accept blanks.
    – tho
    Mar 31, 2021 at 5:55
  • "We use solr in a docker environment, so there is no way to use Sitecore." - that is not true. Docker is only the way how you host your project. You still are able to change anything that you need.
    – Anton
    Mar 31, 2021 at 8:04
  • @tho Did you check terms? (the first part of my answer, to figure out what is wrong)
    – Anton
    Mar 31, 2021 at 8:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.