Solr:在多个字段中搜索,但如果找到匹配的文档,则停止 [英] Solr: Search in multiple fields BUT STOP if documents match was found

查看:73
本文介绍了Solr:在多个字段中搜索,但如果找到匹配的文档,则停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Solr中搜索多个字段. (在知道复制字段的概念的同时,我也知道(e)dismax搜索处理程序.)

I want to search in multiple fields in Solr. (In know the concept of the copy-fields and I know the (e)dismax search handler.)

所以我有一个有序的字段列表,我希望搜索这些术语. 1.)SKU 2.)名称 3.)说明 4.)总结 等等.

So I have an orderd list of fields, I want the terms to be searched against. 1.) SKU 2.) Name 3.) Description 4.) Summary and so on.

现在,当查询与术语匹配时,例如在SKU字段中,我希望该匹配且在后续字段中不再搜索.

Now, when the query matches a term, let's say in the SKU field, I want this match and no further searches in the proceeding fields.

仅,如果在第一个字段(SKU字段)中根本没有匹配项,则应使用第二个字段(在这种情况下为名称"),依此类推.

Only, if there are NO matches at all in the first field (SKU field), the second field (in this case "name") should be used and so on.

Solr可以做到吗? 为此,我是否必须实现自己的Lucene搜索处理程序?

Is this possible with Solr? Do I have to implement my own Lucene Search Handler for this?

欢迎任何建议!

谢谢你, 伯恩哈德

推荐答案

我认为您的情况需要执行4种不同的搜索.如果您实施自己的SearchHandler,则可以避免在4个不同的请求中累积搜索结果.也就是说,您将发送一个查询,而自定义SearchHandler将执行4个搜索并准备一个结果集.

I think your case requires executing 4 different searches. If you implement you very own SearchHandler you could avoid penalty of search result accumulation in 4 different request. Which means, you would send one query, and custom SearchHandler would execute 4 searches and prepare one result set.

这篇关于Solr:在多个字段中搜索,但如果找到匹配的文档,则停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆