问题
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:
- do this externally and send solr the right url
- 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