Ejemplo n.º 1
0
        public ISearchBits GetBits()
        {
            var query = CreateQuery();
            IndexSearcher searcher;

            try {
                searcher = new IndexSearcher(_directory, true);
            }
            catch {
                // index might not exist if it has been rebuilt
                Logger.Information("Attempt to read a none existing index");
                return null;
            }

            try {
                var filter = new QueryWrapperFilter(query);
                var bits = filter.GetDocIdSet(searcher.GetIndexReader());
                var disi = new OpenBitSetDISI(bits.Iterator(), searcher.MaxDoc());
                return new SearchBits(disi);
            }
            finally {
                searcher.Close();
            }
        }
 protected OpenBitSetDISI CalculateOpenBitSetDisi(string facetAttributeFieldName, string value)
 {
     var facetQuery = new TermQuery(new Term(facetAttributeFieldName, value));
     var facetQueryFilter = new QueryWrapperFilter(facetQuery);
     return new OpenBitSetDISI(facetQueryFilter.GetDocIdSet(IndexReader).Iterator(), IndexReader.MaxDoc);
 }