Exemple #1
0
//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);
            }
        }
Exemple #2
0
//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);
            }
        }