·¬ÇÑÉçÇø

Brightspot CMS Developer Guide

Sorting


The API includes a variety of sort-related methods to order search results by field. Sorted fields must be indexes.

Two common sorts are performed with the sortAscending and sortDescending methods. The following query sorts Author objects in descending alphabetical order by last name:

List<Author> authors = Query.from(Author.class).sortDescending("lastName");

For spatial queries for objects containing a field, you can use sortClosest or sortFarthest. These methods sort results in closet or farthest order from a given location.

For advanced sorting, you can use the sortNewest, sortOldest, and sortRelevant methods, which prioritize a specified field value with a specified weight.

All of the sort-related methods use the class. You can create a custom Sorter class and add it to the Query instance with the sort method.

Previous Topic
Object references
Next Topic
Grouping
Was this topic helpful?
Thanks for your feedback.
Our robust, flexible Design System provides hundreds of pre-built components you can use to build the presentation layer of your dreams.

•
•
•
Brightspot is packaged with content types that get you up and running in a matter of days, including assets, modules and landing pages.

• Content types
• Modules
• Landing pages
Everything you need to know when creating, managing, and administering content within Brightspot CMS.

• Dashboards
• Publishing
• Workflows
• Admin configurations
A guide for installing, supporting, extending, modifying and administering code on the Brightspot platform.

• Field types
• Content modeling
• Rich-text elements
• Images
A guide to configuring Brightspot's library of integrations, including pre-built options and developer-configured extensions.

• Google Analytics
• Shopify
• Apple News