org.apache.lucene.codecs.lucene50.Lucene50StoredFieldsFormat.Mode Java Examples

The following examples show how to use org.apache.lucene.codecs.lucene50.Lucene50StoredFieldsFormat.Mode. 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: CodecService.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
private CodecService(Index index, Settings indexSettings, MapperService mapperService) {
    super(index, indexSettings);
    this.mapperService = mapperService;
    MapBuilder<String, Codec> codecs = MapBuilder.<String, Codec>newMapBuilder();
    if (mapperService == null) {
        codecs.put(DEFAULT_CODEC, new Lucene54Codec());
        codecs.put(BEST_COMPRESSION_CODEC, new Lucene54Codec(Mode.BEST_COMPRESSION));
    } else {
        codecs.put(DEFAULT_CODEC, 
                new PerFieldMappingPostingFormatCodec(Mode.BEST_SPEED, mapperService, logger));
        codecs.put(BEST_COMPRESSION_CODEC, 
                new PerFieldMappingPostingFormatCodec(Mode.BEST_COMPRESSION, mapperService, logger));
    }
    codecs.put(LUCENE_DEFAULT_CODEC, Codec.getDefault());
    for (String codec : Codec.availableCodecs()) {
        codecs.put(codec, Codec.forName(codec));
    }
    this.codecs = codecs.immutableMap();
}
 
Example #2
Source File: CodecService.java    From crate with Apache License 2.0 6 votes vote down vote up
public CodecService(@Nullable MapperService mapperService, Logger logger) {
    final MapBuilder<String, Codec> codecs = MapBuilder.<String, Codec>newMapBuilder();
    if (mapperService == null) {
        codecs.put(DEFAULT_CODEC, new Lucene84Codec());
        codecs.put(BEST_COMPRESSION_CODEC, new Lucene84Codec(Mode.BEST_COMPRESSION));
    } else {
        codecs.put(DEFAULT_CODEC,
            new PerFieldMappingPostingFormatCodec(Mode.BEST_SPEED, mapperService, logger));
        codecs.put(BEST_COMPRESSION_CODEC,
            new PerFieldMappingPostingFormatCodec(Mode.BEST_COMPRESSION, mapperService, logger));
    }
    codecs.put(LUCENE_DEFAULT_CODEC, Codec.getDefault());
    for (String codec : Codec.availableCodecs()) {
        codecs.put(codec, Codec.forName(codec));
    }
    this.codecs = codecs.immutableMap();
}
 
Example #3
Source File: TestCodecSupport.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
public void testCompressionModeDefault() throws IOException {
  assertEquals("Default Solr compression mode changed. Is this expected?", 
      SchemaCodecFactory.SOLR_DEFAULT_COMPRESSION_MODE, Mode.valueOf("BEST_SPEED"));

  String previousCoreName = h.coreName;
  String newCoreName = "core_with_default_compression";
  SolrCore c = null;
  
  SolrConfig config = TestHarness.createConfig(testSolrHome, previousCoreName, "solrconfig_codec2.xml");
  assertEquals("Unexpected codec factory for this test.", "solr.SchemaCodecFactory", config.get("codecFactory/@class"));
  assertNull("Unexpected configuration of codec factory for this test. Expecting empty element", 
      config.getNode("codecFactory", false).getFirstChild());
  IndexSchema schema = IndexSchemaFactory.buildIndexSchema("schema_codec.xml", config);

  CoreContainer coreContainer = h.getCoreContainer();
  
  try {
    CoreDescriptor cd = new CoreDescriptor(newCoreName, testSolrHome.resolve(newCoreName), coreContainer);
    c = new SolrCore(coreContainer, cd,
        new ConfigSet("fakeConfigset", config, schema, null, true));
    assertNull(coreContainer.registerCore(cd, c, false, false));
    h.coreName = newCoreName;
    assertEquals("We are not using the correct core", "solrconfig_codec2.xml", h.getCore().getConfigResource());
    assertU(add(doc("string_f", "foo")));
    assertU(commit());
    assertCompressionMode(SchemaCodecFactory.SOLR_DEFAULT_COMPRESSION_MODE.name(), h.getCore());
  } finally {
    h.coreName = previousCoreName;
    coreContainer.unload(newCoreName);
  }
  
}
 
Example #4
Source File: TestLucene50StoredFieldsFormatHighCompression.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
protected Codec getCodec() {
  return new Lucene86Codec(Mode.BEST_COMPRESSION);
}
 
Example #5
Source File: Lucene84Codec.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
/**
 * Instantiates a new codec.
 */
public Lucene84Codec() {
  this(Mode.BEST_SPEED);
}
 
Example #6
Source File: Lucene84Codec.java    From lucene-solr with Apache License 2.0 2 votes vote down vote up
/**
 * Instantiates a new codec, specifying the stored fields compression
 * mode to use.
 * @param mode stored fields compression mode to use for newly
 *             flushed/merged segments.
 */
public Lucene84Codec(Mode mode) {
  super("Lucene84");
  this.storedFieldsFormat = new Lucene50StoredFieldsFormat(Objects.requireNonNull(mode));
  this.defaultFormat = new Lucene84PostingsFormat();
}