Searching - Sorting the Results

FieldNamesort=N

You may sort the results of any search so that [FoundItems] appear in a particular order. Ranking by "best match", ascending or descending alphabetically or numerically, random, "none", and even within multiple fields are all possible.

Note: if you do not specify a sort order explicitly, then WebCatalog assumes you want the results sorted by "best match", meaning that the records which match the most search terms will be shown at the top of the list. This is very powerful, because even if thousands of records are found (by a careless choice of too-common search words such as "a" "and" "the"), usually the "best" records are at the top of the list.

For example, if you want to sort alphabetically by First Name amongst all the records whose First Name is after "H", you would enter something like this:

gtFirstNamedata=H&FirstNamesort=1

"gt" stands for "greater than", and "sort=1" means that you want the primary sort order based on FirstName field. You can have a secondary sort order based on other fields (meaning that when several FirstName fields are identical, those records are sub-sorted by another field). For example, to sort by FirstName and then LastName you would enter something like:

gtFirstNamedata=H&FirstNamesort=1&LastNamesort=2

"sort=2" tells WebCatalog to alphabetize the LastName records within portions of the results that have identical FirstName fields.

Note: fields are sorted within equally-ranked groups of found items, which means that all the "best match" records at the top of the list get sorted alphabetically, then the "next-best" records are sorted after that, and so on. Often, if it is important that records be sorted purely alphabetically (ignoring their 'rank'), you will need to put "AllHit=1" into your search criteria.

Which Fields to Sort (FieldNamesort=N)
Sort by FirstName FirstNamesort=1
Sort by LastName first, then FirstName FirstNamesort=2&LastNamesort=1
Sort Order (FieldNamesdir=XX)
Sort FirstName Ascending (A-Z or 0-9 if numeric) FirstNamesdir=as
Sort FirstName Descending (Z-A or 9-0 if numeric) FirstNamesdir=de
Sort FirstName Randomly (useful for random banner ads) FirstNamesdir=ra
No sorting of any kind -- records are displayed in exactly the same order they appear in the database file. rank=off