This site has been archived. To learn more about our current products Ibexa Content, Ibexa Experience, Ibexa Commerce head over to the Ibexa Developer Portal

eZ Community » Forums » Extensions » eZ Find » Sort fields
expandshrink

Sort fields

Sort fields

Wednesday 10 March 2010 11:44:28 am - 6 replies

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

Wednesday 10 March 2010 2:25:45 pm

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=ezpublish&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 happy.gif Emoticon )

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 !

Wednesday 10 March 2010 2:37:04 pm

To add further insight to Nico's helpful explanation:

  • currently it is hard to extend ezfind to add custom indexed/searchable meta-fields on a per-class basis (there are open feature requests open for that)
  • however it is possible to extend ezfind to set up custom handlers that will generate sub-attributes to be indexed for existing attributes
  • thus you can add a 'fake' attribute to your classes, write a subattribute-indexing-handler for it, and let it produce the desired meta-fields to be indexed (login_count, last_visit, etc...)
  • if this is not crystal clear, I can provide an example where we did index the view_count of objects

Wednesday 10 March 2010 3:05:33 pm

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 happy.gif Emoticon

Wednesday 10 March 2010 4:13:23 pm

@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 happy.gif Emoticon

Thursday 11 March 2010 11: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

Thursday 11 March 2010 12:17:07 pm

Ok Paul,

I added my use-case

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from