/// <summary> /// Search for known number of duplicates duplicates /// </summary> /// <param name="query"> query to find duplicates in </param> /// <param name="accessor"> accessor to load actual property value from store </param> /// <param name="propertyKeyIds"> property key ids </param> /// <param name="expectedNumberOfEntries"> expected number of duplicates in query </param> /// <exception cref="IOException"> </exception> /// <exception cref="IndexEntryConflictException"> </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void searchForDuplicates(org.apache.lucene.search.Query query, org.neo4j.storageengine.api.NodePropertyAccessor accessor, int[] propertyKeyIds, int expectedNumberOfEntries) throws java.io.IOException, org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException private void SearchForDuplicates(Query query, NodePropertyAccessor accessor, int[] propertyKeyIds, int expectedNumberOfEntries) { DuplicateCheckingCollector collector = GetDuplicateCollector(accessor, propertyKeyIds); collector.Init(expectedNumberOfEntries); SearchForDuplicates(query, collector); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void verify(org.neo4j.storageengine.api.NodePropertyAccessor accessor, int[] propKeyIds, java.util.List<org.neo4j.values.storable.Value[]> updatedValueTuples) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException, java.io.IOException public override void Verify(NodePropertyAccessor accessor, int[] propKeyIds, IList <Value[]> updatedValueTuples) { try { DuplicateCheckingCollector collector = DuplicateCheckingCollector.ForProperties(accessor, propKeyIds); foreach (Value[] valueTuple in updatedValueTuples) { collector.Init(); Query query = LuceneDocumentStructure.newSeekQuery(valueTuple); IndexSearcher().search(query, collector); } } catch (IOException e) { Exception cause = e.InnerException; if (cause is IndexEntryConflictException) { throw ( IndexEntryConflictException )cause; } throw e; } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void searchForDuplicates(org.apache.lucene.search.Query query, DuplicateCheckingCollector collector) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException, java.io.IOException private void SearchForDuplicates(Query query, DuplicateCheckingCollector collector) { try { foreach (PartitionSearcher searcher in _searchers) { /* * Here {@link DuplicateCheckingCollector#init()} is deliberately not called to preserve accumulated * state (knowledge about duplicates) across all {@link IndexSearcher#search(Query, Collector)} calls. */ searcher.IndexSearcher.search(query, collector); } } catch (IOException e) { Exception cause = e.InnerException; if (cause is IndexEntryConflictException) { throw ( IndexEntryConflictException )cause; } throw e; } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void verify(org.neo4j.storageengine.api.NodePropertyAccessor accessor, int[] propKeyIds) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException, java.io.IOException public override void Verify(NodePropertyAccessor accessor, int[] propKeyIds) { try { DuplicateCheckingCollector collector = DuplicateCheckingCollector.ForProperties(accessor, propKeyIds); IndexSearcher searcher = IndexSearcher(); foreach (LeafReaderContext leafReaderContext in searcher.IndexReader.leaves()) { Fields fields = leafReaderContext.reader().fields(); foreach (string field in fields) { if (LuceneDocumentStructure.useFieldForUniquenessVerification(field)) { TermsEnum terms = LuceneDocumentStructure.originalTerms(fields.terms(field), field); BytesRef termsRef; while ((termsRef = terms.next()) != null) { if (terms.docFreq() > 1) { collector.Init(terms.docFreq()); searcher.search(new TermQuery(new Term(field, termsRef)), collector); } } } } } } catch (IOException e) { Exception cause = e.InnerException; if (cause is IndexEntryConflictException) { throw ( IndexEntryConflictException )cause; } throw e; } }
private DuplicateCheckingCollector GetDuplicateCollector(NodePropertyAccessor accessor, int[] propertyKeyIds) { return(DuplicateCheckingCollector.ForProperties(accessor, propertyKeyIds)); }