Monday 05 July 2010 11:00:48 am
Indeed, The default field type for the "name" meta data is "text" which cannot be used to sort (it is split in multiple terms which causes the error you see) However the following recipe will help you: You can add a schema definition in schema.xml that does a copyfield from "meta_name_t" to "meta_name_s" (of type string) and use the latter for sorting So in schema.xml add a new field definition in the <fields> section <field name="meta_name_s" type="string" indexed="true" stored="false" />
Then add a copyfield construct: <copyField source="meta_name_t" dest="meta_name_s"/>
Finally reindex your site (needed with amost all schema changes) and then modify your fetch functions as follows:
{def $params=hash( 'query', $searchtext,
'limit',$limit,
'sort_by', hash('meta_name_s', 'asc'),
'offset',$offset,
'subtree_array', array($node.node_id),
'class_id',$classid)}
{def $resultats=fetch( 'ezfind', 'search',$params)} That should be it hth Paul PS: from eZfind 2.3 it should not be needed to do this as you can already do for regular attributes: specify different field types for search, sort, facet and filter
eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans
|