在 Solr 中的不同字段上搜索不同的令牌 [英] Search different tokens on different fields in Solr

查看:27
本文介绍了在 Solr 中的不同字段上搜索不同的令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 Apache Solr 3.6 中编写一个自定义标记器,它将尝试识别某些类型的标记,并根据它们在不同字段上的类型搜索.

I'd like to write a custom tokenizer in Apache Solr 3.6, that will try to identify certain types of tokens and depending on their type search on different fields.

例如,如果搜索是 2in 螺丝,我会让自定义标记器识别 2in 指的是一个值和度量单位,并且 螺丝指的是一个类别.

For example, if the search were for 2in screw, I would have the custom tokenizer identify that 2in refers to a value and unit of measure and that screw refers to a category.

然后我想将搜索限制在度量字段中的in"和类别字段中的screw".

I would then want to limit the search to "in" in the measure field and "screw" in the category field.

我意识到这可以通过从外部分解条款然后形成查询并将其传递到 Solr 来完成,但是我想知道完全使用 Solr 分析器完成此操作的最佳方法是什么.

I realize that this can be done be externally breaking apart the terms and then forming the query and passing it into Solr, however I am wondering what would be the best way to do this entirely with Solr Analyzers.

请告诉我,如果您认为这是应该在 Solr 上完成的,或者最好先使用外部标记器准备数据.感谢您的任何建议!

Please let me know if you think this is even should be done is Solr, or if it would be better to first prepare the data with an external tokenizer. Thanks for any advice!

推荐答案

我认为你应该做这两个中的任何一个:

I think that you should do any of those two:

  1. 在外部执行此操作并向 solr 发送正确的 url
  2. 或者在 solr 中但在查询解析器中执行此操作,而不是标记器

这篇关于在 Solr 中的不同字段上搜索不同的令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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