Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOLR-17477: adding changes and one more demo test #1

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions solr/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ Improvements
* SOLR-17397: SkipExistingDocumentsProcessor now functions correctly with child documents. (Tim Owens via Eric Pugh)
* SOLR-17180: Deprecate snapshotscli.sh in favour of bin/solr snapshot sub commands. Now able to manage Snapshots from the CLI. HDFS module specific snapshot script now ships as part of that module in the modules/hdfs/bin directory. (Eric Pugh)

* SOLR-17477: Let to extend FacetModule aka JSON DSL Facet (Tim Owen, Christine Poerschke via Mikhail Khludnev)

Optimizations
---------------------
* SOLR-14985: Solrj CloudSolrClient with Solr URLs had serious performance regressions (since the
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package org.apache.solr.search.function;

import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.handler.component.ResponseBuilder;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.response.SolrQueryResponse;
import org.apache.solr.search.SyntaxError;
import org.apache.solr.search.facet.FacetField;
import org.apache.solr.search.facet.FacetParser;
import org.apache.solr.search.facet.FacetRequest;
import org.junit.BeforeClass;

import java.util.Collections;
import java.util.Map;


public class CustomParseHandlerTest extends SolrTestCaseJ4 {

public static final FacetField FACET_FIELD_STUB = new FacetField();

static class CustomParseHandler implements FacetParser.ParseHandler {
@Override
public Object doParse(FacetParser<?> parent, String key, Object args) {
assertEquals("arg", args);
return FACET_FIELD_STUB;
}
}

@BeforeClass
public static void beforeClass() throws Exception {
initCore("solrconfig.xml", "schema.xml");
}

@Override
public void setUp() throws Exception {
super.setUp();
FacetParser.registerParseHandler("custom", new CustomParseHandler());
}

public void testCustomParseHandler() {
SolrQueryRequest req = req();
ResponseBuilder rsp = new ResponseBuilder(req, new SolrQueryResponse(), Collections.emptyList());

FacetRequest facetRequest = FacetRequest.parse(rsp.req, Map.of("bogus",Map.of("custom","arg")));
assertEquals(FACET_FIELD_STUB, facetRequest.getSubFacets().get("bogus"));
}
}