Marc Linden created SOLR-14662:
----------------------------------
Summary: Elevation with distributed search causes NPE
Key: SOLR-14662
URL: https://issues.apache.org/jira/browse/SOLR-14662
Project: Solr
Issue Type: Bug
Security Level: Public (Default Security Level. Issues are Public)
Affects Versions: 8.2
Reporter: Marc Linden
When performing a distributed search with multiple shards having elevation
configured where one ore more shards do have elevated results but others do not
a NullPointerException is thrown.
We are using Solr 8.2 and have the QueryElevationComponent configured with
"last-components" of the default search handler "/select". But the problem also
occurs when using the explicit "/elevate" search handler.
{code:xml}
<requestHandler name="/select" class="solr.SearchHandler">
...
<arr name="last-components">
<str>elevator</str>
</arr>
</requestHandler>
...
<searchComponent name="elevator" class="solr.QueryElevationComponent" >
<!-- pick a fieldType to analyze queries -->
<str name="queryFieldType">string</str>
<str name="config-file">elevate.xml</str>
</searchComponent>
{code}
h3. Steps to reproduce:
# Add entries to the elevate.xml of each core to elevate a specific document
for the text "elevatedTerm
{code:xml}
core1:
<elevate>
...
<query text="elevatedTerm"><doc id="core1docId1" /></query>
</elevate>
core2:
<elevate>
...
<query text="elevatedTerm"><doc id="core2docId1" /></query>
</elevate>
{code}
# Execute query (we use port 9983)
{noformat}
http://localhost:9983/solr/core1/select?q=elevatedTerm&lowercaseOperators=false&df=text_en&defType=edismax&fq=lang:en&shards=localhost:9983/solr/core1,localhost:9983/solr/core2&fl=[elevated],[shard],area,id&rows=10&start=0
{noformat}
As both shards have elevated documents for the requested "elevatedTerm" the
search results are as expected:
{noformat}
response: {
numFound: 5192,
start: 0,
maxScore: 1.9032197,
docs: [{
area: "press",
id: "core1docId1",
[elevated]: true,
[shard]: "localhost:9983/solr/core1"
}, {
area: "products",
id: "core2docId1",
[elevated]: true,
[shard]: "localhost:9983/solr/core2"
}, {
area: "press",
id: "core1docId2",
[elevated]: false,
[shard]: "localhost:9983/solr/core1"
},
...
{noformat}
# Remove the elevation entry for that "elevatedTerm" from one of the cores,
e.g. via comment
{code:xml}
core2:
<elevate>
...
<!--
<query text="elevatedTerm"><doc id="core2docId1" /></query>
-->
</elevate>
{code}
# Reload the modified core:
[http://localhost:9983/solr/admin/cores?action=RELOAD&core=core2]
# Request same query again and you get the NPE:
{noformat}
error: {
trace: "java.lang.NullPointerException
at
org.apache.solr.handler.component.QueryComponent.unmarshalSortValues(QueryComponent.java:1068)
at
org.apache.solr.handler.component.QueryComponent.mergeIds(QueryComponent.java:917)
at
org.apache.solr.handler.component.QueryComponent.handleRegularResponses(QueryComponent.java:613)
at
org.apache.solr.handler.component.QueryComponent.handleResponses(QueryComponent.java:592)
at
org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:431)
at
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:199)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:2578)
at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:780)
at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:566)
at
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:423)
at
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:350)
at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1602)
at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)
...
{noformat}
When adding the {{sort}} parameter with {{forceElevation=true}} to the query
then a ClassCastException is thrown
{noformat}
http://localhost:9983/solr/core1/select?q=elevatedTerm&lowercaseOperators=false&df=text_en&defType=edismax&fq=lang:en&shards=localhost:9983/solr/core1,localhost:9983/solr/core2&fl=[elevated],[shard],area,id&rows=10&start=0&sort=area%20asc&forceElevation=true{noformat}
{noformat}
java.lang.ClassCastException: java.lang.Integer cannot be cast to
java.lang.String
at
org.apache.solr.schema.FieldType.unmarshalStringSortValue(FieldType.java:1229)
at org.apache.solr.schema.StrField.unmarshalSortValue(StrField.java:122)
at
org.apache.solr.handler.component.QueryComponent.unmarshalSortValues(QueryComponent.java:1092)
at
org.apache.solr.handler.component.QueryComponent.mergeIds(QueryComponent.java:917)
at
org.apache.solr.handler.component.QueryComponent.handleRegularResponses(QueryComponent.java:613)
at
org.apache.solr.handler.component.QueryComponent.handleResponses(QueryComponent.java:592)
at
org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:431)
at
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:199)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:2578)
at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:780)
...
{noformat}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]