Search in sources :

Example 1 with PerFieldPostingsFormat

use of org.apache.lucene.codecs.perfield.PerFieldPostingsFormat in project lucene-solr by apache.

the class TestCodecSupport method testPostingsFormats.

public void testPostingsFormats() {
    Codec codec = h.getCore().getCodec();
    Map<String, SchemaField> fields = h.getCore().getLatestSchema().getFields();
    SchemaField schemaField = fields.get("string_direct_f");
    PerFieldPostingsFormat format = (PerFieldPostingsFormat) codec.postingsFormat();
    assertEquals("Direct", format.getPostingsFormatForField(schemaField.getName()).getName());
    schemaField = fields.get("string_standard_f");
    assertEquals(TestUtil.getDefaultPostingsFormat().getName(), format.getPostingsFormatForField(schemaField.getName()).getName());
    schemaField = fields.get("string_f");
    assertEquals(TestUtil.getDefaultPostingsFormat().getName(), format.getPostingsFormatForField(schemaField.getName()).getName());
}
Also used : SchemaField(org.apache.solr.schema.SchemaField) Codec(org.apache.lucene.codecs.Codec) PerFieldPostingsFormat(org.apache.lucene.codecs.perfield.PerFieldPostingsFormat)

Example 2 with PerFieldPostingsFormat

use of org.apache.lucene.codecs.perfield.PerFieldPostingsFormat in project lucene-solr by apache.

the class TestCodecSupport method testDynamicFieldsPostingsFormats.

public void testDynamicFieldsPostingsFormats() {
    Codec codec = h.getCore().getCodec();
    PerFieldPostingsFormat format = (PerFieldPostingsFormat) codec.postingsFormat();
    assertEquals("Direct", format.getPostingsFormatForField("foo_direct").getName());
    assertEquals("Direct", format.getPostingsFormatForField("bar_direct").getName());
    assertEquals(TestUtil.getDefaultPostingsFormat().getName(), format.getPostingsFormatForField("foo_standard").getName());
    assertEquals(TestUtil.getDefaultPostingsFormat().getName(), format.getPostingsFormatForField("bar_standard").getName());
}
Also used : Codec(org.apache.lucene.codecs.Codec) PerFieldPostingsFormat(org.apache.lucene.codecs.perfield.PerFieldPostingsFormat)

Aggregations

Codec (org.apache.lucene.codecs.Codec)2 PerFieldPostingsFormat (org.apache.lucene.codecs.perfield.PerFieldPostingsFormat)2 SchemaField (org.apache.solr.schema.SchemaField)1