public class SortSpecification extends AbstractSdxObject implements java.util.Comparator
SdxObject.ConfigurationNode| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CLASS_NAME_SUFFIX |
static int |
SORT_ORDER_ASCENDANT
int to specifiy and an ascending sort.
|
static int |
SORT_ORDER_DESCENDANT
int to specifiy and an descending sort.
|
static java.lang.String |
SORT_RANKING
The field for the sorting by relevance.
|
static int |
SORT_UNLIMITED
The int to specify an unlimited sort
|
_configuration, _context, _description, _encoding, _id, _locale, _logger, _manager, _xmlizable_objects, _xmlLang, isToSaxInitializedDEFAULT_ENCODING| Constructor and Description |
|---|
SortSpecification()
Build a specification for sorting.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addSortKey(Field field)
Adds an ascending sort key to the specification by a field.
|
void |
addSortKey(Field field,
int order)
Adds a sort key to the specification by a field and an order.
|
void |
addSortKey(java.lang.String fieldName,
int order,
SearchLocations locations)
Adds a sort key to the specification,
a searchLocation is needed to obtains information about locale and analysers
|
void |
addSortKey(java.lang.String fieldName,
SearchLocations locations)
Adds a sort key to the specification,
a searchLocation is needed to obtains information about locale and analysers
|
int |
compare(java.lang.Object doc1,
java.lang.Object doc2)
Carries out the comparison of two documents with the aim of sorting them .
|
protected java.lang.String |
getClassNameSuffix()
Sub classes should element this method to return their class name suffix for SAX output
|
org.apache.lucene.search.Sort |
getLuceneSort() |
int |
getMaxSort() |
protected boolean |
initToSax()
Init the LinkedHashMap _xmlizable_objects with the objects in order to describ them in XML
|
protected void |
initVolatileObjectsToSax()
Init the LinkedHashMap _xmlizable_volatile_objects with the objects in order to describ them in XML
Some objects need to be refresh each time a toSAX is called
|
void |
setMaxSort(int max_sort)
Set the maximum number of documents to sort.
|
void |
setMaxSort(java.lang.String max_sort)
Set the maximum number of documents to sort.
|
ResultDocuments |
sortResults(org.apache.lucene.search.Hits hits)
Sorts the search results.
|
ResultDocuments |
sortResults(ResultDocuments res)
Sorts the search results.
|
void |
toSAX(org.xml.sax.ContentHandler hdl)
Returns an XML representation of this sort specification.
|
configure, configureDescription, contextualize, enableLogging, getBaseAttributes, getConfiguration, getContext, getDescription, getEncoding, getId, getLocale, getLog, getServiceManager, getXmlLang, service, setDescription, setEncoding, setId, setLocale, setUpSdxObject, setUpSdxObject, setXmlLang, verifyConfigurationResourcespublic static final java.lang.String CLASS_NAME_SUFFIX
public static final int SORT_ORDER_ASCENDANT
public static final int SORT_ORDER_DESCENDANT
public static final java.lang.String SORT_RANKING
public static final int SORT_UNLIMITED
public SortSpecification()
throws SDXException
SDXExceptionpublic void addSortKey(Field field, int order) throws SDXException
field - The field.order - The order.SDXExceptionpublic void addSortKey(Field field) throws SDXException
field - The field.SDXExceptionpublic void addSortKey(java.lang.String fieldName,
int order,
SearchLocations locations)
throws SDXException
fieldName - The field.order - orderlocations - SDXExceptionpublic void addSortKey(java.lang.String fieldName,
SearchLocations locations)
throws SDXException
fieldName - The field.locations - SDXExceptionpublic ResultDocuments sortResults(org.apache.lucene.search.Hits hits) throws SDXException
hits - The search hitsSDXExceptionpublic ResultDocuments sortResults(ResultDocuments res) throws SDXException, java.io.IOException
res - The result documentsSDXExceptionjava.io.IOExceptionpublic int compare(java.lang.Object doc1,
java.lang.Object doc2)
compare in interface java.util.Comparatordoc1 - The first document.doc2 - The second document.public void toSAX(org.xml.sax.ContentHandler hdl)
throws org.xml.sax.SAXException
toSAX in interface org.apache.excalibur.xml.sax.XMLizabletoSAX in class AbstractSdxObjecthdl - The ContentHandler to feed with events.org.xml.sax.SAXExceptionpublic org.apache.lucene.search.Sort getLuceneSort()
public int getMaxSort()
public void setMaxSort(int max_sort)
public void setMaxSort(java.lang.String max_sort)
protected java.lang.String getClassNameSuffix()
AbstractSdxObjectgetClassNameSuffix in class AbstractSdxObjectprotected boolean initToSax()
AbstractSdxObjectinitToSax in class AbstractSdxObjectprotected void initVolatileObjectsToSax()
initVolatileObjectsToSax in class AbstractSdxObjectCopyright © 2000-2010 Ministere de la culture et de la communication / AJLSM. All Rights Reserved.