将 LocalParams 与 SolrMultipleCriteriaQuery 结合起来?
有谁知道如何结合 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该能够将
LocalParams
添加到SolrMultipleCriteriaQuery
。You should be able to add the
LocalParams
to theSolrMultipleCriteriaQuery
.