//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()); }
//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 public void shouldAddRelationshipToExplicitIndex() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldAddRelationshipToExplicitIndex() { long relId; using (Org.Neo4j.Graphdb.Transaction ctx = graphDb.beginTx()) { relId = graphDb.createNode().createRelationshipTo(graphDb.createNode(), RelationshipType.withName("R")).Id; ctx.Success(); } using (Transaction tx = beginTransaction()) { ExplicitIndexWrite indexWrite = tx.IndexWrite(); indexWrite.RelationshipAddToExplicitIndex(INDEX_NAME, relId, KEY, VALUE); 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)); hits.Close(); ctx.Success(); } }
//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()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldAddNodeToExplicitIndex() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldAddNodeToExplicitIndex() { long nodeId; using (Transaction tx = beginTransaction()) { nodeId = tx.DataWrite().nodeCreate(); ExplicitIndexWrite indexWrite = tx.IndexWrite(); indexWrite.NodeAddToExplicitIndex(INDEX_NAME, nodeId, KEY, VALUE); 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: assertThat(hits.next().Id, equalTo(nodeId)); hits.Close(); ctx.Success(); } }