• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Vectorhighlight.FieldQuery类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Lucene.Net.Search.Vectorhighlight.FieldQuery的典型用法代码示例。如果您正苦于以下问题:C# FieldQuery类的具体用法?C# FieldQuery怎么用?C# FieldQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FieldQuery类属于Lucene.Net.Search.Vectorhighlight命名空间,在下文中一共展示了FieldQuery类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: FieldPhraseList

        /// <summary>
        /// a constructor. 
        /// </summary>
        /// <param name="fieldTermStack">FieldTermStack object</param>
        /// <param name="fieldQuery">FieldQuery object</param>
        /// <param name="phraseLimit">maximum size of phraseList</param>
        public FieldPhraseList(FieldTermStack fieldTermStack, FieldQuery fieldQuery, int phraseLimit)
        {
            String field = fieldTermStack.FieldName;

            LinkedList<TermInfo> phraseCandidate = new LinkedList<TermInfo>();
            QueryPhraseMap currMap = null;
            QueryPhraseMap nextMap = null;
            while (!fieldTermStack.IsEmpty() && (phraseList.Count < phraseLimit) )
            {

                phraseCandidate.Clear();

                TermInfo ti = fieldTermStack.Pop();
                currMap = fieldQuery.GetFieldTermMap(field, ti.Text);

                // if not found, discard top TermInfo from stack, then try next element
                if (currMap == null) continue;

                // if found, search the longest phrase
                phraseCandidate.AddLast(ti);
                while (true)
                {
                    ti = fieldTermStack.Pop();
                    nextMap = null;
                    if (ti != null)
                        nextMap = currMap.GetTermMap(ti.Text);
                    if (ti == null || nextMap == null)
                    {
                        if (ti != null)
                            fieldTermStack.Push(ti);
                        if (currMap.IsValidTermOrPhrase(new List<TermInfo>(phraseCandidate)))
                        {
                            AddIfNoOverlap(new WeightedPhraseInfo(phraseCandidate, currMap.Boost, currMap.TermOrPhraseNumber));
                        }
                        else
                        {
                            while (phraseCandidate.Count > 1)
                            {
                                TermInfo last = phraseCandidate.Last.Value;
                                phraseCandidate.RemoveLast();
                                fieldTermStack.Push(last);
                                currMap = fieldQuery.SearchPhrase(field, new List<TermInfo>(phraseCandidate));
                                if (currMap != null)
                                {
                                    AddIfNoOverlap(new WeightedPhraseInfo(phraseCandidate, currMap.Boost, currMap.TermOrPhraseNumber));
                                    break;
                                }
                            }
                        }
                        break;
                    }
                    else
                    {
                        phraseCandidate.AddLast(ti);
                        currMap = nextMap;
                    }
                }
            }
        }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:65,代码来源:FieldPhraseList.cs


示例2: TestFlatten1TermPhrase

 public void TestFlatten1TermPhrase()
 {
     Query query = PqF("A");
     FieldQuery fq = new FieldQuery(query, true, true);
     HashSet<Query> flatQueries = new HashSet<Query>();
     fq.flatten(query, flatQueries);
     AssertCollectionQueries(flatQueries, Tq("A"));
 }
开发者ID:Rationalle,项目名称:ravendb,代码行数:8,代码来源:FieldQueryTest.cs


示例3: TestFlattenTermAndPhrase2gram

 public void TestFlattenTermAndPhrase2gram()
 {
     Query query = paB.Parse("AA AND BCD OR EFGH");
     FieldQuery fq = new FieldQuery(query, true, true);
     HashSet<Query> flatQueries = new HashSet<Query>();
     fq.flatten(query, flatQueries);
     AssertCollectionQueries(flatQueries, Tq("AA"), PqF("BC", "CD" ), PqF("EF", "FG", "GH"));
 }
开发者ID:Rationalle,项目名称:ravendb,代码行数:8,代码来源:FieldQueryTest.cs


示例4: TestFlattenTermAndPhrase

 public void TestFlattenTermAndPhrase()
 {
     Query query = paW.Parse("A AND \"B C\"");
     FieldQuery fq = new FieldQuery(query, true, true);
     HashSet<Query> flatQueries = new HashSet<Query>();
     fq.flatten(query, flatQueries);
     AssertCollectionQueries(flatQueries, Tq("A"), PqF("B", "C"));
 }
开发者ID:Rationalle,项目名称:ravendb,代码行数:8,代码来源:FieldQueryTest.cs


示例5: testFlattenDisjunctionMaxQuery

 public void testFlattenDisjunctionMaxQuery()
 {
     Query query = Dmq(Tq("A"), Tq("B"), PqF("C", "D"));
     FieldQuery fq = new FieldQuery(query, true, true);
     HashSet<Query> flatQueries = new HashSet<Query>();
     fq.flatten(query, flatQueries);
     AssertCollectionQueries(flatQueries, Tq("A"), Tq("B"), PqF("C", "D"));
 }
开发者ID:Rationalle,项目名称:ravendb,代码行数:8,代码来源:FieldQueryTest.cs


示例6: TestFlattenBoolean

 public void TestFlattenBoolean()
 {
     Query query = paW.Parse("A AND B OR C NOT (D AND E)");
     FieldQuery fq = new FieldQuery(query, true, true);
     HashSet<Query> flatQueries = new HashSet<Query>();
     fq.flatten(query, flatQueries);
     AssertCollectionQueries(flatQueries, Tq("A"), Tq("B"), Tq("C"));
 }
开发者ID:Rationalle,项目名称:ravendb,代码行数:8,代码来源:FieldQueryTest.cs


示例7: TestFieldTermStackIndex1w2wSearch1term

        public void TestFieldTermStackIndex1w2wSearch1term()
        {
            MakeIndex1w2w();

            FieldQuery fq = new FieldQuery(Tq("pc"), true, true);
            FieldTermStack stack = new FieldTermStack(reader, 0, F, fq);
            Assert.AreEqual(1, stack.termList.Count);
            Assert.AreEqual("pc(3,5,1)", stack.Pop().ToString());
        }
开发者ID:Nangal,项目名称:lucene.net,代码行数:9,代码来源:IndexTimeSynonymTest.cs


示例8: Ffl

 private FieldFragList Ffl(String queryValue, String indexValue)
 {
     Make1d1fIndex(indexValue);
     Query query = paW.Parse(queryValue);
     FieldQuery fq = new FieldQuery(query, true, true);
     FieldTermStack stack = new FieldTermStack(reader, 0, F, fq);
     FieldPhraseList fpl = new FieldPhraseList(stack, fq);
     return new SimpleFragListBuilder().CreateFieldFragList(fpl, 20);
 }
开发者ID:hanabi1224,项目名称:lucene.net,代码行数:9,代码来源:ScoreOrderFragmentsBuilderTest.cs


示例9: TestFieldTermStackIndex1w2wSearch1phrase

        public void TestFieldTermStackIndex1w2wSearch1phrase()
        {
            MakeIndex1w2w();

            FieldQuery fq = new FieldQuery(PqF("personal", "computer"), true, true);
            FieldTermStack stack = new FieldTermStack(reader, 0, F, fq);
            Assert.AreEqual(2, stack.termList.Count);
            Assert.AreEqual("personal(3,5,1)", stack.Pop().ToString());
            Assert.AreEqual("computer(3,5,2)", stack.Pop().ToString());
        }
开发者ID:Nangal,项目名称:lucene.net,代码行数:10,代码来源:IndexTimeSynonymTest.cs


示例10: Test1Phrase

        public void Test1Phrase()
        {
            MakeIndex();

            FieldQuery fq = new FieldQuery(PqF("c", "d"), true, true);
            FieldTermStack stack = new FieldTermStack(reader, 0, F, fq);
            Assert.AreEqual(3, stack.termList.Count);
            Assert.AreEqual("c(10,11,5)", stack.Pop().ToString());
            Assert.AreEqual("c(18,19,9)", stack.Pop().ToString());
            Assert.AreEqual("d(20,21,10)", stack.Pop().ToString());
        }
开发者ID:synhershko,项目名称:lucene.net,代码行数:11,代码来源:FieldTermStackTest.cs


示例11: Test2TermsIndex

        public void Test2TermsIndex()
        {
            Make1d1fIndex("a a");

            FieldQuery fq = new FieldQuery(Tq("a"), true, true);
            FieldTermStack stack = new FieldTermStack(reader, 0, F, fq);
            FieldPhraseList fpl = new FieldPhraseList(stack, fq);
            Assert.AreEqual(2, fpl.phraseList.Count);
            Assert.AreEqual("a(1.0)((0,1))", fpl.phraseList.First.Value.ToString());
            Assert.AreEqual("a(1.0)((2,3))", fpl.phraseList.First.Next.Value.ToString());
        }
开发者ID:VirtueMe,项目名称:ravendb,代码行数:11,代码来源:FieldPhraseListTest.cs


示例12: Test1Term

        public void Test1Term()
        {
            MakeIndex();

            FieldQuery fq = new FieldQuery(Tq("a"), true, true);
            FieldTermStack stack = new FieldTermStack(reader, 0, F, fq);
            Assert.AreEqual(6, stack.termList.Count);
            Assert.AreEqual("a(0,1,0)", stack.Pop().ToString());
            Assert.AreEqual("a(2,3,1)", stack.Pop().ToString());
            Assert.AreEqual("a(4,5,2)", stack.Pop().ToString());
            Assert.AreEqual("a(12,13,6)", stack.Pop().ToString());
            Assert.AreEqual("a(28,29,14)", stack.Pop().ToString());
            Assert.AreEqual("a(32,33,16)", stack.Pop().ToString());
        }
开发者ID:synhershko,项目名称:lucene.net,代码行数:14,代码来源:FieldTermStackTest.cs


示例13: Test1PhraseIndex

        public void Test1PhraseIndex()
        {
            Make1d1fIndex("a b");

            FieldQuery fq = new FieldQuery(PqF("a", "b"), true, true);
            FieldTermStack stack = new FieldTermStack(reader, 0, F, fq);
            FieldPhraseList fpl = new FieldPhraseList(stack, fq);
            Assert.AreEqual(1, fpl.phraseList.Count);
            Assert.AreEqual("ab(1.0)((0,3))", fpl.phraseList.First.Value.ToString());

            fq = new FieldQuery(Tq("b"), true, true);
            stack = new FieldTermStack(reader, 0, F, fq);
            fpl = new FieldPhraseList(stack, fq);
            Assert.AreEqual(1, fpl.phraseList.Count);
            Assert.AreEqual("b(1.0)((2,3))", fpl.phraseList.First.Value.ToString());
        }
开发者ID:VirtueMe,项目名称:ravendb,代码行数:16,代码来源:FieldPhraseListTest.cs


示例14: TestFieldTermStackIndex1wSearch2terms

        public void TestFieldTermStackIndex1wSearch2terms()
        {
            MakeIndex1w();

            BooleanQuery bq = new BooleanQuery();
            bq.Add(Tq("Mac"), Occur.SHOULD);
            bq.Add(Tq("MacBook"), Occur.SHOULD);
            FieldQuery fq = new FieldQuery(bq, true, true);
            FieldTermStack stack = new FieldTermStack(reader, 0, F, fq);
            Assert.AreEqual(2, stack.termList.Count);
            Dictionary<String, String> expectedSet = new Dictionary<String, String>();
            expectedSet.Add("Mac(11,20,3)","");
            expectedSet.Add("MacBook(11,20,3)","");
            Assert.IsTrue(expectedSet.ContainsKey(stack.Pop().ToString()));
            Assert.IsTrue(expectedSet.ContainsKey(stack.Pop().ToString()));
        }
开发者ID:Nangal,项目名称:lucene.net,代码行数:16,代码来源:IndexTimeSynonymTest.cs


示例15: Test2Terms

        public void Test2Terms()
        {
            MakeIndex();

            BooleanQuery query = new BooleanQuery();
            query.Add(Tq("b"), Occur.SHOULD);
            query.Add(Tq("c"), Occur.SHOULD);
            FieldQuery fq = new FieldQuery(query, true, true);
            FieldTermStack stack = new FieldTermStack(reader, 0, F, fq);
            Assert.AreEqual(8, stack.termList.Count);
            Assert.AreEqual("b(6,7,3)", stack.Pop().ToString());
            Assert.AreEqual("b(8,9,4)", stack.Pop().ToString());
            Assert.AreEqual("c(10,11,5)", stack.Pop().ToString());
            Assert.AreEqual("b(14,15,7)", stack.Pop().ToString());
            Assert.AreEqual("b(16,17,8)", stack.Pop().ToString());
            Assert.AreEqual("c(18,19,9)", stack.Pop().ToString());
            Assert.AreEqual("b(26,27,13)", stack.Pop().ToString());
            Assert.AreEqual("b(30,31,15)", stack.Pop().ToString());
        }
开发者ID:synhershko,项目名称:lucene.net,代码行数:19,代码来源:FieldTermStackTest.cs


示例16: GetFieldFragList

 private FieldFragList GetFieldFragList(FieldQuery fieldQuery, IndexReader reader, int docId,
     String fieldName, int fragCharSize)
 {
     FieldTermStack fieldTermStack = new FieldTermStack(reader, docId, fieldName, fieldQuery);
     FieldPhraseList fieldPhraseList = new FieldPhraseList(fieldTermStack, fieldQuery, phraseLimit);
     return fragListBuilder.CreateFieldFragList(fieldPhraseList, fragCharSize);
 }
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:7,代码来源:FastVectorHighlighter.cs


示例17: Test1PhraseLongMVB

        public void Test1PhraseLongMVB()
        {
            MakeIndexLongMVB();

            FieldQuery fq = new FieldQuery(PqF("sp", "pe", "ee", "ed"), true, true); // "speed" -(2gram)-> "sp","pe","ee","ed"
            FieldTermStack stack = new FieldTermStack(reader, 0, F, fq);
            FieldPhraseList fpl = new FieldPhraseList(stack, fq);
            Assert.AreEqual(1, fpl.phraseList.Count);
            Assert.AreEqual("sppeeeed(1.0)((88,93))", fpl.phraseList.First.Value.ToString());
        }
开发者ID:VirtueMe,项目名称:ravendb,代码行数:10,代码来源:FieldPhraseListTest.cs


示例18: Test1PhraseShortMV

        public void Test1PhraseShortMV()
        {
            MakeIndexShortMV();

            FieldQuery fq = new FieldQuery(Tq("d"), true, true);
            FieldTermStack stack = new FieldTermStack(reader, 0, F, fq);
            FieldPhraseList fpl = new FieldPhraseList(stack, fq);
            Assert.AreEqual(1, fpl.phraseList.Count);
            Assert.AreEqual("d(1.0)((6,7))", fpl.phraseList.First.Value.ToString());
        }
开发者ID:VirtueMe,项目名称:ravendb,代码行数:10,代码来源:FieldPhraseListTest.cs


示例19: Test1PhraseLongMV

        public void Test1PhraseLongMV()
        {
            MakeIndexLongMV();

            FieldQuery fq = new FieldQuery(PqF("search", "engines"), true, true);
            FieldTermStack stack = new FieldTermStack(reader, 0, F, fq);
            FieldPhraseList fpl = new FieldPhraseList(stack, fq);
            Assert.AreEqual(2, fpl.phraseList.Count);
            Assert.AreEqual("searchengines(1.0)((102,116))", fpl.phraseList.First.Value.ToString());
            Assert.AreEqual("searchengines(1.0)((157,171))", fpl.phraseList.First.Next.Value.ToString());
        }
开发者ID:VirtueMe,项目名称:ravendb,代码行数:11,代码来源:FieldPhraseListTest.cs


示例20: Test3TermsPhrase

        public void Test3TermsPhrase()
        {
            Make1d1fIndex("d a b a b c d");

            FieldQuery fq = new FieldQuery(PqF("a", "b", "c"), true, true);
            FieldTermStack stack = new FieldTermStack(reader, 0, F, fq);
            FieldPhraseList fpl = new FieldPhraseList(stack, fq);
            Assert.AreEqual(1, fpl.phraseList.Count);
            Assert.AreEqual("abc(1.0)((6,11))", fpl.phraseList.First.Value.ToString());
        }
开发者ID:VirtueMe,项目名称:ravendb,代码行数:10,代码来源:FieldPhraseListTest.cs



注:本文中的Lucene.Net.Search.Vectorhighlight.FieldQuery类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Store.Directory类代码示例发布时间:2022-05-26
下一篇:
C# Vectorhighlight.FieldPhraseList类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap