Solr Criterian方法在Spring Boot中以优先考虑标准,但还带来其他记录
我想在Spring应用程序中为Solr查询设置标准。有什么方法可以优先考虑我的标准,然后按常规顺序进行剩余的记录?我尝试使用:
filterQuery.addCriteria(new Criteria("type").is("abc"));
query.addFilterQuery(filterQuery);
query.setRows(10); // records limit
return query;
如果有5个匹配记录,其中type> type
is ABC
,Solr只会返回这5个记录。但是我想要的是填充10个限制,并在设定的任何标准上相应地获得其余记录。因此,根据标准和剩余的记录,我有5个记录。
我知道,是
的方法是不可能的。有什么方法可以帮助我解决自己的方案吗?
I want to set a criteria for solr query in spring application. Is there any way to prioritize my criteria first and then bring remaining records in regular order? I have tried using:
filterQuery.addCriteria(new Criteria("type").is("abc"));
query.addFilterQuery(filterQuery);
query.setRows(10); // records limit
return query;
Now if there are 5 matching records where type
is abc
, the solr will return me just these 5 records. But what I want is to fill the limit which is 10 and get the remaining records accordingly with out any criteria being set. So that I have 5 records according to the criteria and remaining records in a regular order.
I know this can not be possible with is
method of the criteria. Is there any method which could help me with my scenario?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,可以做到这一点,但这不是这样做的非常有效的方法。
因此,为了获取与标准匹配的这些项目,然后再剩下的项目,您可以向Solr查询两次。在第一个查询中,您可以设置希望数据像已经完成的数据的标准:
然后,您可以再次配置此条件,这样,这次,Solr只能带上那些
>> code>的项目不要
匹配标准。您可以这样做:这样,您可以实现所需的结果。
同样,这不是一种非常有效的方法,而是有效的。
Well there is a way in which this can be done but this is not a very efficient way for doing this.
So in order to fetch those items, which match the criteria, first and then remaining items later on, you can query twice to solr. In the first query, you can set the criteria against which you want the data to be fetched Like you already have done:
And then, you can again configure this criteria such that, this time, Solr should only bring those items which
do not
match the criteria. You may do this like:In this way, you may achieve your desired result.
Again, Its not a very efficient way but it works.