Search in sources :

Example 26 with LuceneServerConfiguration

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

the class RemoteStateBackendTest method getMockGlobalState.

private GlobalState getMockGlobalState(boolean readOnly) throws IOException {
    GlobalState mockState = mock(GlobalState.class);
    LuceneServerConfiguration serverConfiguration = getConfig(readOnly);
    when(mockState.getConfiguration()).thenReturn(serverConfiguration);
    when(mockState.getStateDir()).thenReturn(Paths.get(serverConfiguration.getStateDir()));
    when(mockState.getIncArchiver()).thenReturn(Optional.of(archiver));
    return mockState;
}
Also used : LuceneServerConfiguration(com.yelp.nrtsearch.server.config.LuceneServerConfiguration) GlobalState(com.yelp.nrtsearch.server.luceneserver.GlobalState) PersistentGlobalState(com.yelp.nrtsearch.server.luceneserver.state.PersistentGlobalState)

Example 27 with LuceneServerConfiguration

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

the class IndexStateTest method getInitState.

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

Example 28 with LuceneServerConfiguration

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

the class LuceneServerIdFieldTest 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.emptyList());
}
Also used : LuceneServerConfiguration(com.yelp.nrtsearch.server.config.LuceneServerConfiguration) GlobalState(com.yelp.nrtsearch.server.luceneserver.GlobalState)

Example 29 with LuceneServerConfiguration

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

the class LuceneServerTest method testQueryCache.

@Test
public void testQueryCache() {
    QueryCache queryCache = IndexSearcher.getDefaultQueryCache();
    assertTrue(queryCache instanceof NrtQueryCache);
    String configStr = String.join("\n", "queryCache:", "  enabled: false");
    LuceneServerConfiguration configuration = new LuceneServerConfiguration(new ByteArrayInputStream(configStr.getBytes()));
    LuceneServerImpl.initQueryCache(configuration);
    assertNull(IndexSearcher.getDefaultQueryCache());
    configStr = String.join("\n", "queryCache:", "  enabled: true");
    configuration = new LuceneServerConfiguration(new ByteArrayInputStream(configStr.getBytes()));
    LuceneServerImpl.initQueryCache(configuration);
    queryCache = IndexSearcher.getDefaultQueryCache();
    assertTrue(queryCache instanceof NrtQueryCache);
}
Also used : QueryCache(org.apache.lucene.search.QueryCache) NrtQueryCache(com.yelp.nrtsearch.server.luceneserver.search.cache.NrtQueryCache) LuceneServerConfiguration(com.yelp.nrtsearch.server.config.LuceneServerConfiguration) ByteArrayInputStream(java.io.ByteArrayInputStream) NrtQueryCache(com.yelp.nrtsearch.server.luceneserver.search.cache.NrtQueryCache) Test(org.junit.Test)

Example 30 with LuceneServerConfiguration

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

the class ReplicationTestFailureScenarios method startSecondaryServer.

public void startSecondaryServer() throws IOException {
    LuceneServerConfiguration luceneSecondaryConfiguration = LuceneServerTestConfigurationFactory.getConfig(Mode.REPLICA, folder.getRoot());
    GlobalState globalStateSecondary = GlobalState.createState(luceneSecondaryConfiguration);
    luceneServerSecondary = new GrpcServer(grpcCleanup, luceneSecondaryConfiguration, folder, false, globalStateSecondary, luceneSecondaryConfiguration.getIndexDir(), TEST_INDEX, globalStateSecondary.getPort(), archiver);
    replicationServerSecondary = new GrpcServer(grpcCleanup, luceneSecondaryConfiguration, folder, true, globalStateSecondary, luceneSecondaryConfiguration.getIndexDir(), TEST_INDEX, globalStateSecondary.getReplicationPort(), archiver);
}
Also used : LuceneServerConfiguration(com.yelp.nrtsearch.server.config.LuceneServerConfiguration) GlobalState(com.yelp.nrtsearch.server.luceneserver.GlobalState)

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