Share » Forums » Extensions » eZ Find » ezFind 2.2 - sort by name issue

ezFind 2.2 - sort by name issue

ezFind 2.2 - sort by name issue

Wednesday 30 June 2010 12:59:01 am - 4 replies

Author Message

Ivo Lukac

Wednesday 30 June 2010 1:23:29 am

Seems like a bug...

And it is: http://issues.ez.no/IssueView.php?Id=15423&activeItem=1

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Fabien Mas

Wednesday 30 June 2010 2:07:38 am

Ok

I have to wait then :)

thanks for your help

Ivo Lukac

Wednesday 30 June 2010 6:20:26 am

You can write a comment on that issue. Then developers will know that more people have that problem and maybe they speed up resolving.

Maybe :)

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Paul Borgermans

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

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu