//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: protected org.neo4j.kernel.api.ExplicitIndexHits query(org.apache.lucene.search.Query query, String keyForDirectLookup, Object valueForDirectLookup, org.neo4j.index.lucene.QueryContext additionalParametersOrNull) throws org.neo4j.internal.kernel.api.exceptions.explicitindex.ExplicitIndexNotFoundKernelException protected internal virtual ExplicitIndexHits Query(Query query, string keyForDirectLookup, object valueForDirectLookup, QueryContext additionalParametersOrNull) { IList <EntityId> simpleTransactionStateIds = new List <EntityId>(); ICollection <EntityId> removedIdsFromTransactionState = Collections.emptySet(); IndexSearcher fulltextTransactionStateSearcher = null; if (Transaction != null) { if (!string.ReferenceEquals(keyForDirectLookup, null)) { ((IList <EntityId>)simpleTransactionStateIds).AddRange(Transaction.getAddedIds(this, keyForDirectLookup, valueForDirectLookup)); } else { fulltextTransactionStateSearcher = Transaction.getAdditionsAsSearcher(this, additionalParametersOrNull); } removedIdsFromTransactionState = !string.ReferenceEquals(keyForDirectLookup, null) ? Transaction.getRemovedIds(this, keyForDirectLookup, valueForDirectLookup) : Transaction.getRemovedIds(this, query); } ExplicitIndexHits idIterator = null; IndexReference searcher; DataSource.ReadLock; try { searcher = DataSource.getIndexSearcher(IdentifierConflict); } finally { DataSource.releaseReadLock(); } if (searcher != null) { try { // Gather all added ids from fulltextTransactionStateSearcher and simpleTransactionStateIds. //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.eclipse.collections.api.set.primitive.LongSet idsModifiedInTransactionState = gatherIdsModifiedInTransactionState(simpleTransactionStateIds, fulltextTransactionStateSearcher, query); LongSet idsModifiedInTransactionState = GatherIdsModifiedInTransactionState(simpleTransactionStateIds, fulltextTransactionStateSearcher, query); // Do the combined search from store and fulltext tx state DocToIdIterator hits = new DocToIdIterator(Search(searcher, fulltextTransactionStateSearcher, query, additionalParametersOrNull, removedIdsFromTransactionState), removedIdsFromTransactionState, searcher, idsModifiedInTransactionState); idIterator = simpleTransactionStateIds.Count == 0 ? hits : new CombinedIndexHits(Arrays.asList(hits, new ConstantScoreIterator(simpleTransactionStateIds, Float.NaN))); } catch (IOException e) { throw new Exception("Unable to query " + this + " with " + query, e); } } // We've only got transaction state idIterator = idIterator == null ? new ConstantScoreIterator(simpleTransactionStateIds, 0) : idIterator; return(idIterator); }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected: //ORIGINAL LINE: private org.neo4j.graphdb.index.IndexHits<long> query(org.apache.lucene.search.Query query, final String key, final Object value) private IndexHits <long> Query(Query query, string key, object value) { IndexSearcher searcher; try { searcher = _searcherManager.acquire(); } catch (IOException e) { throw new Exception(e); } try { DocValuesCollector collector = new DocValuesCollector(true); searcher.search(query, collector); IndexHits <Document> result = collector.GetIndexHits(Sort.RELEVANCE); ExplicitIndexHits primitiveHits = null; if (string.ReferenceEquals(key, null) || this._cache == null || !this._cache.ContainsKey(key)) { primitiveHits = new DocToIdIterator(result, Collections.emptyList(), null, LongSets.immutable.empty()); } else { primitiveHits = new DocToIdIteratorAnonymousInnerClass(this, result, Collections.emptyList(), LongSets.immutable.empty(), key, value); } return(WrapIndexHits(primitiveHits)); } catch (IOException e) { throw new Exception(e); } finally { try { _searcherManager.release(searcher); } catch (IOException) { } } }