开发者

lucene 3.0.3 | phrase query problem

开发者 https://www.devze.com 2023-02-11 00:07 出处:网络
开发者_运维知识库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

开发者_运维知识库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.

0

精彩评论

暂无评论...
验证码 换一张
取 消