lucene 3.0.3 | phrase query problem
开发者_运维知识库searchString = "i am using sql. server setting is easy task.";
while i am searching for phrase query "Sql Server" in above string it gives result which is not correct. As In the above string sql and server is seperated by dot(.)
using both PhraseQuery and SpanQuery gives same result.
Any suggestion will be appreciated!!!
You can write an analyzer, which will treat dots as tokens, so you will get 3 tokens - "sql", "." (dot) and "server" (I'm not aware about any existent analyzers, that can do it). But it may effect in unpredictable results, so I recommend you to just ignore this rare case. If it's not an option and your program heavily uses lexical structure of the text, I'll suggest using some natural language processing tools like GATE instead of Lucene.
精彩评论