将 LocalParams 与 SolrMultipleCriteriaQuery 结合起来?

发布于 2024-12-10 16:43:49 字数 1507 浏览 1 评论 0原文

有谁知道如何结合 SolrMultipleCriteriaQuery 和 LocalParams (在 SOLRnet 中)

我已经尝试过类似的事情(不用担心代码不好,它只是为了测试)

         var test = solr.Query(BuildQuery(parameters), new QueryOptions
                        {
                            FilterQueries = getFilterQueries(),
                            Facet = new FacetParameters
                            {
                                Queries = new[] { 
                    new SolrFacetFieldQuery(new LocalParams {{"ex", "dt"}} + "ju_success") , new SolrFacetFieldQuery(new LocalParams {{"ex", "dt"}} + "dr_success") 
                }
                            }
                        });
    ...

         public ICollection<ISolrQuery> getFilterQueries()
                {
//Creating a List of SolrQueries
                    List<ISolrQuery> ISolrQueryList = new List<ISolrQuery>();

//Adding a new SolrQuery to the List. The Solr Query is contains Parameters for multi select
                    ISolrQueryList .Add(new LocalParams { { "tag", "dt" } } + Query.Field("dr_success").Is("simple"));

//Creating the MultipleCriteriaQuery and setting the Operator "OR"
                    var NewMultipleCriteriaQuery = new SolrMultipleCriteriaQuery(ISolrQueryList , "OR");

//Creating the Resultlist
List<ISolrQuery> Resultlist= new List<ISolrQuery>();
Resultlist.Add(NewMultipleCriteriaQuery);
    return Resultlist();
        }

我尝试做的是带有“OR”运算符的多选择面。

感谢您的帮助!

does any body know how to combine SolrMultipleCriteriaQuery and LocalParams (in SOLRnet)?

I've tried things like thad (don't worry about bad the code, its just to test)

         var test = solr.Query(BuildQuery(parameters), new QueryOptions
                        {
                            FilterQueries = getFilterQueries(),
                            Facet = new FacetParameters
                            {
                                Queries = new[] { 
                    new SolrFacetFieldQuery(new LocalParams {{"ex", "dt"}} + "ju_success") , new SolrFacetFieldQuery(new LocalParams {{"ex", "dt"}} + "dr_success") 
                }
                            }
                        });
    ...

         public ICollection<ISolrQuery> getFilterQueries()
                {
//Creating a List of SolrQueries
                    List<ISolrQuery> ISolrQueryList = new List<ISolrQuery>();

//Adding a new SolrQuery to the List. The Solr Query is contains Parameters for multi select
                    ISolrQueryList .Add(new LocalParams { { "tag", "dt" } } + Query.Field("dr_success").Is("simple"));

//Creating the MultipleCriteriaQuery and setting the Operator "OR"
                    var NewMultipleCriteriaQuery = new SolrMultipleCriteriaQuery(ISolrQueryList , "OR");

//Creating the Resultlist
List<ISolrQuery> Resultlist= new List<ISolrQuery>();
Resultlist.Add(NewMultipleCriteriaQuery);
    return Resultlist();
        }

What I try to do are multi-select-facets with a "OR" operator.

Thanks for all the help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

跨年 2024-12-17 16:43:49

您应该能够将 LocalParams 添加到 SolrMultipleCriteriaQuery

public ISolrQuery GetFilterQueries()
{
    List<ISolrQuery> iSolrQueryList = new List<ISolrQuery>();
    iSolrQueryList.Add(Query.Field("dr_success").Is("simple"));
    iSolrQueryList.Add(Query.Field("dr_success2").Is("simple2"));
    return new LocalParams { { "tag", "dt" } } + new SolrMultipleCriteriaQuery(iSolrQueryList, "OR");
}

You should be able to add the LocalParams to the SolrMultipleCriteriaQuery.

public ISolrQuery GetFilterQueries()
{
    List<ISolrQuery> iSolrQueryList = new List<ISolrQuery>();
    iSolrQueryList.Add(Query.Field("dr_success").Is("simple"));
    iSolrQueryList.Add(Query.Field("dr_success2").Is("simple2"));
    return new LocalParams { { "tag", "dt" } } + new SolrMultipleCriteriaQuery(iSolrQueryList, "OR");
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文