Forums / Extensions / eZ Find / Sort fields
Matthieu Sévère
Wednesday 10 March 2010 2:44:28 am
Hello,
is there any way to sort ezfind search by an attribute that is not in the data_map and not classic ones like published, ..
In my case, I search only users and I'd like to sort on "login_count" and "last_visit".
I didn't find any way to do this for now ...
-- eZ certified developer: http://ez.no/certification/verify/346216
Nicolas Pastorino
Wednesday 10 March 2010 5:25:45 am
Hello Matthieu,
The only way to achieve this is to make sure the attributes you want to sort on are indexed. Is this the case for login_count and last_visit ? You can check this by directly requesting the Solr backend, and inspecting what attributes/fields are there : http://localhost:8983/solr/select?q=&qt=Exponential&fl=*
Then, once they are indexed, the next step is to make sure the given sort field is understood by the query builder in eZ Find. Content attributes and default metadata fields ( "published", "modified",... ) are taken into account. This could be a nice addition to be able to push custom ( metadata ) fields at the class level ( http://issues.ez.no/ezfind :) )
Finally, the field you want to sort needs to be understood by Solr as being a Sortable field. You can verify this based on the field type associated to the attribute you want to sort by, and its definition in schema.xml. Not all filedTypes are sortable.
Let us know how it goes !
-- Nicolas Pastorino Director Community - eZ Member of the Community Project Board eZ Publish Community on twitter: http://twitter.com/ezcommunity t : http://twitter.com/jeanvoye G+ : http://plus.tl/jeanvoye
Gaetano Giunta
Wednesday 10 March 2010 5:37:04 am
To add further insight to Nico's helpful explanation:
Principal Consultant International Business Member of the Community Project Board
Wednesday 10 March 2010 6:05:33 am
Good points Gaetano. I could spot this related feature request :http://issues.ez.no/IssueView.php?Id=15159&activeItem=1
Did you have others in mind ?
Please comment on the issue above to add use cases, per Paul's request. This is a very useful feature imho. Was discussing the same subject this morning on IRC with Bratt & Carlos. It is a hot topic :)
Wednesday 10 March 2010 7:13:23 am
@Nicolas : for your first post, the attributes are not indexed ...
@Gaetano :
You mean for example add an handler for the user_account datatype and add new meta-data for login_count ? Sounds nice :)
Paul Borgermans
Thursday 11 March 2010 2:04:46 am
As we are in feature freeze now, this won't be added to eZ Find 2.2, sorry
However, similar requests for adding additional meta-data (including custom ones, typically introduced with extensions) have been discussed internally and will most certainly make it in a subsequent release.
Please add your use-cases to the issue tracker, so we can have a comprehensive spec before starting development:
http://issues.ez.no/IssueView.php?Id=15159&activeItem=1
I'll come back soon with specs for this and other new features for eZ Find (like an archive function)
Cheers
Paul
eZ Publish, eZ Find, Solr expert consulting and training http://twitter.com/paulborgermans
Thursday 11 March 2010 3:17:07 am
Ok Paul,
I added my use-case