Issues

ZF-5924: Zend_Search_Lucene_Exception' with message 'Wrong field name.

Description

Hi,

I'm trying to use the sorting mechanism of Zend_Search_Lucene from following documentation: http://framework.zend.com/manual/en/…


$index = Zend_Search_Lucene::open(path/to/lucene);
$list = $index->find("12","id", SORT_NUMERIC, SORT_DESC);   

Result:


Fatal error: Uncaught exception 'Zend_Search_Lucene_Exception' with message 'Wrong field name.' in /home/httpd/tools/library/Zend-1.7.5/Search/Lucene.php:935

When I watch on that line and print some output like these


if (!in_array($fieldName, $fieldNames)) {
   echo "
";
    print_r($fieldName);
    echo "
"; die(); throw new Zend_Search_Lucene_Exception('Wrong field name.'); } result: SORT_NUMERIC

SORT_NUMERIC isn't a field but a sorting type...

Note: Searching with following code works (without sorting)


$index = Zend_Search_Lucene::open(path/to/lucene);
$list = $index->find("12"); 

Comments

'id' is not actually a field in terms of index structure and currently not supported for result set sorting. But it's good idea to add it.

This is still an issue in v1.8.0PR. Any idea when this will be fixed?

Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".

Feel free to re-open and provide a patch if you want to fix this issue.