当前位置: 首页>>代码示例>>C#>>正文


C# FieldQuery.expand方法代码示例

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


在下文中一共展示了FieldQuery.expand方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestExpand

        public void TestExpand()
        {
            Query dummy = PqF("DUMMY");
            FieldQuery fq = new FieldQuery(dummy, true, true);

            // "a b","b c" => "a b","b c","a b c"
            HashSet<Query> flatQueries = new HashSet<Query>();
            flatQueries.Add(PqF("a", "b"));
            flatQueries.Add(PqF( "b", "c" ));
            AssertCollectionQueries(fq.expand(flatQueries),
                PqF("a", "b"), PqF("b", "c"), PqF("a", "b", "c"));

            // "a b","b c d" => "a b","b c d","a b c d"
            flatQueries = new HashSet<Query>();
            flatQueries.Add(PqF("a", "b"));
            flatQueries.Add(PqF("b", "c", "d"));
            AssertCollectionQueries(fq.expand(flatQueries),
                PqF("a", "b"), PqF("b", "c", "d"), PqF("a", "b", "c", "d"));

            // "a b c","b c d" => "a b c","b c d","a b c d"
            flatQueries = new HashSet<Query>();
            flatQueries.Add(PqF("a", "b", "c"));
            flatQueries.Add(PqF("b", "c", "d"));
            AssertCollectionQueries(fq.expand(flatQueries),
                PqF("a", "b", "c"), PqF("b", "c", "d"), PqF("a", "b", "c", "d"));

            // "a b c","c d e" => "a b c","c d e","a b c d e"
            flatQueries = new HashSet<Query>();
            flatQueries.Add(PqF("a", "b", "c"));
            flatQueries.Add(PqF("c", "d", "e"));
            AssertCollectionQueries(fq.expand(flatQueries),
                PqF("a", "b", "c"), PqF("c", "d", "e"), PqF("a", "b", "c", "d", "e"));

            // "a b c d","b c" => "a b c d","b c"
            flatQueries = new HashSet<Query>();
            flatQueries.Add(PqF("a", "b", "c", "d"));
            flatQueries.Add(PqF("b", "c"));
            AssertCollectionQueries(fq.expand(flatQueries),
                PqF("a", "b", "c", "d"), PqF("b", "c"));

            // "a b b","b c" => "a b b","b c","a b b c"
            flatQueries = new HashSet<Query>();
            flatQueries.Add(PqF("a", "b", "b"));
            flatQueries.Add(PqF("b", "c"));
            AssertCollectionQueries(fq.expand(flatQueries),
                PqF("a", "b", "b"), PqF("b", "c"), PqF("a", "b", "b", "c"));

            // "a b","b a" => "a b","b a","a b a", "b a b"
            flatQueries = new HashSet<Query>();
            flatQueries.Add(PqF("a", "b"));
            flatQueries.Add(PqF("b", "a"));
            AssertCollectionQueries(fq.expand(flatQueries),
                PqF("a", "b"), PqF("b", "a"), PqF("a", "b", "a"), PqF("b", "a", "b"));

            // "a b","a b c" => "a b","a b c"
            flatQueries = new HashSet<Query>();
            flatQueries.Add(PqF("a", "b"));
            flatQueries.Add(PqF("a", "b", "c"));
            AssertCollectionQueries(fq.expand(flatQueries),
                PqF("a", "b"), PqF("a", "b", "c"));
        }
开发者ID:Rationalle,项目名称:ravendb,代码行数:61,代码来源:FieldQueryTest.cs

示例2: TestExpandNotFieldMatch

        public void TestExpandNotFieldMatch()
        {
            Query dummy = PqF("DUMMY");
            FieldQuery fq = new FieldQuery(dummy, true, false);

            // f1:"a b",f2:"b c" => f1:"a b",f2:"b c",f1:"a b c"
            HashSet<Query> flatQueries = new HashSet<Query>();
            flatQueries.Add(Pq(F1, "a", "b"));
            flatQueries.Add(Pq(F2, "b", "c"));
            AssertCollectionQueries(fq.expand(flatQueries),
                Pq(F1, "a", "b"), Pq(F2, "b", "c"), Pq(F1, "a", "b", "c"));
        }
开发者ID:Rationalle,项目名称:ravendb,代码行数:12,代码来源:FieldQueryTest.cs


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