Search in sources :

Example 1 with BooleanValue

use of org.neo4j.values.storable.BooleanValue in project neo4j by neo4j.

the class FulltextConfigExtractor method indexConfigFromFulltextDirectory.

static IndexConfig indexConfigFromFulltextDirectory(FileSystemAbstraction fs, Path fulltextIndexDirectory) {
    Path settingsFile = fulltextIndexDirectory.resolve(INDEX_CONFIG_FILE);
    Properties settings = new Properties();
    if (fs.fileExists(settingsFile)) {
        try (Reader reader = fs.openAsReader(settingsFile, UTF_8)) {
            settings.load(reader);
        } catch (IOException e) {
            throw new UncheckedIOException("Failed to read persisted fulltext index properties: " + settingsFile, e);
        }
    }
    Map<String, Value> indexConfig = new HashMap<>();
    TextValue analyser = extractSetting(settings, INDEX_CONFIG_ANALYZER);
    BooleanValue eventuallyConsistent = extractBooleanSetting(settings, INDEX_CONFIG_EVENTUALLY_CONSISTENT);
    if (analyser != null) {
        indexConfig.put(FulltextIndexSettingsKeys.ANALYZER, analyser);
    }
    if (eventuallyConsistent != null) {
        indexConfig.put(FulltextIndexSettingsKeys.EVENTUALLY_CONSISTENT, eventuallyConsistent);
    }
    return IndexConfig.with(indexConfig);
}
Also used : Path(java.nio.file.Path) HashMap(java.util.HashMap) TextValue(org.neo4j.values.storable.TextValue) BooleanValue(org.neo4j.values.storable.BooleanValue) BooleanValue(org.neo4j.values.storable.BooleanValue) Value(org.neo4j.values.storable.Value) TextValue(org.neo4j.values.storable.TextValue) Reader(java.io.Reader) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) UncheckedIOException(java.io.UncheckedIOException) Properties(java.util.Properties)

Example 2 with BooleanValue

use of org.neo4j.values.storable.BooleanValue in project neo4j by neo4j.

the class IndexSettingUtilTest method assertBoolean.

private static void assertBoolean(IndexSetting setting, Object object, boolean expectedResult) {
    Value result = IndexSettingUtil.asIndexSettingValue(setting, object);
    assertTrue(result instanceof BooleanValue);
    assertEquals(expectedResult, ((BooleanValue) result).booleanValue());
}
Also used : BooleanValue(org.neo4j.values.storable.BooleanValue) StringValue(org.neo4j.values.storable.StringValue) BooleanValue(org.neo4j.values.storable.BooleanValue) Value(org.neo4j.values.storable.Value)

Aggregations

BooleanValue (org.neo4j.values.storable.BooleanValue)2 Value (org.neo4j.values.storable.Value)2 IOException (java.io.IOException)1 Reader (java.io.Reader)1 UncheckedIOException (java.io.UncheckedIOException)1 Path (java.nio.file.Path)1 HashMap (java.util.HashMap)1 Properties (java.util.Properties)1 StringValue (org.neo4j.values.storable.StringValue)1 TextValue (org.neo4j.values.storable.TextValue)1