public override RandomAccessDocIdSet GetRandomAccessDocIdSet(BoboIndexReader reader)
        {
            FacetDataCache dataCache = _facetHandler.GetFacetData <FacetDataCache>(reader);

            int[] indexes = FacetDataCache.Convert(dataCache, _vals);

            int bits;

            bits = 0x0;
            foreach (int i in indexes)
            {
                bits |= 0x00000001 << (i - 1);
            }

            int finalBits = bits;

            BigSegmentedArray orderArray = dataCache.OrderArray;

            if (indexes.Length == 0)
            {
                return(EmptyDocIdSet.Instance);
            }
            else
            {
                return(new CompactMultiValueFacetFilterDocIdSet(dataCache, indexes, finalBits, orderArray));
            }
        }
        public override double GetFacetSelectivity(BoboIndexReader reader)
        {
            double         selectivity = 0;
            FacetDataCache dataCache   = _facetHandler.GetFacetData <FacetDataCache>(reader);

            int[] idxes = FacetDataCache.Convert(dataCache, _vals);
            if (idxes == null)
            {
                return(0.0);
            }
            int accumFreq = 0;

            foreach (int idx in idxes)
            {
                accumFreq += dataCache.Freqs[idx];
            }
            int total = reader.MaxDoc;

            selectivity = (double)accumFreq / (double)total;
            if (selectivity > 0.999)
            {
                selectivity = 1.0;
            }
            return(selectivity);
        }
Esempio n. 3
0
 public int[] Convert(FacetDataCache dataCache, string[] vals)
 {
     return(FacetDataCache.Convert(dataCache, vals));
 }