Zend_Search_Lucene range request error

I set each document with a date field. (Keyword)

The values ​​stored in it are in this format; 20100511

Every time I try to execute a range request, I get the following error:

date:[10000000 TO 20000000]

At least one boundary range query term must be a non-empty member

Anyone got it?

Update

I got this to work programmatically. Does this mean that the parser is not working?

$from  = new Zend_Search_Lucene_Index_Term('10000000', 'dateOfBirthMod');
$to    = new Zend_Search_Lucene_Index_Term('20000000', 'dateOfBirthMod');
$query = new Zend_Search_Lucene_Search_Query_Range($from, $to, true);
+3
source share
4 answers

- ( btw). , , x.x ZF.

+2

, , . , . , . . http://framework.zend.com/manual/en/zend.search.lucene.extending.html

, ,

Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive());

Zf 1.x Zf 2.x

Zend\Search\Lucene\Analysis\Analyzer\Analyzer::setDefault(new Zend\Search\Lucene\Analysis\Analyzer\Common\TextNum\CaseInsensitive());
+3

, , tokenize(), Zend/Search/Lucene/Analysis/Analyzer.php

, ZF (1.10.7).

public function tokenize($data, $encoding = '')
{
    $this->setInput($data, $encoding);

    $tokenList = array();
    /*
    while (($nextToken = $this->nextToken()) !== null) {
        $tokenList[] = $this->_input;
    }
    */
        $tokenList[] = new Zend_Search_Lucene_Analysis_Token( $this->_input, 1, 1 );

    return $tokenList;
}

, .

+1

-, TextNum,

ZF2:

\ZendSearch\Lucene\Analysis\Analyzer\Analyzer::setDefault(new \ZendSearch\Lucene\Analysis\Analyzer\Common\TextNum\CaseInsensitive());

Secondly, your date field should be a keyword, not text.

0
source

Source: https://habr.com/ru/post/1744967/


All Articles