It seems to me that Zend Search Lucene is default to case sensitive search. Is there a way to change this so that all queries are case insensitive?
Asked
Active
Viewed 1,144 times
1 Answers
1
Zend Search Lucene should default to case-insensitive (from documentation):
You can assign your own text analyzer or choose it from the set of predefined analyzers:
Zend_Search_Lucene_Analysis_Analyzer_Common_Text
andZend_Search_Lucene_Analysis_Analyzer_Common_Text_CaseInsensitive
(default). Both of them interpret tokens as sequences of letters.Zend_Search_Lucene_Analysis_Analyzer_Common_Text_CaseInsensitive
converts all tokens to lower case.
You might have
Zend_Search_Lucene_Analysis_Analyzer::setDefault(
new Zend_Search_Lucene_Analysis_Analyzer_Common_Text()
);
Set somewhere, which is switching it to case sensitive. You can try to find and remove that, or switch analyzers.

Ben D
- 14,321
- 3
- 45
- 59
-
Yeah I thought that it defaulted to case-insensitive but when I tried searching, it was case-sensitive. Will try your solution – developarvin Sep 21 '12 at 02:36
-
I var_dumped the default Analyzer and sure enough, it is Zend_Search_Lucene_Analysis_Analyzer_Common_Text_CaseInsensitive. However, the search still is case-sensitive. Here are some things that I speculate that might cause the problem, (1)index insertion process (2)type of the index fields – developarvin Sep 21 '12 at 06:48
-
It looks like there may be some useful information here (similar question) - http://stackoverflow.com/questions/5512803/how-to-make-lucene-be-case-insensitive – Ben D Sep 21 '12 at 15:00
-
1I outputted the default Analyzer using `Zend_Search_Lucene_Analysis_Analyzer::getDefault()` and I got this `Zend_Search_Lucene_Analysis_Analyzer_Common_Text_CaseInsensitive Object ( [_position:Zend_Search_Lucene_Analysis_Analyzer_Common_Text:private] => [_filters:Zend_Search_Lucene_Analysis_Analyzer_Common:private] => Array ( [0] => Zend_Search_Lucene_Analysis_TokenFilter_LowerCase Object ( ) ) [_input:protected] => [_encoding:protected] => )` Seems to be defaulting to lowercase – developarvin Sep 24 '12 at 06:01