Zend_Search_Lucene - 通配符搜索和“数字”字符串的奇怪行为

时间:2012-03-05 10:59:29

标签: string zend-framework integer wildcard zend-search-lucene

我每次搜索“11.11”或“22.22”等时都会遇到奇怪的问题...如果我搜索“aa.aa”没问题但是当我只将整数放入我的字符串时,我得到以下异常:< / p>

  

仅支持非多字词的

通配符搜索

我的Zend搜索实现如下(ZF 1.11):

Zend_Search_Lucene_Search_Query_Wildcard::setMinPrefixLength(0);

Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
Zend_Search_Lucene_Analysis_Analyzer::setDefault(
    new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive()
);

$index = Zend_Search_Lucene::open(APPLICATION_PATH.'/../var/search');

if(str_word_count($searchQuery) > 1){

    $searchQuery = Zend_Search_Lucene_Search_QueryParser::escape($searchQuery);

    $searchQueryArray = explode(' ', $searchQuery);
    $query = new Zend_Search_Lucene_Search_Query_Phrase($searchQueryArray);
}else{

    $searchQuery = Zend_Search_Lucene_Search_QueryParser::escape($searchQuery);

    $query = Zend_Search_Lucene_Search_QueryParser::parse(
        'title:*'.$searchQuery.'* OR
        description:*'.$searchQuery.'* OR 
        content:*'.$searchQuery.'*'
    );
}

$result = $index->find($query);

我无法在互联网上找到任何相关问题所以请告诉我你是否曾经遇到类似的问题。谢谢。

0 个答案:

没有答案