예제 #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.apache.lucene.search.TopDocs getTopDocs(org.apache.lucene.search.Sort sort, int size) throws java.io.IOException
        private TopDocs GetTopDocs(Sort sort, int size)
        {
            TopDocs topDocs;

            if (sort == Sort.RELEVANCE)
            {
                TopScoreDocCollector collector = TopScoreDocCollector.create(size);
                ReplayTo(collector);
                topDocs = collector.topDocs();
            }
            else
            {
                TopFieldCollector collector = TopFieldCollector.create(sort, size, false, true, false);
                ReplayTo(collector);
                topDocs = collector.topDocs();
            }
            return(topDocs);
        }
예제 #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.apache.lucene.search.TopDocs toTopDocs(org.apache.lucene.search.Query query, org.neo4j.index.lucene.QueryContext context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
        private TopDocs ToTopDocs(Query query, QueryContext context, IndexSearcher searcher)
        {
            Sort    sorting = context != null ? context.Sorting : null;
            TopDocs topDocs;

            if (sorting == null && context != null)
            {
                topDocs = searcher.search(query, context.Top);
            }
            else
            {
                if (context == null || !context.TradeCorrectnessForSpeed)
                {
                    TopFieldCollector collector = LuceneDataSource.ScoringCollector(sorting, context.Top);
                    searcher.search(query, collector);
                    topDocs = collector.topDocs();
                }
                else
                {
                    topDocs = searcher.search(query, null, context.Top, sorting);
                }
            }
            return(topDocs);
        }