Пример #1
0
        internal LuceneBatchInserterIndex(File dbStoreDir, IndexIdentifier identifier, IDictionary <string, string> config, RelationshipLookup relationshipLookup)
        {
            File storeDir = GetStoreDir(dbStoreDir);

            this._createdNow         = !LuceneDataSource.GetFileDirectory(storeDir, identifier).exists();
            this._identifier         = identifier;
            this._type               = IndexType.GetIndexType(config);
            this._relationshipLookup = relationshipLookup;
            this._writer             = InstantiateWriter(storeDir);
            this._searcherManager    = InstantiateSearcherManager(_writer);
        }
Пример #2
0
        public override IDictionary <string, string> FillInDefaults(IDictionary <string, string> source)
        {
            IDictionary <string, string> result = source != null ? new Dictionary <string, string>(source) : new Dictionary <string, string>();
            string analyzer = result[KEY_ANALYZER];

            if (string.ReferenceEquals(analyzer, null))
            {
                // Type is only considered if "analyzer" isn't supplied
                string type = result.computeIfAbsent(KEY_TYPE, k => "exact");
                if (type.Equals("fulltext") && !result.ContainsKey(LuceneIndexImplementation.KEY_TO_LOWER_CASE))
                {
                    result[KEY_TO_LOWER_CASE] = "true";
                }
            }

            // Try it on for size. Calling this will reveal configuration problems.
            IndexType.GetIndexType(result);

            return(result);
        }
Пример #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: IndexType getIndexType(IndexIdentifier identifier, boolean recovery) throws org.neo4j.internal.kernel.api.exceptions.explicitindex.ExplicitIndexNotFoundKernelException
        internal virtual IndexType GetIndexType(IndexIdentifier identifier, bool recovery)
        {
            Pair <int, IndexType>        type   = _cache[identifier];
            IDictionary <string, string> config = _indexStore.get(identifier.EntityType.entityClass(), identifier.IndexName);

            if (config == null)
            {
                if (recovery)
                {
                    return(null);
                }
                throw new ExplicitIndexNotFoundKernelException("Index '%s' doesn't exist.", identifier);
            }
            if (type != null && config.GetHashCode() == type.First())
            {
                return(type.Other());
            }
            type = Pair.of(config.GetHashCode(), IndexType.GetIndexType(config));
            _cache[identifier] = type;
            return(type.Other());
        }
Пример #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Parameterized.Parameters(name = "{0}") public static Iterable<Object> indexTypes()
        public static IEnumerable <object> IndexTypes()
        {
            IDictionary <string, string> customIndexTypeConfig = MapUtil.stringMap(LuceneIndexImplementation.KEY_TYPE, "exact", LuceneIndexImplementation.KEY_TO_LOWER_CASE, "true");

            return(Arrays.asList(new object[] { IndexType.EXACT, 2 }, new object[] { IndexType.GetIndexType(customIndexTypeConfig), 3 }));
        }
Пример #5
0
        public override ExplicitIndex RelationshipIndex(string indexName, IDictionary <string, string> configuration)
        {
            LuceneExplicitIndex index = _relationshipIndexes[indexName];

            if (index == null)
            {
                IndexIdentifier identifier = new IndexIdentifier(IndexEntityType.Relationship, indexName);
                index = new LuceneExplicitIndex.RelationshipExplicitIndex(_dataSource, identifier, _luceneTransaction, IndexType.GetIndexType(configuration), _commandFactory);
                _relationshipIndexes[indexName] = index;
            }
            return(index);
        }