Search in sources :

Example 6 with TrieIntField

use of org.apache.solr.schema.TrieIntField in project lucene-solr by apache.

the class TestFacetMethods method testNumericSingleValuedNoDV.

@Test
public void testNumericSingleValuedNoDV() {
    SchemaField field = new SchemaField("field", new TrieIntField(), 0, null);
    // only works with FCS for mincount = 0, UIF for count > 0 is fine
    assertEquals(SimpleFacets.FacetMethod.FCS, SimpleFacets.selectFacetMethod(field, null, 0));
    assertEquals(SimpleFacets.FacetMethod.FCS, SimpleFacets.selectFacetMethod(field, SimpleFacets.FacetMethod.ENUM, 0));
    assertEquals(SimpleFacets.FacetMethod.FCS, SimpleFacets.selectFacetMethod(field, SimpleFacets.FacetMethod.FC, 0));
    assertEquals(SimpleFacets.FacetMethod.FCS, SimpleFacets.selectFacetMethod(field, SimpleFacets.FacetMethod.UIF, 0));
    assertEquals(SimpleFacets.FacetMethod.FCS, SimpleFacets.selectFacetMethod(field, SimpleFacets.FacetMethod.FCS, 0));
    assertEquals(SimpleFacets.FacetMethod.FCS, SimpleFacets.selectFacetMethod(field, null, 1));
    assertEquals(SimpleFacets.FacetMethod.FCS, SimpleFacets.selectFacetMethod(field, SimpleFacets.FacetMethod.ENUM, 1));
    assertEquals(SimpleFacets.FacetMethod.FCS, SimpleFacets.selectFacetMethod(field, SimpleFacets.FacetMethod.FC, 1));
    assertEquals(SimpleFacets.FacetMethod.UIF, SimpleFacets.selectFacetMethod(field, SimpleFacets.FacetMethod.UIF, 1));
    assertEquals(SimpleFacets.FacetMethod.FCS, SimpleFacets.selectFacetMethod(field, SimpleFacets.FacetMethod.FCS, 1));
}
Also used : SchemaField(org.apache.solr.schema.SchemaField) TrieIntField(org.apache.solr.schema.TrieIntField) Test(org.junit.Test)

Example 7 with TrieIntField

use of org.apache.solr.schema.TrieIntField in project lucene-solr by apache.

the class TestFacetMethods method testNumericMultiValuedDV.

@Test
public void testNumericMultiValuedDV() {
    SchemaField field = new SchemaField("field", new TrieIntField(), DOC_VALUES ^ MULTIVALUED, null);
    // default is FC, can't use ENUM due to trie-field terms, can't use FCS because of multivalues
    // default value is FC
    assertEquals(SimpleFacets.FacetMethod.FC, SimpleFacets.selectFacetMethod(field, null, 0));
    assertEquals(SimpleFacets.FacetMethod.FC, SimpleFacets.selectFacetMethod(field, SimpleFacets.FacetMethod.ENUM, 0));
    assertEquals(SimpleFacets.FacetMethod.FC, SimpleFacets.selectFacetMethod(field, SimpleFacets.FacetMethod.FCS, 0));
    assertEquals(SimpleFacets.FacetMethod.UIF, SimpleFacets.selectFacetMethod(field, SimpleFacets.FacetMethod.UIF, 0));
    assertEquals(SimpleFacets.FacetMethod.FC, SimpleFacets.selectFacetMethod(field, SimpleFacets.FacetMethod.FC, 0));
    assertEquals(SimpleFacets.FacetMethod.FC, SimpleFacets.selectFacetMethod(field, null, 1));
    assertEquals(SimpleFacets.FacetMethod.FC, SimpleFacets.selectFacetMethod(field, SimpleFacets.FacetMethod.ENUM, 1));
    assertEquals(SimpleFacets.FacetMethod.FC, SimpleFacets.selectFacetMethod(field, SimpleFacets.FacetMethod.FCS, 1));
    assertEquals(SimpleFacets.FacetMethod.UIF, SimpleFacets.selectFacetMethod(field, SimpleFacets.FacetMethod.UIF, 1));
    assertEquals(SimpleFacets.FacetMethod.FC, SimpleFacets.selectFacetMethod(field, SimpleFacets.FacetMethod.FC, 1));
}
Also used : SchemaField(org.apache.solr.schema.SchemaField) TrieIntField(org.apache.solr.schema.TrieIntField) Test(org.junit.Test)

Example 8 with TrieIntField

use of org.apache.solr.schema.TrieIntField in project lucene-solr by apache.

the class TestFacetMethods method testNumericMultiValuedNoDV.

@Test
public void testNumericMultiValuedNoDV() {
    SchemaField field = new SchemaField("field", new TrieIntField(), MULTIVALUED, null);
    // only works with FC for mincount = 0, UIF for count > 1 is fine
    assertEquals(SimpleFacets.FacetMethod.FC, SimpleFacets.selectFacetMethod(field, null, 0));
    assertEquals(SimpleFacets.FacetMethod.FC, SimpleFacets.selectFacetMethod(field, SimpleFacets.FacetMethod.ENUM, 0));
    assertEquals(SimpleFacets.FacetMethod.FC, SimpleFacets.selectFacetMethod(field, SimpleFacets.FacetMethod.FCS, 0));
    assertEquals(SimpleFacets.FacetMethod.FC, SimpleFacets.selectFacetMethod(field, SimpleFacets.FacetMethod.UIF, 0));
    assertEquals(SimpleFacets.FacetMethod.FC, SimpleFacets.selectFacetMethod(field, SimpleFacets.FacetMethod.FC, 0));
    assertEquals(SimpleFacets.FacetMethod.FC, SimpleFacets.selectFacetMethod(field, null, 1));
    assertEquals(SimpleFacets.FacetMethod.FC, SimpleFacets.selectFacetMethod(field, SimpleFacets.FacetMethod.ENUM, 1));
    assertEquals(SimpleFacets.FacetMethod.FC, SimpleFacets.selectFacetMethod(field, SimpleFacets.FacetMethod.FCS, 1));
    assertEquals(SimpleFacets.FacetMethod.UIF, SimpleFacets.selectFacetMethod(field, SimpleFacets.FacetMethod.UIF, 1));
    assertEquals(SimpleFacets.FacetMethod.FC, SimpleFacets.selectFacetMethod(field, SimpleFacets.FacetMethod.FC, 1));
}
Also used : SchemaField(org.apache.solr.schema.SchemaField) TrieIntField(org.apache.solr.schema.TrieIntField) Test(org.junit.Test)

Aggregations

SchemaField (org.apache.solr.schema.SchemaField)8 TrieIntField (org.apache.solr.schema.TrieIntField)8 TrieDateField (org.apache.solr.schema.TrieDateField)4 TrieDoubleField (org.apache.solr.schema.TrieDoubleField)4 TrieFloatField (org.apache.solr.schema.TrieFloatField)4 Test (org.junit.Test)4 BoolField (org.apache.solr.schema.BoolField)3 FieldType (org.apache.solr.schema.FieldType)3 StrField (org.apache.solr.schema.StrField)3 TrieLongField (org.apache.solr.schema.TrieLongField)3 IOException (java.io.IOException)2 LeafReader (org.apache.lucene.index.LeafReader)2 SortedDocValues (org.apache.lucene.index.SortedDocValues)2 SolrException (org.apache.solr.common.SolrException)2 IndexSchema (org.apache.solr.schema.IndexSchema)2 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 LinkedList (java.util.LinkedList)1 BinaryDocValues (org.apache.lucene.index.BinaryDocValues)1 DocValuesType (org.apache.lucene.index.DocValuesType)1