//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldHandleRemoveNodeFromExplicitIndexTwice() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldHandleRemoveNodeFromExplicitIndexTwice() { // Given long nodeId = AddNodeToExplicitIndex(); // When using (Transaction tx = beginTransaction()) { ExplicitIndexWrite indexWrite = tx.IndexWrite(); indexWrite.NodeRemoveFromExplicitIndex(INDEX_NAME, nodeId); tx.Success(); } using (Transaction tx = beginTransaction()) { ExplicitIndexWrite indexWrite = tx.IndexWrite(); indexWrite.NodeRemoveFromExplicitIndex(INDEX_NAME, nodeId); tx.Success(); } // Then using (Org.Neo4j.Graphdb.Transaction ctx = graphDb.beginTx()) { IndexHits <Node> hits = graphDb.index().forNodes(INDEX_NAME).get(KEY, VALUE); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertFalse(hits.hasNext()); hits.Close(); ctx.Success(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldRemoveNonExistingRelationshipFromExplicitIndex() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldRemoveNonExistingRelationshipFromExplicitIndex() { // Given long relId = AddRelationshipToExplicitIndex(); // When using (Transaction tx = beginTransaction()) { ExplicitIndexWrite indexWrite = tx.IndexWrite(); indexWrite.RelationshipRemoveFromExplicitIndex(INDEX_NAME, relId + 1); tx.Success(); } // Then using (Org.Neo4j.Graphdb.Transaction ctx = graphDb.beginTx()) { IndexHits <Relationship> hits = graphDb.index().forRelationships(INDEX_NAME).get(KEY, VALUE); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertThat(hits.next().Id, equalTo(relId)); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertFalse(hits.hasNext()); hits.Close(); ctx.Success(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldReturnIndexHitsInGivenSortOrder() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal void ShouldReturnIndexHitsInGivenSortOrder() { // given DocValuesCollector collector = new DocValuesCollector(false); IndexReaderStub readerStub = IndexReaderWithMaxDocs(43); // when collector.DoSetNextReader(readerStub.Context); collector.Collect(1); collector.Collect(3); collector.Collect(37); collector.Collect(42); // then Sort byIdDescending = new Sort(new SortField("id", SortField.Type.LONG, true)); IndexHits <Document> indexHits = collector.GetIndexHits(byIdDescending); assertEquals(4, indexHits.Size()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertEquals("42", indexHits.next().get("id")); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertEquals("37", indexHits.next().get("id")); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertEquals("3", indexHits.next().get("id")); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertEquals("1", indexHits.next().get("id")); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertFalse(indexHits.hasNext()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldReturnIndexHitsOrderedByRelevance() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal void ShouldReturnIndexHitsOrderedByRelevance() { // given DocValuesCollector collector = new DocValuesCollector(true); IndexReaderStub readerStub = IndexReaderWithMaxDocs(42); // when collector.DoSetNextReader(readerStub.Context); collector.Scorer = ConstantScorer(1.0f); collector.Collect(1); collector.Scorer = ConstantScorer(2.0f); collector.Collect(2); // then IndexHits <Document> indexHits = collector.GetIndexHits(Sort.RELEVANCE); assertEquals(2, indexHits.Size()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertEquals("2", indexHits.next().get("id")); assertEquals(2.0f, indexHits.CurrentScore(), 0.001f); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertEquals("1", indexHits.next().get("id")); assertEquals(1.0f, indexHits.CurrentScore(), 0.001f); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertFalse(indexHits.hasNext()); }
internal virtual IDictionary <string, IDictionary <string, Serializable> > CheckIndex(GraphDatabaseService db) { IDictionary <string, IDictionary <string, Serializable> > result = new Dictionary <string, IDictionary <string, Serializable> >(); foreach (string indexName in Db.index().nodeIndexNames()) { IDictionary <string, Serializable> thisIndex = new Dictionary <string, Serializable>(); Index <Node> tempIndex = Db.index().forNodes(indexName); foreach (KeyValuePair <string, Serializable> property in Properties.props.SetOfKeyValuePairs()) { using (IndexHits <Node> content = tempIndex.get(property.Key, property.Value)) { //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: if (content.hasNext()) { foreach (Node hit in content) { if (hit.Id == Id) { thisIndex[property.Key] = property.Value; break; } } } } } result[indexName] = thisIndex; } return(result); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldReturnEmptyIteratorWhenNoHits() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal void ShouldReturnEmptyIteratorWhenNoHits() { // given DocValuesCollector collector = new DocValuesCollector(false); IndexReaderStub readerStub = IndexReaderWithMaxDocs(42); // when collector.DoSetNextReader(readerStub.Context); // then IndexHits <Document> indexHits = collector.GetIndexHits(null); assertEquals(0, indexHits.Size()); assertEquals(Float.NaN, indexHits.CurrentScore(), 0.001f); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertFalse(indexHits.hasNext()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldReturnIndexHitsInIndexOrderWhenNoSortIsGiven() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal void ShouldReturnIndexHitsInIndexOrderWhenNoSortIsGiven() { // given DocValuesCollector collector = new DocValuesCollector(); IndexReaderStub readerStub = IndexReaderWithMaxDocs(42); // when collector.DoSetNextReader(readerStub.Context); collector.Collect(1); collector.Collect(2); // then IndexHits <Document> indexHits = collector.GetIndexHits(null); assertEquals(2, indexHits.Size()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertEquals("1", indexHits.next().get("id")); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertEquals("2", indexHits.next().get("id")); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertFalse(indexHits.hasNext()); }