org.apache.solr.handler.component.FacetComponent Java Examples

The following examples show how to use org.apache.solr.handler.component.FacetComponent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestComponentsName.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
@Test
public void testComponentsName() {
  assertU(adoc("id", "0", "name", "Zapp Brannigan"));
  assertU(adoc("id", "1", "name", "The Zapper"));
  assertU((commit()));
  
  assertQ("match all docs query",
      req("q","*:*")
      ,"//result[@numFound='2']",
      "/response/str[@name='component1'][.='foo']", 
      "/response/str[@name='component2'][.='bar']");
  
  assertQ("use debugQuery",
      req("q","*:*",
          "debugQuery", "true")
      ,"//result[@numFound='2']",
      "/response/str[@name='component1'][.='foo']", 
      "/response/str[@name='component2'][.='bar']",
      "/response/lst[@name='debug']/lst[@name='timing']/lst[@name='prepare']/lst[@name='component1']",
      "/response/lst[@name='debug']/lst[@name='timing']/lst[@name='prepare']/lst[@name='" + QueryComponent.COMPONENT_NAME + "']",
      "/response/lst[@name='debug']/lst[@name='timing']/lst[@name='prepare']/lst[@name='" + FacetComponent.COMPONENT_NAME + "']",
      "/response/lst[@name='debug']/lst[@name='timing']/lst[@name='prepare']/lst[@name='" + MoreLikeThisComponent.COMPONENT_NAME + "']",
      "/response/lst[@name='debug']/lst[@name='timing']/lst[@name='prepare']/lst[@name='" + StatsComponent.COMPONENT_NAME + "']",
      "/response/lst[@name='debug']/lst[@name='timing']/lst[@name='prepare']/lst[@name='" + DebugComponent.COMPONENT_NAME + "']",
      "/response/lst[@name='debug']/lst[@name='timing']/lst[@name='prepare']/lst[@name='component2']");
}
 
Example #2
Source File: AbstractReSearcherComponent.java    From solr-researcher with Apache License 2.0 6 votes vote down vote up
@Override
@SuppressWarnings("rawtypes")
public void init(NamedList args) {
  maxOriginalResults = getInt(args, "maxOriginalResults");
  String tmp = (String) args.get("allComponentNames");
  if (tmp != null) {
    componentNames.addAll(Arrays.asList(tmp.split("\\s*,\\s*")));
  }
  componentNames.add(getComponentName());
  componentNames.add(FacetComponent.COMPONENT_NAME);
  componentNames.add(HighlightComponent.COMPONENT_NAME);
  componentNames.add(StatsComponent.COMPONENT_NAME);
  componentNames.add(TermsComponent.COMPONENT_NAME);
  componentNames.add(TermVectorComponent.COMPONENT_NAME);
  componentNames.add(SpellCheckComponent.COMPONENT_NAME);
  componentNames.add(MoreLikeThisComponent.COMPONENT_NAME);
  componentNames.add(GroupParams.GROUP);
  componentNames.add("queryRelaxer");
  componentNames.add("DymReSearcher");
  componentNames.add("autoComplete");
  commonMisspellingsFileLocation = (String) args.get("commonMisspellingsFile");
  commonMisspellingsMap = CommonMisspellings.loadCommonMisspellingsFile(commonMisspellingsFileLocation);
}
 
Example #3
Source File: TestQueryRelaxerComponent.java    From solr-researcher with Apache License 2.0 5 votes vote down vote up
@Test
public void testFacet() {
  assertQ(req(CommonParams.QT, "dismax_relaxer", CommonParams.Q, "bi marley ",
      QueryRelaxerComponent.COMPONENT_NAME, "true", FacetComponent.COMPONENT_NAME, "true", FacetParams.FACET_FIELD, "id")
            ,"//result[@name='response'][@numFound='0']"
            ,"//arr[@name='relaxer_suggestions']/lst[1]/str[@name='relaxedQuery'][.='marley']"
            ,"//arr[@name='relaxer_suggestions']/lst[1]/lst[@name='relaxer_facet_counts']/lst[@name='facet_fields']/lst[@name='id']"
          );
}