开发者

PrefixQuery case sensitive?

I have an untokenized field in index file. I'm using PrefixQuery to get the values. I'm using this for auto suggesting(When i give the keyword it will start suggesting the relevant data).

For Example: The field name is 'Country'. It has the list of countries as values like Australia, America, India, Singapore, South Africa, New Zealand...(With Title Case)

When I give the query string(input) as 'a', It is not suggesting any countries.. Instead if i give 'A' means it is suggesting Australia, America...

How can I overcome this Case problem? What is wrong with this??

Your help is appr开发者_运维技巧eciated...

Thanks

Perumal A S


From http://wiki.apache.org/lucene-java/LuceneFAQ#Are_Wildcard.2C_Prefix.2C_and_Fuzzy_queries_case_sensitive.3F

Are Wildcard, Prefix, and Fuzzy queries case sensitive?

No, not by default. Unlike other types of Lucene queries, Wildcard, Prefix, and Fuzzy queries are not passed through the Analyzer, which is the component that performs operations such as stemming and lowercasing. The reason for skipping the Analyzer is that if you were searching for "dogs*" you would not want "dogs" first stemmed to "dog", since that would then match "dog*", which is not the intended query. These queries are case-insensitive anyway because QueryParser makes them lowercase. This behavior can be changed using the setLowercaseExpandedTerms(boolean) method.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜