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



I'm trying to use the sorting mechanism of Zend_Search_Lucene from following documentation:…

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


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 "
    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"); 


'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.