Copyright© 2008-2022 Sitevision AB, all rights reserved.
public class SearchSortField extends Object
SearchSortField
describes in what way a search result will be ordered.
Note! Only single-valued fields can be used for sorting (i.e. you typically can not sort on an analyzed field).
An instance of this class can be obtained via SearchFactory.getSearchSortField(String, boolean)
.
See SearchFactory
for how to obtain an instance of the SearchFactory
interface.
Example of how to get SearchSortField instances in sever-side Javascript:
// Get SearchFactory to create instances
var searchFactory = require('SearchFactory'),
lastPubDesc = searchFactory.getSearchSortField('lastpublished', false),
nameAsc = searchFactory.getSearchSortField('name.sortable', true),
...
Example of how to get SearchSortField instances in Velocity:
## Get the factory and the builder
#set ($searchFactory = $sitevisionUtils.searchFactory)
#set ($lastPubDesc = $searchFactory.getSearchSortField('lastpublished', false))
#set ($nameAsc = $searchFactory.getSearchSortField('name.sortable', true))
...
SortBuilder
Constructor and Description |
---|
SearchSortField(String aField,
boolean aIsAscending)
Creates a
SearchSortField object. |
Modifier and Type | Method and Description |
---|---|
String |
getField()
Name of the index field.
|
boolean |
isAscending()
Whether sort order is ascending or not.
|
boolean |
isDescending()
Whether sort order is descending or not.
|
public SearchSortField(String aField, boolean aIsAscending)
Creates a SearchSortField
object.
Throws NullPointerException
if aField
is null
aField
- name of the sortable index fieldaIsAscending
- the sort order (true == ascending, false == descending)public String getField()
public boolean isAscending()
public boolean isDescending()
Sitevision - Portal and Content Management Made Easy
Sitevision is an advanced Java enterprise portal product and a portlet container (JSR 286) that implements Java Content Repository (JSR 283).
Copyright© 2008-2022 Sitevision AB, all rights reserved.