Example usage for org.apache.solr.handler.component ShardRequest PURPOSE_GET_FACETS

List of usage examples for org.apache.solr.handler.component ShardRequest PURPOSE_GET_FACETS

Introduction

In this page you can find the example usage for org.apache.solr.handler.component ShardRequest PURPOSE_GET_FACETS.

Prototype

int PURPOSE_GET_FACETS

To view the source code for org.apache.solr.handler.component ShardRequest PURPOSE_GET_FACETS.

Click Source Link

Usage

From source file:org.alfresco.solr.component.RewriteFacetParametersComponentTest.java

License:Open Source License

@Test
public void rewriteShardedRequestParameters_mincountSetZero_shouldKeepMincountToZero() {
    ModifiableSolrParams fixed = new ModifiableSolrParams();
    // The user has tried to set the mincount to zero.
    when(mockParams.getParameterNamesIterator()).thenReturn(asList("facet.mincount").iterator());
    when(mockParams.get("facet.mincount")).thenReturn("0");
    when(mockParams.get(ShardParams.SHARDS_PURPOSE))
            .thenReturn(String.valueOf(ShardRequest.PURPOSE_GET_FACETS));

    Map<String, String> fieldMappings = new HashMap<>();

    // Call the method under test.
    rewriteFacetParametersComponent.rewriteMincountFacetFieldOption(fixed, mockParams, "facet.mincount",
            fieldMappings, mockRequest);

    // Check that the mincount is set to 1 and the field name is converted to the format stored by Solr.
    String actualCount = fixed.get("facet.mincount");
    assertEquals("Expected no fixed value", null, actualCount);
}