Skip to content

Commit

Permalink
SOLR-16648: NullPointerException when excluding facets in More Like T…
Browse files Browse the repository at this point in the history
…his Handler (apache#1339)
  • Loading branch information
mkhludnev authored Feb 8, 2023
1 parent cada03b commit 96f690c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions solr/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ Bug Fixes

* SOLR-16647: Fix circuit breaker examples in solrconfig.xml (Colvin Cowie via Kevin Risden)

* SOLR-16648: NullPointerException when excluding facets in More Like This Handler (Mikhail Khludnev)

Build
---------------------
* Upgrade forbiddenapis to 3.4 (Uwe Schindler)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throw
} else {
final ResponseBuilder responseBuilder =
new ResponseBuilder(req, rsp, Collections.emptyList());
responseBuilder.setQuery(mlt.getRealMLTQuery());
SimpleFacets f = new SimpleFacets(req, mltDocs.docSet, params, responseBuilder);
FacetComponent.FacetContext.initContext(responseBuilder);
rsp.add("facet_counts", FacetComponent.getFacetCounts(f));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,14 @@ public void testInterface() {
"//result/doc[1]/str[@name='id'][.='45']",
"//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='name']/int[@name='George'][.='1']");
}
params.set("facet.field", "{!ex=tg}name");
params.set("fq", "{!tag=tg}name:George");
try (SolrQueryRequest mltreq = new LocalSolrQueryRequest(core, params)) {
assertQ(
mltreq,
"//result/doc[1]/str[@name='id'][.='45']",
"//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='name']/int[@name='George'][.='1']");
}
}

@Test
Expand Down

0 comments on commit 96f690c

Please sign in to comment.