use of com.yelp.nrtsearch.server.config.LuceneServerConfiguration in project nrtsearch by Yelp.
the class GlobalStateTest method testCreateLegacyGlobalState.
@Test
public void testCreateLegacyGlobalState() throws IOException {
String configFile = String.join("\n", "stateConfig:", " backendType: LEGACY");
LuceneServerConfiguration configuration = getConfig(configFile);
GlobalState globalState = GlobalState.createState(configuration);
assertTrue(globalState instanceof LegacyGlobalState);
}
use of com.yelp.nrtsearch.server.config.LuceneServerConfiguration in project nrtsearch by Yelp.
the class BackendGlobalStateTest method setup.
@BeforeClass
public static void setup() {
String configFile = "nodeName: \"lucene_server_foo\"";
LuceneServerConfiguration dummyConfig = new LuceneServerConfiguration(new ByteArrayInputStream(configFile.getBytes()));
List<Plugin> dummyPlugins = Collections.emptyList();
// these must be initialized to create an IndexState
FieldDefCreator.initialize(dummyConfig, dummyPlugins);
SimilarityCreator.initialize(dummyConfig, dummyPlugins);
}
use of com.yelp.nrtsearch.server.config.LuceneServerConfiguration in project nrtsearch by Yelp.
the class BackendGlobalStateTest method testUseLocalBackend.
@Test
public void testUseLocalBackend() throws IOException {
String configFile = String.join("\n", "stateConfig:", " backendType: LOCAL", "stateDir: " + folder.newFolder("state").getAbsolutePath(), "indexDir: " + folder.newFolder("index").getAbsolutePath());
LuceneServerConfiguration config = new LuceneServerConfiguration(new ByteArrayInputStream(configFile.getBytes()));
BackendGlobalState backendGlobalState = new BackendGlobalState(config, null);
assertTrue(backendGlobalState.getStateBackend() instanceof LocalStateBackend);
}
use of com.yelp.nrtsearch.server.config.LuceneServerConfiguration in project nrtsearch by Yelp.
the class BackendGlobalStateTest method testInvalidBackend.
@Test
public void testInvalidBackend() throws IOException {
String configFile = String.join("\n", "stateConfig:", " backendType: LEGACY", "stateDir: " + folder.newFolder("state").getAbsolutePath(), "indexDir: " + folder.newFolder("index").getAbsolutePath());
LuceneServerConfiguration config = new LuceneServerConfiguration(new ByteArrayInputStream(configFile.getBytes()));
try {
new BackendGlobalState(config, null);
fail();
} catch (IllegalArgumentException e) {
assertEquals("Unsupported state backend type: LEGACY", e.getMessage());
}
}
use of com.yelp.nrtsearch.server.config.LuceneServerConfiguration in project nrtsearch by Yelp.
the class IndexState method initWarmer.
public void initWarmer(Archiver archiver) {
LuceneServerConfiguration configuration = globalState.getConfiguration();
WarmerConfig warmerConfig = configuration.getWarmerConfig();
if (warmerConfig.isWarmOnStartup() || warmerConfig.getMaxWarmingQueries() > 0) {
this.warmer = new Warmer(archiver, configuration.getServiceName(), name, warmerConfig.getMaxWarmingQueries());
}
}
Aggregations