[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: [ldapext] Sorted attribute values



Richard Megginson wrote:
This could possibly solve a problem for many LDAP users - how to store a list of multiple values in order and have the server return them in the same order.

This is a related but different problem, of course. In this case all you care about is that a static ordering is preserved. I.e., the client stores values in a fixed order and wants them returned in the same order. For the "sorted values" problem we're looking for a dynamic ordering - the client stores values in an arbitrary order and the server rearranges them into a desired order. Another aspect I forgot to mention is that for weighted sorting, it's possible for multiple values to have the same weight, and you can configure a secondary sort as well (where the secondary is one of the other 4 sort types) to handle this case.


Which reminds me, we already have a solution for the static ordering problem in OpenLDAP 2.3, adding an "X-ORDERED 'VALUES'" extension to the schema definition of the attributeTypes that need it. In this case, we also add a {xx} prefix to all of the values of the attribute, but this prefix is managed automatically by slapd, is always numbered consecutively starting from zero, and is always returned in search responses. Pretty sure I posted a full description to this list a few months back, but I may be misremembering. The other important aspect of this feature is that it allows equality matching of values by prefix. Matching by prefix is significant to us because it allows one to ldapmodify/Delete specific values by their ordinal position, instead of (or in addition to) their actual value. I mainly use this just to avoid having to specify long values for deletions, but this also means we can delete specific values of multivalued attributes even if they have no equality matching rule. Likewise we can provide prefixes on Add modifications to insert elements at the specified positions within an existing sequence of values. Another (mostly uninteresting) side effect of prefix matching is that one can search for e.g. "all attributes that have 5 values" by filtering on the prefix.

There is another possibility "X-ORDERED 'SIBLINGS'" that we use as well, to preserve the order of peer entries with the same naming attribute. This feature is not quite as well-defined; we only use it with single-valued RDNs and there are plenty of corner cases I haven't thought about.

--
  -- Howard Chu
  Chief Architect, Symas Corp.  http://www.symas.com
  Director, Highland Sun        http://highlandsun.com/hyc
  OpenLDAP Core Team            http://www.openldap.org/project/

_______________________________________________
Ldapext mailing list
Ldapext@ietf.org
https://www1.ietf.org/mailman/listinfo/ldapext