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
Posted by Alexander Veremyev (alexander) on 2009-03-18T09:58:49.000+0000
'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.
Posted by Snakehit (snakehit) on 2009-04-15T06:05:33.000+0000
This is still an issue in v1.8.0PR. Any idea when this will be fixed?
Posted by Rob Allen (rob) on 2012-11-20T20:52:42.000+0000
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.