Sorting

Search environments often let us sort the search results in multiple ways (such as by relevance, ratings, price, or recency).

Sort options dropdown menu displaying Oldest, Relevance, Oldest, and Newest sorting choices for search results.

The SearchStax Site Search solution lets us take control of this feature and define the sort options offered by the current Search Profile.

Sorting is an App-level feature.

Accessing Sort Configuration

Go to Site Search > Configurations > Advanced Configurations > Sorting.

Sorting configuration panel with dropdown menus for sort field, order, and label, plus a preview showing relevance and ID descending options.

Configuring Sort Fields

The checkbox on the left enables the sorting control. The Sort Field control lets you choose a field to sort by.

Location-Based Search

The Location feature can place a geodist() item in this list.

Note the Reload Schema icon above the list of fields. If you can’t find a field in the list, try reloading the schema.

Sort Field control with a pointer cursor hovering over the Reload Schema button next to the _root_ field selector.

Not All Fields May Be Used for Sorting!

Site Search automatically limits the Sort Fields on this screen to those that Solr accepts for sorting. Solr accepts any primitive field (numerics, string, boolean, dates, etc.) which has docValues=”true” (or multiValued=”false” and indexed=”true”). See Apache Solr’s Common Query Parameters for more information.

The Sort Order control offers ascending or descending sort order. The Label is the text the user will see in the sorting droplist. Use the (+) button to add the field to the sorting list. The Preview field on the right shows what the sorting control will look like on the search page.

Managing Sort Options

The list at the bottom of the screen reflects the sort options. Select an option and click the Move Up and Move Down buttons to control how the options will be ordered on the sorting control. 

Click the Save Draft button before you leave or refresh a page. Otherwise, changes can be lost. The Publish button updates the search configuration to make the changes active. 

When you save a draft, Site Search shows a blue dot in the navigation menu to indicate pending changes for the current app, language, and search profile. The configuration page also shows a banner. Status banners show pending draft, saved draft, and published states.

Articles in this section