I am trying to use the edismax defType and am running into the following error.
HTTP ERROR : 400
Unknown query type 'edismax'
The request handler in the solrconfig.xml file looks as follows
<requestHandler name="foobar" class="solr.SearchHandler">
<lst name="defaults">
<str name="defType">edismax</str>
<str name="qf">block</str>
<str name="q.alt">*:*</str>
</lst>
</requestHandler>
My goal is to do wildcard searches with this search handler.
We recently upgraded to use Solr 3.2 from 1.4. Is there a setting or a config that has to be change to allow edismax?
Thanks!
HTTP ERROR : 400 Unknown query type 'edismax'
Its indicating an invalid query type parameter which is qt and not defType.
Are you trying to use qt=edismax, if so, this might result into this error as the request handler is named foobar.
You can rename foobar to edismax or use qt=foobar
Related
Why when I setup a Solr follower/slave do I get this message in the Solr logs
'leaderUrl' must be specified without the /replication suffix
This used to work fine in ersion 7.6 but now in version 8.11.1 it complains. What should the value be if not /replication?
This is the XML snippet in the solrconfig.xml that does the replications
<requestHandler name="/replication" class="solr.ReplicationHandler">
<lst name="slave">
<str name="leaderUrl">http://solr1:8983/solr/bookings/replication</str>
<str name="pollInterval">00:00:20</str>
</lst>
</requestHandler>
It seems to mean the leadUrl, I seemed to be transfixed on the name of the request handler!
So going from this which worked in 7.6
<str name="masterUrl">http://solr1:8983/solr/bookings/replication</str>
to this which works in 8.11.1
<str name="leaderUrl">http://solr1:8983/solr/bookings</str>
I have tried to run a single term search in Solr 9.0 through by using
q=term
(e.g. http://localhost:8983/solr/windowstest/select?indent=true&q.op=OR&q=yelp).
I've noticed that older versions of Solr were able to handle such a request but now I can only search all fields for that term by adding using OR
q=id:yelp OR subject:yelp OR body:yelp
(e.g. http://localhost:8983/solr/windowstest/select?indent=true&q.op=OR&q=id%3Ayelp%20OR%20subject%3Ayelp%20OR%20body%3Ayelp).
Is there a way to not have to indicate the fields?
There is no setting for "searching all fields"; however, what is usually done is to have a single field as the copyField destination for all fields. You can do this by defining a catch-all field (by default named _text_, and then configuring <copyField src="*" dest="_text_"> - making the content of all the fields get copied into _text_.
You can then set the default search field (i.e. where there isn't a field name given) with the df parameter in the query - the default field.
http://localhost:8983/solr/windowstest/selectq.op=OR&q=yelp&df=_text_
If you want to set this as the default, you configure it as a default parameter in solrconfig.xml under the specific request handler:
<requestHandler name="/select" class="solr.SearchHandler">
<lst name="defaults">
<str name="df">_text_</str>
<int name="rows">10</int>
</lst>
</requestHandler>
.. or by using initparams:
<initParams path="/update/**,/query,/select,/tvrh,/elevate,/spell">
<lst name="defaults">
<str name="df">_text_</str>
</lst>
</initParams>
I have a Solr More Like This Handler, configured as follows:
Request Handler Configuration
<requestHandler name="/themlturl" class="solr.MoreLikeThisHandler">
<lst name="defaults">
<str name="wt">json</str>
<int name="rows">5</int>
<str name="mlt.fl">name, category_stack</str>
<str name="mlt.qf">name^3 category_stack^5</str>
<str name="fl">id, name</str>
<str name="mlt">true</str>
<str name="mlt.mintf">1</str>
</lst>
</requestHandler>
Simple Query
Queries that has one document match work fine
results in
Query With More Than One Document
I am trying to get documents similar to more than one document using an OR in the q field.
This results in the following response
it is clear that Solr found the three documents since the match > numFound is 3, but the returned documents in the match > docs is only one, and the results in the response are documents similar to that one document.
Does the MLT handler support multiple documents ? if not, is there a solution other than querying the handler once for each document.
What I am trying to build is a simple content-based recommendation engine which is supposed to show documents similar to the ones a user saves.
I need a search request handler that only return a specific sets of field in a collection, but for security reasons, no one can change what fields to be displayed. (There are some indexed sensitive fields that I don't want anyone access it)
I tried to use invariants in the request handler, and define the list of field there, so I made a handler like this:
<requestHandler class="solr.SearchHandler" name="/search">
<lst name="defaults">
<str name="q">*:*</str>
</lst>
<lst name="invariants">
<str name="fl">content</str>
<str name="fl">description</str>
</lst>
</requestHandler>
However, I get this error when I call the request handler:
{
"responseHeader":{
"zkConnected":true,
"status":500,
"QTime":4},
"error":{
"trace":"java.lang.NullPointerException\r\n\tat org.apache.solr.handler.component.QueryComponent.mergeIds(QueryComponent.java:940)\r\n\tat org.apache.solr.handler.component.QueryComponent.handleRegularResponses(QueryComponent.java:585)\r\n\tat org.apache.solr.handler.component.QueryComponent.handleResponses(QueryComponent.java:564)\r\n\tat org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:423)\r\n\tat org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:177)\r\n\tat org.apache.solr.core.SolrCore.execute(SolrCore.java:2503)\r\n\tat org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:710)\r\n\tat org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:516)\r\n\tat org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:382)\r\n\tat org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:326)\r\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1751)\r\n\tat org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582)\r\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)\r\n\tat org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)\r\n\tat org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)\r\n\tat org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)\r\n\tat org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)\r\n\tat org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)\r\n\tat org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)\r\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)\r\n\tat org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)\r\n\tat org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)\r\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)\r\n\tat org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:335)\r\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)\r\n\tat org.eclipse.jetty.server.Server.handle(Server.java:534)\r\n\tat org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)\r\n\tat org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)\r\n\tat org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)\r\n\tat org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108)\r\n\tat org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:251)\r\n\tat org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)\r\n\tat org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108)\r\n\tat org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)\r\n\tat org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)\r\n\tat org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)\r\n\tat org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)\r\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)\r\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)\r\n\tat java.lang.Thread.run(Unknown Source)\r\n",
"code":500}}
Currently I do a workaround to put the fields inside the default instead of invariants. so I made the handler to be like this instead:
<requestHandler class="solr.SearchHandler" name="/search">
<lst name="defaults">
<str name="q">*:*</str>
<str name="fl">content</str>
<str name="fl">description</str>
</lst>
</requestHandler>
This workaround is working, but I don't want that because it's not secure enough. Anyone can help?
For additional information, I'm using Solr version 7.2.1, and the collection has 2 shards, 2 replicas.
When you set the fl list to invariant, that means that the internal requests between shards won't be able to override it either. The line triggering your error is:
resultIds.put(shardDoc.id.toString(), shardDoc);
I'm guessing you'd want to include id in your field list, and probably _version_ and _root_ as well. _version_ have special meaning when it comes to replication and optimistic concurrent update, while _root_ affects child documents.
I tried using Solr's Suggester component but it gives exception Unknown Search Component: spellcheck. I am using solr version 3.6. I made changes in solrconfig.xml so it looks like this
<searchComponent class="solr.SpellCheckComponent" name="suggester">
<lst name="spellchecker">
<str name="name">suggester</str>
<str name="field">name</str>
<str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
<str name="lookupImpl">org.apache.solr.spelling.suggest.tst.TSTLookup</str>
<float name="threshold">0.005</float>
<str name="buildOnCommit">true</str>
<str name="spellcheckIndexDir">spellchecker</str>
</lst>
</searchComponent>
<requestHandler class="org.apache.solr.handler.component.SearchHandler" name="/suggester">
<lst name="defaults">
<str name="spellcheck">true</str>
<str name="spellcheck.dictionary">suggester</str>
<str name="spellcheck.count">10</str>
</lst>
<arr name="components">
<str>suggester</str>
</arr>
</requestHandler>
Now i saved it and started solr but it gives a 500 error. There is a long stack trace which goes like this
HTTP Status 500 - Severe errors in solr configuration. Check your log files for more detailed information on what may be wrong. If you want solr to continue after configuration errors, change: <abortOnConfigurationError>false</abortOnConfigurationError> in solr.xml ------------------------------------------------------------- org.apache.solr.common.SolrException: No cores were created, please check the logs for errors at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:172) at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:96) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295) at
---lot of lines---
and some more
Caused by: org.apache.solr.common.SolrException: Unknown Search Component: spellcheck at org.apache.solr.core.SolrCore.getSearchComponent(SolrCore.java:893) at org.apache.solr.handler.component.SearchHandler.inform(SearchHandler.java:118) at org.apache.solr.core.SolrResourceLoader.inform(SolrResourceLoader.java:527) at org.apache.solr.core.SolrCore.<init>(SolrCore.java:594) ... 32 more
According to the stack trace Solr is not able to find the spellcheck component but according to the Solr wiki this component comes with Solr version > 1.4.
You seem to have named your search component suggester, and your requestHandler refers to it correctly, so that's probably not where the issue is. Can you check in the rest of your solrconfig.xml whether some other requestHandler refers to a component named spellcheck in its last-components section or elsewhere? That would throw an error since it can no longer find a component with that name (it's been renamed to suggester).
The thing with solrconfig is that it comes with a lot of preconfigured search handlers, and if you change the default name of one item it could cause issues with handlers that refer to it.