From 45e11c134924a356e695ad99db6ef20de90f3063 Mon Sep 17 00:00:00 2001
From: Quanah Gibson-Mount <quanah@openldap.org>
Date: Wed, 3 Sep 2008 19:56:45 +0000
Subject: [PATCH] valsort overlay section.

---
 doc/guide/admin/aspell.en.pws | 96 ++++++++++++++++++-----------------
 doc/guide/admin/overlays.sdf  | 73 ++++++++++++++++++++++++--
 2 files changed, 119 insertions(+), 50 deletions(-)

diff --git a/doc/guide/admin/aspell.en.pws b/doc/guide/admin/aspell.en.pws
index d0c8c74f05..69939d9070 100644
--- a/doc/guide/admin/aspell.en.pws
+++ b/doc/guide/admin/aspell.en.pws
@@ -1,4 +1,4 @@
-personal_ws-1.1 en 1666 
+personal_ws-1.1 en 1668 
 commonName
 bla
 Masarati
@@ -6,8 +6,8 @@ subjectAltName
 api
 usnCreated
 BhY
-olcSyncRepl
 olcSyncrepl
+olcSyncRepl
 adamsom
 adamson
 CER
@@ -39,8 +39,8 @@ DIB
 dev
 reqNewSuperior
 librewrite
-memberof
 memberOf
+memberof
 BSI
 updateref
 buf
@@ -66,6 +66,7 @@ postread
 csn
 checkpass
 xvfB
+laura
 neverDerefaliases
 dns
 DN's
@@ -89,8 +90,8 @@ dlopen
 eng
 AttributeValue
 attributevalue
-DUA
 EOF
+DUA
 inputfile
 DSP
 refreshDone
@@ -126,10 +127,10 @@ iff
 contextCSN
 auditModify
 auditSearch
-OpenLDAP
 openldap
-resultcode
+OpenLDAP
 resultCode
+resultcode
 sysconfig
 indices
 blen
@@ -168,13 +169,13 @@ argv
 kdz
 notAllowedOnRDN
 hostport
-StartTLS
 starttls
+StartTLS
 ldb
 servercredp
 ldd
-IPv
 ipv
+IPv
 hyc
 joe
 bindmethods
@@ -206,8 +207,8 @@ libpath
 acknowledgements
 jts
 createTimestamp
-MIB
 LLL
+MIB
 OpenSSL
 openssl
 LOF
@@ -247,10 +248,10 @@ Subbarao
 aeeiib
 oidlen
 submatches
-PEM
 olc
-OLF
+PEM
 PDU
+OLF
 LDAPSchemaExtensionItem
 auth
 Pierangelo
@@ -266,8 +267,8 @@ cleartext
 numattrsets
 requestDN
 caseExactSubstringsMatch
-NSS
 PKI
+NSS
 olcSyncProvConfig
 ple
 NTP
@@ -290,9 +291,9 @@ rdn
 wZFQrDD
 OTP
 olcSizeLimit
-PRD
-sbi
 pos
+sbi
+PRD
 pre
 sudoadm
 stringal
@@ -312,8 +313,8 @@ bvec
 HtZhZS
 TBC
 stringbv
-SHA
 Sep
+SHA
 ptr
 conn
 pwd
@@ -330,8 +331,8 @@ myOID
 supportedSASLMechanism
 supportedSASLmechanism
 realnamingcontext
-UCD
 SMD
+UCD
 keytab
 portnumber
 uncached
@@ -344,8 +345,8 @@ sasldb
 UCS
 searchDN
 keytbl
-UDP
 tgz
+UDP
 freemods
 prepend
 nssov
@@ -363,22 +364,22 @@ crit
 objectClassViolation
 ssf
 ldapfilter
-vec
-TOC
 rwm
+TOC
+vec
 pwdChangedTime
 tls
 peernamestyle
 xpasswd
-SRP
 tmp
+SRP
 SSL
 dupbv
 CPUs
 SRV
 entrymods
-sss
 rwx
+sss
 reqNewRDN
 nopresent
 rebindproc
@@ -439,8 +440,8 @@ pseudorootdn
 MezRroT
 GDBM
 LIBRELEASE
-DSA's
 DSAs
+DSA's
 realloc
 booleanMatch
 compareTrue
@@ -500,8 +501,8 @@ pwdMinLength
 iZ
 ldapdelete
 xyz
-rdbms
 RDBMs
+rdbms
 extparam
 mk
 ng
@@ -565,8 +566,8 @@ ZZ
 LDVERSION
 testAttr
 backend
-backends
 backend's
+backends
 BerValues
 Solaris
 structs
@@ -578,9 +579,9 @@ ostring
 policyDN
 testObject
 pwdMaxAge
-binddn
-bindDN
 bindDn
+bindDN
+binddn
 distributedOperation
 schemachecking
 strvals
@@ -623,14 +624,14 @@ IEEE
 regex
 SIGINT
 slappasswd
-errABsObject
 errAbsObject
+errABsObject
 ldapexop
-objectIdentifier
 objectidentifier
+objectIdentifier
 deallocators
-mirrormode
 MirrorMode
+mirrormode
 loopDetect
 SIGHUP
 authMethodNotSupported
@@ -647,8 +648,8 @@ filtercomp
 expr
 syntaxes
 memrealloc
-returncode
 returnCode
+returncode
 OpenLDAP's
 exts
 bitstringa
@@ -672,8 +673,8 @@ lastName
 lldap
 cachesize
 slapauth
-attributeType
 attributetype
+attributeType
 GSER
 olcDbNosync
 typedef
@@ -690,11 +691,11 @@ monitoredObject
 TLSVerifyClient
 noidlen
 LDAPNOINIT
-pwdGraceAuthnLimit
 pwdGraceAuthNLimit
+pwdGraceAuthnLimit
 hnPk
-userpassword
 userPassword
+userpassword
 noanonymous
 LIBVERSION
 symas
@@ -713,9 +714,9 @@ IMAP
 organisations
 rewriteMap
 monitoredInfo
-modrDN
-ModRDN
 modrdn
+ModRDN
+modrDN
 HREF
 DQTxCYEApdUtNXGgdUac
 inline
@@ -730,8 +731,8 @@ reqReferral
 rlookups
 siiiib
 LTSTATIC
-timelimitExceeded
 timeLimitExceeded
+timelimitExceeded
 XKYnrjvGT
 subtrees
 unixODBC
@@ -743,8 +744,8 @@ reqDN
 dnstyle
 inet
 schemas
-pwdPolicySubentry
 pwdPolicySubEntry
+pwdPolicySubentry
 reqId
 backsql
 scanf
@@ -979,12 +980,12 @@ proxyAuthz
 config
 IDSET
 odbc
-ODBC
 searchFilter
 wholeSubtree
 SASLprep
 nisMailAlias
 libodbcpsqlS
+OxObjects
 attributeDescription
 groupnummer
 lsei
@@ -1041,8 +1042,8 @@ olcPidFile
 attribute's
 pPasswd
 metadirectory
-assciated
 Mitya
+assciated
 myObjectClass
 OIDs
 oids
@@ -1082,8 +1083,8 @@ noop
 errObject
 XXLIBS
 reqAssertion
-nops
 PDUs
+nops
 baseObject
 bvecadd
 perl
@@ -1197,11 +1198,11 @@ sctrls
 ldapport
 octetString
 repl
+FakeOidIndex
 ERXRTc
 LxsdLy
 lastmod
 integerOrderingMatch
-FakeOidIndex
 RowVersioning
 searchEntryDN
 pwdLockout
@@ -1226,8 +1227,8 @@ bvfree
 xeXBkeFxlZ
 priv
 proxyTemplates
-bvals
 FileUsage
+bvals
 givenName
 givenname
 jensen
@@ -1389,6 +1390,7 @@ strongAuthNotSupported
 endblock
 LDAPAVA
 startup
+sharedemail
 olcReplicationInterval
 TLSv
 libtool's
@@ -1589,12 +1591,12 @@ jpegPhoto
 supportedSASLMechanisms
 ACLs
 reqMethod
-authzId
-authzid
 authzID
+authzid
+authzId
 hasSubordintes
-proxyCache
 proxycache
+proxyCache
 slaptest
 olcLogLevel
 LDAPDN
@@ -1619,8 +1621,8 @@ wBDARESEhgVG
 multi
 aaa
 ldaprc
-UpdateDN
 updatedn
+UpdateDN
 LDAPBASE
 LDAPAPIFeatureInfo
 authzTo
@@ -1662,6 +1664,6 @@ ali
 attributeoptions
 BfQ
 uidNumber
-CA's
 CAs
+CA's
 namingContext
diff --git a/doc/guide/admin/overlays.sdf b/doc/guide/admin/overlays.sdf
index 0e8f8f85df..d25921ca47 100644
--- a/doc/guide/admin/overlays.sdf
+++ b/doc/guide/admin/overlays.sdf
@@ -1140,12 +1140,79 @@ H2: Value Sorting
 
 H3: Overview
 
-This overlay can be used to enforce a specific order for the values
-of an attribute when it is returned in a search.
-
+The Value Sorting overlay can be used with a backend database to sort the 
+values of specific multi-valued attributes within a subtree. The sorting occurs 
+whenever the attributes are returned in a search response.
 
 H3: Value Sorting Configuration
 
+Sorting can be specified in ascending or descending order, using either numeric 
+or alphanumeric sort methods. Additionally, a "weighted" sort can be specified,
+ which uses a numeric weight prepended to the attribute values. 
+
+The weighted sort is always performed in ascending order, but may be combined 
+with the other methods for values that all have equal weights. The weight is 
+specified by prepending an integer weight {<weight>} in front of each value 
+of the attribute for which weighted sorting is desired. This weighting factor 
+is stripped off and never returned in search results.
+
+Here are a few examples:
+
+>       loglevel    sync stats
+>       
+>       database    hdb
+>       suffix      "dc=suretecsystems,dc=com"
+>       directory   /usr/local/var/openldap-data
+>       
+>       ......
+>       
+>       overlay valsort
+>       valsort-attr memberUid ou=Groups,dc=suretecsystems,dc=com alpha-ascend
+
+For example, ascend:
+
+>       # sharedemail, Groups, suretecsystems.com
+>       dn: cn=sharedemail,ou=Groups,dc=suretecsystems,dc=com
+>       objectClass: posixGroup
+>       objectClass: top
+>       cn: sharedemail
+>       gidNumber: 517
+>       memberUid: admin
+>       memberUid: dovecot
+>       memberUid: laura
+>       memberUid: suretec
+
+For weighted, we change our data to:
+
+>       # sharedemail, Groups, suretecsystems.com
+>       dn: cn=sharedemail,ou=Groups,dc=suretecsystems,dc=com
+>       objectClass: posixGroup
+>       objectClass: top
+>       cn: sharedemail
+>       gidNumber: 517
+>       memberUid: {4}admin
+>       memberUid: {2}dovecot
+>       memberUid: {1}laura
+>       memberUid: {3}suretec
+
+and change the config to:
+
+>       overlay valsort
+>       valsort-attr memberUid ou=Groups,dc=suretecsystems,dc=com weighted
+
+Searching now results in:
+
+>       # sharedemail, Groups, OxObjects, suretecsystems.com
+>       dn: cn=sharedemail,ou=Groups,ou=OxObjects,dc=suretecsystems,dc=com
+>       objectClass: posixGroup
+>       objectClass: top
+>       cn: sharedemail
+>       gidNumber: 517
+>       memberUid: laura
+>       memberUid: dovecot
+>       memberUid: suretec
+>       memberUid: admin
+
 
 H3: Further Information
 
-- 
GitLab