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


C# SolrQueryExecuter.GetAllParameters方法代码示例

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


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

示例1: ExtraParams

 public void ExtraParams()
 {
     var querySerializer = new SolrQuerySerializerStub("123123");
     var queryExecuter = new SolrQueryExecuter<TestDocument>(null, null, querySerializer, null, null);
     var p = queryExecuter.GetAllParameters(new SolrQuery("123123"), new QueryOptions {
         ExtraParams = new Dictionary<string, string> {
                     {"qt", "geo"},
                     {"lat", "40.75141843299745"},
                     {"long", "-74.0093994140625"},
                     {"radius", "1"},
                 }
     }).ToDictionary(x => x.Key, x => x.Value);
     Assert.AreEqual("123123", p["q"]);
     Assert.AreEqual("geo", p["qt"]);
     Assert.AreEqual("1", p["radius"]);
 }
开发者ID:pampero,项目名称:cgFramework,代码行数:16,代码来源:SolrQueryExecuterTests.cs

示例2: MoreLikeThis

 public void MoreLikeThis()
 {
     var querySerializer = new SolrQuerySerializerStub("apache");
     var queryExecuter = new SolrQueryExecuter<TestDocument>(null, null, querySerializer, null, null);
     var p = queryExecuter.GetAllParameters(new SolrQuery("apache"), new QueryOptions {
         MoreLikeThis = new MoreLikeThisParameters(new[] { "manu", "cat" }) {
             MinDocFreq = 1,
             MinTermFreq = 1,
         },
     }).ToList();
     Assert.Contains(p, KV.Create("mlt", "true"));
     Assert.Contains(p, KV.Create("mlt.mindf", "1"));
     Assert.Contains(p, KV.Create("mlt.fl", "manu,cat"));
     Assert.Contains(p, KV.Create("mlt.mintf", "1"));
     Assert.Contains(p, KV.Create("q", "apache"));
 }
开发者ID:pampero,项目名称:cgFramework,代码行数:16,代码来源:SolrQueryExecuterTests.cs

示例3: GetAllParameters_with_spelling

 public void GetAllParameters_with_spelling()
 {
     var querySerializer = new SolrQuerySerializerStub("*:*");
     var queryExecuter = new SolrQueryExecuter<TestDocument>(null, null, querySerializer, null, null);
     var p = queryExecuter.GetAllParameters(SolrQuery.All, new QueryOptions {
         SpellCheck = new SpellCheckingParameters {
             Query = "hell",
             Build = true,
             Collate = true,
             Count = 4,
             Dictionary = "spanish",
             OnlyMorePopular = true,
             Reload = true,
         },
     }).ToList();
     Assert.Contains(p, KV.Create("spellcheck", "true"));
     Assert.Contains(p, KV.Create("spellcheck.q", "hell"));
     Assert.Contains(p, KV.Create("spellcheck.build", "true"));
     Assert.Contains(p, KV.Create("spellcheck.collate", "true"));
     Assert.Contains(p, KV.Create("spellcheck.count", "4"));
     Assert.Contains(p, KV.Create("spellcheck.dictionary", "spanish"));
     Assert.Contains(p, KV.Create("spellcheck.onlyMorePopular", "true"));
     Assert.Contains(p, KV.Create("spellcheck.reload", "true"));
 }
开发者ID:pampero,项目名称:cgFramework,代码行数:24,代码来源:SolrQueryExecuterTests.cs

示例4: GetClusteringParameters

 public void GetClusteringParameters()
 {
     var querySerializer = new SolrQuerySerializerStub("apache");
     var queryExecuter = new SolrQueryExecuter<TestDocument>(null, null, querySerializer, null, null);
     var p = queryExecuter.GetAllParameters(new SolrQuery("apache"), new QueryOptions {
         Clustering = new ClusteringParameters {
             Title = "headline",
             FragSize = 10,
             LexicalResources = "fakedir",
             ProduceSummary = true,
             Algorithm = "org.carrot2.clustering.lingo.LingoClusteringAlgorithm",
             Url = "none",
             Collection = false,
             Engine = "default",
             SubClusters = false,
             Snippet = "synopsis",
             NumDescriptions = 20
         },
     }).ToList();
     Assert.Contains(p, KV.Create("carrot.title", "headline"));
     Assert.Contains(p, KV.Create("clustering.engine", "default"));
     Assert.Contains(p, KV.Create("clustering.collection", "false"));
     Assert.Contains(p, KV.Create("carrot.algorithm", "org.carrot2.clustering.lingo.LingoClusteringAlgorithm"));
     Assert.Contains(p, KV.Create("carrot.url", "none"));
     Assert.Contains(p, KV.Create("carrot.snippet", "synopsis"));
     Assert.Contains(p, KV.Create("carrot.produceSummary", "true"));
     Assert.Contains(p, KV.Create("carrot.fragSize", "10"));
     Assert.Contains(p, KV.Create("carrot.numDescriptions", "20"));
     Assert.Contains(p, KV.Create("carrot.outputSubClusters", "false"));
     Assert.Contains(p, KV.Create("carrot.lexicalResourcesDir", "fakedir"));
 }
开发者ID:pampero,项目名称:cgFramework,代码行数:31,代码来源:SolrQueryExecuterTests.cs

示例5: GetCollapseExpandParameters_Expand

        public void GetCollapseExpandParameters_Expand()
        {
            var querySerializer = new DefaultQuerySerializer(new DefaultFieldSerializer());
            var e = new SolrQueryExecuter<TestDocument>(null, null, querySerializer, null, null);
            var expand = new ExpandParameters(
                sort: new SortOrder("sortField", Order.ASC),
                rows: 100,
                query: new SolrQuery("aquery"),
                filterQuery: null);

            var p = e.GetAllParameters(SolrQuery.All, new QueryOptions {
                Rows = 1,
                CollapseExpand = new CollapseExpandParameters("somefield", expand, null, null),
            }).ToList();
            CollectionAssert.Contains(p, KV.Create("fq", "{!collapse field=somefield}"));
            CollectionAssert.Contains(p, KV.Create("expand.sort", "sortField asc"));
            CollectionAssert.Contains(p, KV.Create("expand.rows", "100"));
            CollectionAssert.Contains(p, KV.Create("expand.q", "aquery"));
        }
开发者ID:jamesbdarcy,项目名称:SolrNet,代码行数:19,代码来源:SolrQueryExecuterTests.cs

示例6: GetCollapseExpandParameters_min_policy

 public void GetCollapseExpandParameters_min_policy()
 {
     var querySerializer = new DefaultQuerySerializer(new DefaultFieldSerializer());
     var e = new SolrQueryExecuter<TestDocument>(null, null, querySerializer, null, null);
     var max = new CollapseExpandParameters.MinOrMax.Max("maxfield");
     var policy = CollapseExpandParameters.NullPolicyType.Collapse;
     var p = e.GetAllParameters(SolrQuery.All, new QueryOptions {
         Rows = 1,
         CollapseExpand = new CollapseExpandParameters("somefield", null, max, policy),
     }).ToList();
     CollectionAssert.Contains(p, KV.Create("fq", "{!collapse field=somefield nullPolicy=collapse max=maxfield}"));
 }
开发者ID:jamesbdarcy,项目名称:SolrNet,代码行数:12,代码来源:SolrQueryExecuterTests.cs

示例7: GetAllParameters_with_multiple_group_queries

 public void GetAllParameters_with_multiple_group_queries()
 {
     var querySerializer = new SolrQuerySerializerStub("*:*");
     var queryExecuter = new SolrQueryExecuter<TestDocument>(null, null, querySerializer, null, null);
     var p = queryExecuter.GetAllParameters(SolrQuery.All, new QueryOptions {
         Grouping = new GroupingParameters {
             Query = new Collection<string> { "apple", "banana", "cherry" }
         }
     }).ToList();
     Assert.Contains(p, KV.Create("group.query", "apple") );
     Assert.Contains(p, KV.Create("group.query", "banana"));
     Assert.Contains(p, KV.Create("group.query", "cherry"));
 }
开发者ID:steven-holmes-uk-parliament,项目名称:SolrNet,代码行数:13,代码来源:SolrQueryExecuterTests.cs

示例8: GetCollapseExpandParameters

 public void GetCollapseExpandParameters()
 {
     var querySerializer = new DefaultQuerySerializer(new DefaultFieldSerializer());
     var e = new SolrQueryExecuter<TestDocument>(null, null, querySerializer, null, null);
     var p = e.GetAllParameters(SolrQuery.All, new QueryOptions {
         Rows = 1,
         CollapseExpand = new CollapseExpandParameters("somefield", null, null, null),
     }).ToList();
     CollectionAssert.Contains(p, KV.Create("fq", "{!collapse field=somefield}"));
 }
开发者ID:jamesbdarcy,项目名称:SolrNet,代码行数:10,代码来源:SolrQueryExecuterTests.cs

示例9: GetAllParameters_with_multiple_group_fields

 public void GetAllParameters_with_multiple_group_fields()
 {
     var querySerializer = new SolrQuerySerializerStub("*:*");
     var queryExecuter = new SolrQueryExecuter<TestDocument>(null, null, querySerializer, null, null);
     var p = queryExecuter.GetAllParameters(SolrQuery.All, new QueryOptions
     {
         Grouping = new GroupingParameters
         {
             Fields = new Collection<string> { "fieldx", "fieldy", "fieldz" }
         }
     }).ToList();
     Assert.Contains(p, KV.Create("group.field", "fieldx"));
     Assert.Contains(p, KV.Create("group.field", "fieldy"));
     Assert.Contains(p, KV.Create("group.field", "fieldz"));
 }
开发者ID:steven-holmes-uk-parliament,项目名称:SolrNet,代码行数:15,代码来源:SolrQueryExecuterTests.cs

示例10: GetAllParameters_with_both_group_fields_and_group_queries

        public void GetAllParameters_with_both_group_fields_and_group_queries()
        {
            var querySerializer = new SolrQuerySerializerStub("*:*");
            var queryExecuter = new SolrQueryExecuter<TestDocument>(null, null, querySerializer, null, null);
            var p = queryExecuter.GetAllParameters(SolrQuery.All, new QueryOptions
            {
                Grouping = new GroupingParameters
                {
                    Query = new Collection<string> { "apple", "banana", "cherry" },
                    Fields = new Collection<string> { "fieldx", "fieldy", "fieldz" }
                }
            }).ToList();

            IEnumerable<string> groupParameters = p.Where(param => param.Key.StartsWith("group.")).Select(param => param.Key);
            Assert.IsEmpty(groupParameters, "The invalid combination of group.fields and group.query should not have generated any group parameters.");
        }
开发者ID:steven-holmes-uk-parliament,项目名称:SolrNet,代码行数:16,代码来源:SolrQueryExecuterTests.cs

示例11: GetQuery

 public Uri GetQuery(ISolrConnection connection, ISolrQuery query, Commands.Parameters.QueryOptions options)
 {
     var executor = new SolrQueryExecuter<object>(null, connection, querySerializer, facetQuerySerializer, null);
     var param = executor.GetAllParameters(query, options);
     return connection.GetQuery(SolrQueryExecuter<object>.DefaultHandler, param);
 }
开发者ID:Jroland,项目名称:SolrNet,代码行数:6,代码来源:SolrQueryBuilderOperation.cs

示例12: ExtraParams

 public void ExtraParams()
 {
     var mocks = new MockRepository();
     var parser = mocks.DynamicMock<ISolrQueryResultParser<TestDocument>>();
     var conn = mocks.DynamicMock<ISolrConnection>();
     var serializer = mocks.StrictMock<ISolrQuerySerializer>();
     With.Mocks(mocks)
         .Expecting(() => Expect.On(serializer)
                              .Call(serializer.Serialize(null))
                              .IgnoreArguments()
                              .Return("123123"))
         .Verify(() => {
             var queryExecuter = new SolrQueryExecuter<TestDocument>(parser, conn, serializer, null, null);
             var p = queryExecuter.GetAllParameters(new SolrQuery("123123"), new QueryOptions {
                 ExtraParams = new Dictionary<string, string> {
                     {"qt", "geo"},
                     {"lat", "40.75141843299745"},
                     {"long", "-74.0093994140625"},
                     {"radius", "1"},
                 }
             }).ToDictionary(x => x.Key, x => x.Value);
             Assert.AreEqual("123123", p["q"]);
             Assert.AreEqual("geo", p["qt"]);
             Assert.AreEqual("1", p["radius"]);
         });
 }
开发者ID:paulcarroll,项目名称:SolrNet,代码行数:26,代码来源:SolrQueryExecuterTests.cs

示例13: MoreLikeThis

 public void MoreLikeThis()
 {
     var mocks = new MockRepository();
     var parser = mocks.DynamicMock<ISolrQueryResultParser<TestDocument>>();
     var conn = mocks.DynamicMock<ISolrConnection>();
     var querySerializer = new SolrQuerySerializerStub("apache");
     var queryExecuter = new SolrQueryExecuter<TestDocument>(parser, conn, querySerializer, null, null);
     var p = queryExecuter.GetAllParameters(new SolrQuery("apache"), new QueryOptions {
         MoreLikeThis = new MoreLikeThisParameters(new[] {"manu", "cat"}) {
             MinDocFreq = 1,
             MinTermFreq = 1,
         },
     }).ToList();
     Assert.Contains(p, KV.Create("mlt", "true"));
     Assert.Contains(p, KV.Create("mlt.mindf", "1"));
     Assert.Contains(p, KV.Create("mlt.fl", "manu,cat"));
     Assert.Contains(p, KV.Create("mlt.mintf", "1"));
     Assert.Contains(p, KV.Create("q", "apache"));
 }
开发者ID:paulcarroll,项目名称:SolrNet,代码行数:19,代码来源:SolrQueryExecuterTests.cs


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