开发者

Zend Search Lucene numeric wildcard issue

开发者 https://www.devze.com 2023-02-28 16:38 出处:网络
I am using an implementation of Zend Lucene Search for a project, and like many beginners realized straight off that numbers weren\'t indexed. So with some searching, I figured out how to change the a

I am using an implementation of Zend Lucene Search for a project, and like many beginners realized straight off that numbers weren't indexed. So with some searching, I figured out how to change the analyzer to include numbers using:

Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_T开发者_如何学运维extNum_CaseInsensitive());

But although numbers are working now, they are not being seen as 'text' (that is, by definition of ($this->_pattern->text). So if I try to perform a wildcard search using, say, 20234* (or even 'C13A*' - anything in which a number appears as one of the 3 preceding characters) an exception is returned:

'At least 3 non-wildcard characters are required at the beginning of pattern' ... in wildcard.php

The last time I checked, numbers are NOT wildcard characters!

I have seen some others using the analyzer fix above to allow numbers to be indexed, and they do not have this problem in their search. Entering 20234* actually works in their case.

Unfortunately, nobody seems to know how to troubleshoot/change this behavior, and I have read through a lot of search content only to realize that I definitely need help with this one.

One other thing I tried was to simply change the requirement (in wildcard.php) to '0', which eliminates that error (albeit in a bad way), but brings up a new one:

'Terms per query limit is reached' in ... wildcard.php

Even if each number is being treated as a separate term, I don't see how 20234* could breach a query limit.

So of course I could change the $maxTerms variable now, but obviously this is not a solution, and likely would create operational issues / more errors.

0

精彩评论

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