How to remove hyphen token in lucene.net
I'm having problem with h开发者_JAVA技巧yphen when searching. I thinks its because of the Standard Analyzer that I use.
How can I remove that hypen as part of the standard analyzer tokens?
The StandardAnalyzer
does indeed break up words with hyphens. What type of data are you indexing? Can you change the analyzer to something else? The KeywordAnalyzer
wont break up words at all, and the WhitespaceAnalyzer
will only break on whitespace characters (spaces, newlines, tabs, ...)
You can use the PerFieldAnalyzerWrapper
if you need to use several analyzers within a document/query.
Custom Tokenizer would fit your criteria. Please refer, http://karticles.com/NoSql/lucene_custom_tokenizer.html
精彩评论