GetDocIdSet() public method

Get the id set for the filter.
public GetDocIdSet ( IndexReader reader ) : Lucene.Net.Search.DocIdSet
reader Lucene.Net.Index.IndexReader The reader.
return Lucene.Net.Search.DocIdSet
        private FacetGroup CalculateResultCount(IndexReader reader, DocIdSet baseDocIdSet, ISearchFilter filter, ISearchCriteria criteria)
        {
            FacetGroup result = null;

            var values = filter.GetValues();
            if (values != null)
            {
                BooleanFilter ffilter = null;
                foreach (var f in criteria.CurrentFilters)
                {
                    if (!f.Key.Equals(filter.Key))
                    {
                        if (ffilter == null)
                            ffilter = new BooleanFilter();

                        var q = LuceneQueryHelper.CreateQuery(criteria, f, Occur.SHOULD);
                        ffilter.Add(new FilterClause(q, Occur.MUST));
                    }
                }

                var groupLabels = filter.GetLabels();
                var facetGroup = new FacetGroup(filter.Key, groupLabels);

                foreach (var group in values.GroupBy(v => v.Id))
                {
                    var value = group.FirstOrDefault();
                    var valueFilter = LuceneQueryHelper.CreateQueryForValue(Results.SearchCriteria, filter, value);

                    if (valueFilter != null)
                    {
                        var queryFilter = new BooleanFilter();
                        queryFilter.Add(new FilterClause(valueFilter, Occur.MUST));
                        if (ffilter != null)
                            queryFilter.Add(new FilterClause(ffilter, Occur.MUST));

                        var filterArray = queryFilter.GetDocIdSet(reader);
                        var newCount = (int)CalculateFacetCount(baseDocIdSet, filterArray);

                        if (newCount > 0)
                        {
                            var valueLabels = group.GetValueLabels();
                            var newFacet = new Facet(facetGroup, group.Key, newCount, valueLabels);
                            facetGroup.Facets.Add(newFacet);
                        }
                    }
                }

                if (facetGroup.Facets.Any())
                {
                    result = facetGroup;
                }
            }

            return result;
        }
        /// <summary>
        /// Calculates the result count.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="baseDocIdSet">The base doc id set.</param>
        /// <param name="facetGroup">The facet group.</param>
        /// <param name="filter">The filter.</param>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        private int CalculateResultCount(IndexReader reader, DocIdSet baseDocIdSet, FacetGroup facetGroup, ISearchFilter filter, ISearchCriteria criteria)
        {
            var count = 0;

            var values = LuceneQueryHelper.GetFilterValues(filter);

            if (values == null)
            {
                return 0;
            }

            BooleanFilter ffilter = null;
            foreach (var f in criteria.CurrentFilters)
            {
                if (!f.Key.Equals(facetGroup.FieldName))
                {
                    if (ffilter == null)
                        ffilter = new BooleanFilter();

                    var q = LuceneQueryHelper.CreateQuery(criteria, f, Occur.SHOULD);
                    ffilter.Add(new FilterClause(q, Occur.MUST));
                }
            }

            foreach (var value in values)
            {
                var queryFilter = new BooleanFilter();

                var valueFilter = LuceneQueryHelper.CreateQueryForValue(Results.SearchCriteria, filter, value);

                if (valueFilter == null)
                    continue;

                queryFilter.Add(new FilterClause(valueFilter, Occur.MUST));
                if (ffilter != null)
                    queryFilter.Add(new FilterClause(ffilter, Occur.MUST));

                var filterArray = queryFilter.GetDocIdSet(reader);
                var newCount = (int)CalculateFacetCount(baseDocIdSet, filterArray);
                if (newCount == 0)
                    continue;

                var newFacet = new Facet(facetGroup, value.Id, GetDescription(value, Results.SearchCriteria.Locale), newCount);
                facetGroup.Facets.Add(newFacet);
                count += newCount;
            }

            return count;
        }