//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void addDocumentToIndex(SchemaIndex index, int documents) throws java.io.IOException private void AddDocumentToIndex(SchemaIndex index, int documents) { for (int i = 0; i < documents; i++) { index.IndexWriter.addDocument(LuceneDocumentStructure.DocumentRepresentingProperties(( long )i, Values.intValue(i))); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldBuildRangeSeekByPrefixQueryForStrings() internal virtual void ShouldBuildRangeSeekByPrefixQueryForStrings() { // given MultiTermQuery prefixQuery = ( MultiTermQuery )LuceneDocumentStructure.NewRangeSeekByPrefixQuery("Prefix"); // then assertThat("Should contain term value", prefixQuery.ToString(), containsString("Prefix")); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldBuildWildcardQueries() internal virtual void ShouldBuildWildcardQueries() { // given WildcardQuery query = ( WildcardQuery )LuceneDocumentStructure.NewWildCardStringQuery("foo"); // then assertEquals("string", query.Field); }
protected internal override void Add(long nodeId, Value[] values) { try { outerInstance.Writer.addDocument(LuceneDocumentStructure.DocumentRepresentingProperties(nodeId, values)); } catch (IOException e) { throw new UncheckedIOException(e); } }
protected internal override void AddIdempotent(long nodeId, Value[] values) { try { outerInstance.Writer.updateDocument(LuceneDocumentStructure.NewTermForChangeOrRemove(nodeId), LuceneDocumentStructure.DocumentRepresentingProperties(nodeId, values)); } catch (IOException e) { throw new UncheckedIOException(e); } }
protected internal override void Remove(long nodeId) { try { outerInstance.Writer.deleteDocuments(LuceneDocumentStructure.NewTermForChangeOrRemove(nodeId)); } catch (IOException e) { throw new UncheckedIOException(e); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public static java.util.List<long> getAllNodes(org.apache.lucene.store.Directory directory, org.neo4j.values.storable.Value propertyValue) throws java.io.IOException public static IList <long> GetAllNodes(Directory directory, Value propertyValue) { using (SearcherManager manager = new SearcherManager(directory, new SearcherFactory())) { IndexSearcher searcher = manager.acquire(); Query query = LuceneDocumentStructure.NewSeekQuery(propertyValue); AllNodesCollector collector = new AllNodesCollector(); searcher.search(query, collector); return(collector._nodeIds); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldBuildRangeSeekByStringQueryForStrings() internal virtual void ShouldBuildRangeSeekByStringQueryForStrings() { // given TermRangeQuery query = ( TermRangeQuery )LuceneDocumentStructure.NewRangeSeekByStringQuery("foo", false, null, true); // then assertEquals("string", query.Field); assertEquals("foo", query.LowerTerm.utf8ToString()); assertFalse(query.includesLower()); assertNull(query.UpperTerm); assertTrue(query.includesUpper()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldBuildRangeSeekByNumberQueryForStrings() internal virtual void ShouldBuildRangeSeekByNumberQueryForStrings() { // given NumericRangeQuery <double> query = LuceneDocumentStructure.NewInclusiveNumericRangeSeekQuery(12.0d, null); // then assertEquals("number", query.Field); assertEquals(12.0, query.Min, 0.001); assertTrue(query.includesMin()); assertNull(query.Max); assertTrue(query.includesMax()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void updateMultiplePartitionedIndex() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void UpdateMultiplePartitionedIndex() { using (SchemaIndex index = LuceneSchemaIndexBuilder.Create(_descriptor, _config).withFileSystem(_fileSystem).withIndexRootFolder(_testDir.directory("partitionedIndexForUpdates")).build()) { index.create(); index.open(); AddDocumentToIndex(index, 45); index.IndexWriter.updateDocument(LuceneDocumentStructure.NewTermForChangeOrRemove(100), LuceneDocumentStructure.DocumentRepresentingProperties(( long )100, Values.intValue(100))); index.maybeRefreshBlocking(); long documentsInIndex = Iterators.count(index.allDocumentsReader().GetEnumerator()); assertEquals(46, documentsInIndex, "Index should contain 45 added and 1 updated document."); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void assertIndexedValues(Hit... expectedHits) throws java.io.IOException private void AssertIndexedValues(params Hit[] expectedHits) { SwitchToVerification(); foreach (Hit hit in expectedHits) { TopDocs hits = _searcher.search(LuceneDocumentStructure.NewSeekQuery(hit.Value), 10); assertEquals(hit.NodeIds.Length, hits.totalHits, "Unexpected number of index results from " + hit.Value); ISet <long> foundNodeIds = new HashSet <long>(); for (int i = 0; i < hits.totalHits; i++) { Document document = _searcher.doc(hits.scoreDocs[i].doc); foundNodeIds.Add(parseLong(document.get("id"))); } assertEquals(asSet(hit.NodeIds), foundNodeIds); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void collect(int doc) throws java.io.IOException public override void Collect(int doc) { _nodeIds.Add(LuceneDocumentStructure.GetNodeId(_reader.document(doc))); }