예제 #1
0
        public override RandomAccessDocIdSet GetRandomAccessDocIdSet(BoboSegmentReader reader)
        {
            MultiValueFacetDataCache dataCache = m_facetHandler.GetFacetData <MultiValueFacetDataCache>(reader);

            int[] index = m_valueConverter.Convert(dataCache, m_vals);
            //BigNestedIntArray nestedArray = dataCache.NestedArray;
            OpenBitSet bitset = new OpenBitSet(dataCache.ValArray.Count);

            foreach (int i in index)
            {
                bitset.FastSet(i);
            }

            if (m_takeCompliment)
            {
                // flip the bits
                int size = dataCache.ValArray.Count;
                for (int i = 0; i < size; ++i)
                {
                    bitset.FastFlip(i);
                }
            }

            long count = bitset.Cardinality();

            if (count == 0)
            {
                return(new EmptyRandomAccessDocIdSet());
            }
            else
            {
                return(new MultiRandomAccessDocIdSet(dataCache, bitset));
            }
        }
        public virtual OpenBitSet BitSet(FacetDataCache dataCache)
        {
            int[] index = m_facetValueConverter.Convert(dataCache, m_vals);

            OpenBitSet bitset = new OpenBitSet(dataCache.ValArray.Count);

            foreach (int i in index)
            {
                bitset.FastSet(i);
            }
            if (m_takeCompliment)
            {
                // flip the bits
                for (int i = 0; i < index.Length; ++i)
                {
                    bitset.FastFlip(i);
                }
            }
            return(bitset);
        }
예제 #3
0
            internal FacetOrRandomAccessDocIdSet(IFacetHandler facetHandler, BoboIndexReader reader,
                                                 string[] vals, IFacetValueConverter valConverter, bool takeCompliment)
            {
                _dataCache  = facetHandler.GetFacetData <FacetDataCache>(reader);
                _orderArray = _dataCache.OrderArray;
                _index      = valConverter.Convert(_dataCache, vals);

                _bitset = new OpenBitSet(_dataCache.ValArray.Count);
                foreach (int i in _index)
                {
                    _bitset.FastSet(i);
                }

                if (takeCompliment)
                {
                    // flip the bits
                    for (int i = 0; i < _dataCache.ValArray.Count; ++i)
                    {
                        _bitset.FastFlip(i);
                    }
                }
            }