예제 #1
0
        public void Test1Filter()
        {
            BrowseRequest             request = CreateRequest(1, "prop3");
            FacetCountCollectorSource facetCountCollectorSource = attributesFacetHandler.GetFacetCountCollectorSource(request.GetSelection(AttributeHandlerName), request.GetFacetSpec(AttributeHandlerName));
            RandomAccessFilter        randomAccessFilter        = attributesFacetHandler.BuildFilter(request.GetSelection(AttributeHandlerName));
            DocIdSetIterator          iterator = randomAccessFilter.GetDocIdSet(boboReader).Iterator();
            int docId = iterator.NextDoc();

            int[] docIds = new int[2];
            int   i      = 0;

            while (docId != DocIdSetIterator.NO_MORE_DOCS)
            {
                docIds[i] = docId;
                i++;
                docId = iterator.NextDoc();
            }
            Assert.AreEqual(Arrays.ToString(new int[] { 1, 2 }), Arrays.ToString(docIds));

            BrowseResult res = browser.Browse(request);

            Assert.AreEqual(res.NumHits, 2);
            IFacetAccessible          fa     = res.GetFacetAccessor(AttributeHandlerName);
            IEnumerable <BrowseFacet> facets = fa.GetFacets();

            Console.WriteLine(facets);
            Assert.AreEqual(3, facets.Count());
            BrowseFacet facet = facets.Get(0);

            Assert.AreEqual(1, facet.FacetValueHitCount);
        }