Search different tokens on different fields in Solr

对着背影说爱祢 提交于 2020-01-06 02:36:10

问题


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.

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.

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

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.

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!


回答1:


I think that you should do any of those two:

  1. do this externally and send solr the right url
  2. or do this in solr but inside a query parser, not a tokenizer


来源:https://stackoverflow.com/questions/11314250/search-different-tokens-on-different-fields-in-solr

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!