예제 #1
0
        public void TestPrefixFilter()
        {
            var prefixfilter = new PrefixFilter("name", "张");
            var termQuery = new TermQuery("type", "common");
            var q = new FilteredQuery(termQuery, prefixfilter);
            var result = client.Search(index, "type" , q, 0, 5);

            Assert.AreEqual(3, result.GetTotalCount());

            prefixfilter = new PrefixFilter("name", "张三");
            termQuery = new TermQuery("type", "common");
            q = new FilteredQuery(termQuery, prefixfilter);
            result = client.Search(index, "type" , q, 0, 5);

            Assert.AreEqual(2, result.GetTotalCount());
        }