SearchSort

class SearchSort

Specifies how to sort the results of a search query.

Create instances using the companion factory methods.

For tiered sorting, chain using then or of.

Samples

import com.couchbase.client.kotlin.Cluster
import com.couchbase.client.kotlin.search.Highlight
import com.couchbase.client.kotlin.search.NumericRange
import com.couchbase.client.kotlin.search.SearchFacet
import com.couchbase.client.kotlin.search.SearchQuery
import com.couchbase.client.kotlin.search.SearchResult
import com.couchbase.client.kotlin.search.SearchSort
import com.couchbase.client.kotlin.search.SearchSort.Companion.byField
import com.couchbase.client.kotlin.search.SearchSort.Companion.byId
import com.couchbase.client.kotlin.search.execute
fun main() { 
   //sampleStart 
   // tiered sort
val sort = byField("foo") then byId()

// the same sort, but built from a list
val sameSort = SearchSort.of(listOf(byField("foo"), byId())) 
   //sampleEnd
}

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
infix fun then(other: SearchSort): SearchSort

Returns a tiered sort consisting of this sort followed by other.

Link copied to clipboard
open override fun toString(): String