Respect the submission guidelines above! Drupal.org issue forks cause additional work for the project maintainer!

Setup

  • Solr version: 8.11.1
  • Drupal Core version: 9.3.13
  • Search API version: 1.23.0
  • Search API Solr version: 4.2.7
  • Configured Solr Connector: Standard

Issue

Hello,

I have problems getting the autocompletion using the suggester of solr to work. I'm posting it as a bug since I think I configured it well and it doesn't work though.

I configured it in /admin/config/search/search-api/index/solr_index/autocomplete and the only enabled suggester is the "Solr-Suggester". In the further config I restricted to the current drupal site and selected that solr should take care of the language.

In fact the suggestions are an empty every time I type in something. Also the suggest endpoint throws the error "No suggester named 10 was configured" when using the default config the module generates. After deleting the line

<str name="suggest.dictionary">10</str>

from solrconfig_extra.xml in the handler

<requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy">

it at least doesn't throw an exception.

Due to the lack of documentation I didn't get the point of the field twm_suggest which seems to be an important thing for the suggester as it's used in the suggest components:

<searchComponent name="suggest" class="solr.SuggestComponent">
    <lst name="suggester">
      <str name="name">en</str>
      <str name="lookupImpl">AnalyzingInfixLookupFactory</str>
      <str name="dictionaryImpl">DocumentDictionaryFactory</str>
      <str name="field">twm_suggest</str>

Do I need to add it as a "field"? What's the point of it exactly?

Any help is highly appreciated!

Thanks in advance!

Bye Defcon0

CommentFileSizeAuthor
#4 screen.png106.46 KBdefcon0

Comments

Defcon0 created an issue. See original summary.

mkalkbrenner’s picture

In fact the suggestions are an empty every time I type in something. Also the suggest endpoint throws the error "No suggester named 10 was configured" when using the default config the module generates. After deleting the line

<str name="suggest.dictionary">10</str>

The dictionary name should be the language id. Obviously there's something wrong.

The suggester dictionary needs to be filled. You need to configure your index to index some drupal fields as "Suggester".

avpaderno’s picture

Issue tags: -autocomplete, -suggester
defcon0’s picture

StatusFileSize
new106.46 KB

OK, the <str name="suggest.dictionary">10</str> issue has already been fixed in the 4.x branch (https://git.drupalcode.org/project/search_api_solr/-/commit/1af08055e5fa...) but isn't tagged, yet in 4.2.7 which is the latest version (I composer-required it using this constraint: ^4.2). Is there a reson that the latest tag is way older then the 4.x branch? Should we use the branch instead?

After applying that fix manually and adding some fields as "Suggester" as you advised, the error is gone but after calling /solr/dev/suggest?q=test&wt=json I get:

{
  "responseHeader":{
    "status":500,
    "QTime":0},
  "error":{
    "msg":"suggester was not built",
    "trace":"java.lang.IllegalStateException: suggester was not built\n\tat org.apache.lucene.search.suggest.analyzing.AnalyzingInfixSuggester.lookup(AnalyzingInfixSuggester.java:556)\n\tat org.apache.lucene.search.suggest.analyzing.AnalyzingInfixSuggester.lookup(AnalyzingInfixSuggester.java:475)\n\tat org.apache.solr.spelling.suggest.fst.AnalyzingInfixLookupFactory$1.lookup(AnalyzingInfixLookupFactory.java:125)\n\tat org.apache.lucene.search.suggest.analyzing.AnalyzingInfixSuggester.lookup(AnalyzingInfixSuggester.java:464)\n\tat org.apache.lucene.search.suggest.Lookup.lookup(Lookup.java:240)\n\tat org.apache.solr.spelling.suggest.SolrSuggester.getSuggestions(SolrSuggester.java:248)\n\tat org.apache.solr.handler.component.SuggestComponent.process(SuggestComponent.java:266)\n\tat org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:368)\n\tat org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:216)\n\tat org.apache.solr.core.SolrCore.execute(SolrCore.java:2637)\n\tat org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:794)\n\tat org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:567)\n\tat org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:427)\n\tat org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:357)\n\tat org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:201)\n\tat org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)\n\tat org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)\n\tat org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600)\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)\n\tat org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)\n\tat org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1434)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)\n\tat org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)\n\tat org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)\n\tat org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1349)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)\n\tat org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:191)\n\tat org.eclipse.jetty.server.handler.InetAccessHandler.handle(InetAccessHandler.java:177)\n\tat org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)\n\tat org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:322)\n\tat org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:763)\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)\n\tat org.eclipse.jetty.server.Server.handle(Server.java:516)\n\tat org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:400)\n\tat org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:645)\n\tat org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:392)\n\tat org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)\n\tat org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)\n\tat org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)\n\tat org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)\n\tat org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)\n\tat org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)\n\tat org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)\n\tat org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)\n\tat org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)\n\tat java.base/java.lang.Thread.run(Unknown Source)\n",
    "code":500}}

I defined my fields as you can see in the screenshot attached. In the frontend I get "[]" for any query still.

Could you please point me in a direction how to debug this? Big thanks in advance!

defcon0’s picture

Ah, one step further. After manuelly changing the dictionary from "und"

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

to "de"

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

it brings up results.

Is this a bug? Maybe I misconfigured something in the plugin?

mkalkbrenner’s picture

Category: Bug report » Support request

The dictionary "und" is just the default. It will be overwritten by the query. It seems that this code isn't able to detect the right language and also uses the "und" fallback. I assume that you don't provide the correct language filter in your query (view).

mkalkbrenner’s picture

Status: Active » Fixed

No further feedback. Feel free to re-open the issue if required.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.