We have a set of documents - which have a standard set of fields. However they can also have an arbitary number of custom fields which may each have a value. So some docs may look like
id: 1 title: Document 1 created: 2010-10-09 15:23:00 custom_fields: - foo : 5 - bar : 6 id: 2 title: Document 2 created: 2010-10-07 12:23:00 custom_fields: - bar : 3 - quux : 2 id: 3 title: Document 3 created: 2010-09-18 09:11:00 custom_fields: - foo : 9 - quux : 1 The problem is that we'd like to sort on the custom field. I did have the thought that maybe I could turn custom field into a multivalued field and then collapse the fields and then sort them lexically custom_fields: [ foo_5, bar_6 ] but, of course, it's not possible to sort a multi valued field. So, is there a possible workaround? Install some plugin? Use a sort function? Thanks, Simon