Search in sources :

Example 31 with LuceneServerConfiguration

use of com.yelp.nrtsearch.server.config.LuceneServerConfiguration in project nrtsearch by Yelp.

the class GlobalStateTest method testCreateBackendGlobalState.

@Test
public void testCreateBackendGlobalState() throws IOException {
    String configFile = String.join("\n", "stateConfig:", "  backendType: LOCAL", "stateDir: " + folder.getRoot().getAbsolutePath());
    LuceneServerConfiguration configuration = getConfig(configFile);
    GlobalState globalState = GlobalState.createState(configuration);
    assertTrue(globalState instanceof BackendGlobalState);
}
Also used : LuceneServerConfiguration(com.yelp.nrtsearch.server.config.LuceneServerConfiguration) BackendGlobalState(com.yelp.nrtsearch.server.luceneserver.state.BackendGlobalState) LegacyGlobalState(com.yelp.nrtsearch.server.luceneserver.state.LegacyGlobalState) BackendGlobalState(com.yelp.nrtsearch.server.luceneserver.state.BackendGlobalState) Test(org.junit.Test)

Example 32 with LuceneServerConfiguration

use of com.yelp.nrtsearch.server.config.LuceneServerConfiguration in project nrtsearch by Yelp.

the class IndexStateTest method getInitStateVirtualSharding.

public GlobalState getInitStateVirtualSharding() throws IOException {
    LuceneServerConfiguration luceneServerConfiguration = LuceneServerTestConfigurationFactory.getConfig(Mode.STANDALONE, folder.getRoot(), "virtualSharding: true");
    FieldDefCreator.initialize(luceneServerConfiguration, Collections.emptyList());
    SimilarityCreator.initialize(luceneServerConfiguration, Collections.emptyList());
    return GlobalState.createState(luceneServerConfiguration);
}
Also used : LuceneServerConfiguration(com.yelp.nrtsearch.server.config.LuceneServerConfiguration)

Example 33 with LuceneServerConfiguration

use of com.yelp.nrtsearch.server.config.LuceneServerConfiguration in project nrtsearch by Yelp.

the class LuceneServerModule method providesLuceneServerConfiguration.

@Inject
@Singleton
@Provides
protected LuceneServerConfiguration providesLuceneServerConfiguration() throws FileNotFoundException {
    LuceneServerConfiguration luceneServerConfiguration;
    Optional<File> maybeConfigFile = args.maybeConfigFile();
    if (maybeConfigFile.isEmpty()) {
        luceneServerConfiguration = new LuceneServerConfiguration(getClass().getResourceAsStream(DEFAULT_CONFIG_FILE_RESOURCE));
    } else {
        luceneServerConfiguration = new LuceneServerConfiguration(new FileInputStream(maybeConfigFile.get()));
    }
    return luceneServerConfiguration;
}
Also used : LuceneServerConfiguration(com.yelp.nrtsearch.server.config.LuceneServerConfiguration) File(java.io.File) FileInputStream(java.io.FileInputStream) Inject(com.google.inject.Inject) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Example 34 with LuceneServerConfiguration

use of com.yelp.nrtsearch.server.config.LuceneServerConfiguration in project nrtsearch by Yelp.

the class ScoreScriptTest method setUpGrpcServer.

private GrpcServer setUpGrpcServer(CollectorRegistry collectorRegistry) throws IOException {
    String testIndex = "test_index";
    LuceneServerConfiguration luceneServerConfiguration = LuceneServerTestConfigurationFactory.getConfig(Mode.STANDALONE, folder.getRoot());
    GlobalState globalState = GlobalState.createState(luceneServerConfiguration);
    return new GrpcServer(collectorRegistry, grpcCleanup, luceneServerConfiguration, folder, false, globalState, luceneServerConfiguration.getIndexDir(), testIndex, globalState.getPort(), null, Collections.singletonList(new ScoreScriptTestPlugin()));
}
Also used : LuceneServerConfiguration(com.yelp.nrtsearch.server.config.LuceneServerConfiguration) GlobalState(com.yelp.nrtsearch.server.luceneserver.GlobalState) GrpcServer(com.yelp.nrtsearch.server.grpc.GrpcServer)

Aggregations

LuceneServerConfiguration (com.yelp.nrtsearch.server.config.LuceneServerConfiguration)34 GlobalState (com.yelp.nrtsearch.server.luceneserver.GlobalState)17 Test (org.junit.Test)10 ByteArrayInputStream (java.io.ByteArrayInputStream)6 AnonymousAWSCredentials (com.amazonaws.auth.AnonymousAWSCredentials)3 AmazonS3Client (com.amazonaws.services.s3.AmazonS3Client)3 ArchiverImpl (com.yelp.nrtsearch.server.backup.ArchiverImpl)3 TarImpl (com.yelp.nrtsearch.server.backup.TarImpl)3 GrpcServer (com.yelp.nrtsearch.server.grpc.GrpcServer)3 PersistentGlobalState (com.yelp.nrtsearch.server.luceneserver.state.PersistentGlobalState)3 File (java.io.File)3 Before (org.junit.Before)3 BackendGlobalState (com.yelp.nrtsearch.server.luceneserver.state.BackendGlobalState)2 LegacyGlobalState (com.yelp.nrtsearch.server.luceneserver.state.LegacyGlobalState)2 Path (java.nio.file.Path)2 ArrayList (java.util.ArrayList)2 Inject (com.google.inject.Inject)1 Provides (com.google.inject.Provides)1 Singleton (com.google.inject.Singleton)1 Archiver (com.yelp.nrtsearch.server.backup.Archiver)1