Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void numericIndexVerificationNoDuplicates() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void NumericIndexVerificationNoDuplicates()
        {
            IList <object> data = new IList <object> {
                int.MaxValue - 2, int.MaxValue - 1, int.MaxValue
            };
            NodePropertyAccessor nodePropertyAccessor = NewPropertyAccessor(data);

            Insert(data);

            IndexSearcher indexSearcher = spy(_searcherManager.acquire());

            RunUniquenessVerification(nodePropertyAccessor, indexSearcher);

            verify(indexSearcher, never()).search(any(typeof(Query)), any(typeof(Collector)));
        }
Esempio n. 2
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);
            }
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void removeFromCache(long entityId) throws java.io.IOException
        private void RemoveFromCache(long entityId)
        {
            IndexSearcher searcher = _searcherManager.acquire();

            try
            {
                Query   query = _type.idTermQuery(entityId);
                TopDocs docs  = searcher.search(query, 1);
                if (docs.totalHits > 0)
                {
                    Document document = searcher.doc(docs.scoreDocs[0].doc);
                    foreach (IndexableField field in document.Fields)
                    {
                        string key   = field.name();
                        object value = field.stringValue();
                        RemoveFromCache(entityId, key, value);
                    }
                }
            }
            finally
            {
                _searcherManager.release(searcher);
            }
        }
 internal SearchWrapper(SearcherManager searcherManager)
 {
     _searcherManager = searcherManager;
     _indexSearcher = (IndexSearcher) _searcherManager.acquire();
 }