I just noticed that the Zend lucene implementation has a default analyzer that can be modified using Zend_Search_Lucene_Analysis_Analyzer::setDefault()
, but I couldn't find a way to override that default when performing a query. Do I really need to reset the default analyzer if I'm working on multiple indexes or am I missing a function?
views:
104answers:
2
+1
A:
In the original Java API for Lucene, QueryParser
takes an analyzer
argument. I'm not sure why they decided to use a global variable in Zend Framework, but apparently setting the analyzer globally is the only way to do it.
Lukáš Lalinský
2009-10-16 13:10:02
Thanks, I guess the API is just stupid.
soulmerge
2009-11-02 09:20:40
A:
I use the TextNum analyzer because the default (Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive
) doesn't allow searching by integers.
To override the default, I run:
Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum());
Derek Gathright
2009-10-19 21:16:51