Search in sources :

Example 11 with FieldDescriptor

use of com.rbmhtechnology.vind.model.FieldDescriptor in project vind by RBMHTechnology.

the class SolrUtilsTest method testFieldNameConfiguration.

@Test
public void testFieldNameConfiguration() {
    FieldDescriptor facet = new FieldDescriptorBuilder().buildMultivaluedNumericField("test1");
    assertEquals("dynamic_multi_float_test1", SolrUtils.Fieldname.getFieldname(facet, SolrUtils.Fieldname.UseCase.Stored, null));
    assertEquals(2, SolrUtils.Fieldname.getFieldnames(facet, null).size());
    assertThat(SolrUtils.Fieldname.getFieldnames(facet, null), containsInAnyOrder("dynamic_multi_float_test1", "dynamic_single_sort_float_test1"));
    FieldDescriptor stored2 = new FieldDescriptorBuilder().setFacet(true).buildMultivaluedNumericField("test3", Integer.class);
    assertEquals("dynamic_multi_facet_int_test3", SolrUtils.Fieldname.getFieldname(stored2, SolrUtils.Fieldname.UseCase.Facet, null));
    assertEquals(3, SolrUtils.Fieldname.getFieldnames(stored2, null).size());
    assertThat(SolrUtils.Fieldname.getFieldnames(stored2, null), containsInAnyOrder("dynamic_multi_int_test3", "dynamic_multi_facet_int_test3", "dynamic_single_sort_int_test3"));
    FieldDescriptor mixed = new FieldDescriptorBuilder().setFullText(true).setFacet(true).buildMultivaluedTextField("test4");
    assertEquals("dynamic_multi_facet_string_test4", SolrUtils.Fieldname.getFieldname(mixed, SolrUtils.Fieldname.UseCase.Facet, null));
    assertEquals("dynamic_multi_string_test4", SolrUtils.Fieldname.getFieldname(mixed, SolrUtils.Fieldname.UseCase.Stored, null));
    assertEquals("dynamic_multi_none_test4", SolrUtils.Fieldname.getFieldname(mixed, SolrUtils.Fieldname.UseCase.Fulltext, null));
    assertEquals(4, SolrUtils.Fieldname.getFieldnames(mixed, null).size());
    assertThat(SolrUtils.Fieldname.getFieldnames(mixed, null), containsInAnyOrder("dynamic_single_sort_string_test4", "dynamic_multi_string_test4", "dynamic_multi_none_test4", "dynamic_multi_facet_string_test4"));
}
Also used : FieldDescriptorBuilder(com.rbmhtechnology.vind.model.FieldDescriptorBuilder) FieldDescriptor(com.rbmhtechnology.vind.model.FieldDescriptor) Test(org.junit.Test)

Aggregations

FieldDescriptor (com.rbmhtechnology.vind.model.FieldDescriptor)11 ExecutableSuggestionSearch (com.rbmhtechnology.vind.api.query.suggestion.ExecutableSuggestionSearch)4 DocumentFactory (com.rbmhtechnology.vind.model.DocumentFactory)4 IOException (java.io.IOException)4 SolrClient (org.apache.solr.client.solrj.SolrClient)4 SolrQuery (org.apache.solr.client.solrj.SolrQuery)4 Resources (com.google.common.io.Resources)3 SearchServerException (com.rbmhtechnology.vind.SearchServerException)3 AnnotationUtil (com.rbmhtechnology.vind.annotations.AnnotationUtil)3 Document (com.rbmhtechnology.vind.api.Document)3 SearchServer (com.rbmhtechnology.vind.api.SearchServer)3 ServiceProvider (com.rbmhtechnology.vind.api.ServiceProvider)3 com.rbmhtechnology.vind.api.query (com.rbmhtechnology.vind.api.query)3 Delete (com.rbmhtechnology.vind.api.query.delete.Delete)3 Page (com.rbmhtechnology.vind.api.query.division.Page)3 Slice (com.rbmhtechnology.vind.api.query.division.Slice)3 Facet (com.rbmhtechnology.vind.api.query.facet.Facet)3 Interval (com.rbmhtechnology.vind.api.query.facet.Interval)3 RealTimeGet (com.rbmhtechnology.vind.api.query.get.RealTimeGet)3 DescriptorSuggestionSearch (com.rbmhtechnology.vind.api.query.suggestion.DescriptorSuggestionSearch)3