fr.gouv.culture.sdx.search.lucene.query
Class ResultDocuments

java.lang.Object
  extended by fr.gouv.culture.sdx.utils.AbstractSdxObject
      extended by fr.gouv.culture.sdx.search.lucene.query.ResultDocuments
All Implemented Interfaces:
Describable, Encodable, Identifiable, Localizable, SdxObject, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, org.apache.excalibur.xml.sax.XMLizable

public class ResultDocuments
extends AbstractSdxObject

The documents which form an ordered list of search results. This class allows one to manage the sorting effectively, because only the requests which require a sorting other than the relevance are actually sorted.


Nested Class Summary
 
Nested classes/interfaces inherited from interface fr.gouv.culture.sdx.utils.SdxObject
SdxObject.ConfigurationNode
 
Field Summary
static java.lang.String CLASS_NAME_SUFFIX
           
 
Fields inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject
_configuration, _context, _description, _encoding, _id, _locale, _logger, _manager, _xmlizable_objects, _xmlLang, isToSaxInitialized
 
Fields inherited from interface fr.gouv.culture.sdx.utils.Encodable
DEFAULT_ENCODING
 
Constructor Summary
ResultDocuments()
          Creates a ResultDocuments object A super.getLog() must be set and then this object must be setUp.
 
Method Summary
protected  java.lang.String getClassNameSuffix()
          Sub classes should element this method to return their class name suffix for SAX output
 ResultDocument getDocument(int i)
          Returns a document according to its index in the list.
 ResultDocument[] getDocuments()
          Returns all of the result documents.
 int getLength()
          Returns the number of results.
 float getMaxScore()
          Returns the relevance ranking of the first document; therefore, the highest ranking is returned.
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 setSortedResults(ResultDocument[] sr)
          Sets the sorted results.
 void setUp(org.apache.lucene.search.Hits h)
          Builds a list of result documents from Lucene results.
 void setUp(ResultDocument[] sr)
          Builds a list of result documents from an array or sorted ResultDocuments.
 
Methods inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject
configure, configureDescription, contextualize, enableLogging, getBaseAttributes, getConfiguration, getContext, getDescription, getEncoding, getId, getLocale, getLog, getServiceManager, getXmlLang, service, setDescription, setEncoding, setId, setLocale, setUpSdxObject, setUpSdxObject, setXmlLang, toSAX, verifyConfigurationResources
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_NAME_SUFFIX

public static final java.lang.String CLASS_NAME_SUFFIX
See Also:
Constant Field Values
Constructor Detail

ResultDocuments

public ResultDocuments()
Creates a ResultDocuments object

A super.getLog() must be set and then this object must be setUp.

See Also:
AbstractSdxObject.enableLogging(org.apache.avalon.framework.logger.Logger), setUp(org.apache.lucene.search.Hits)
Method Detail

setUp

public void setUp(org.apache.lucene.search.Hits h)
Builds a list of result documents from Lucene results.

Parameters:
h - The Lucene results.

setUp

public void setUp(ResultDocument[] sr)
Builds a list of result documents from an array or sorted ResultDocuments.

Parameters:
sr - The sorted results.

setSortedResults

public void setSortedResults(ResultDocument[] sr)
Sets the sorted results.

Parameters:
sr - The sorted results.

getLength

public int getLength()
Returns the number of results.


getMaxScore

public float getMaxScore()
                  throws SDXException,
                         java.io.IOException
Returns the relevance ranking of the first document; therefore, the highest ranking is returned.

Throws:
SDXException
java.io.IOException

getDocument

public ResultDocument getDocument(int i)
                           throws SDXException
Returns a document according to its index in the list.

Parameters:
i - The index of the desired document.
Throws:
SDXException

getDocuments

public ResultDocument[] getDocuments()
                              throws SDXException
Returns all of the result documents.

Throws:
SDXException

getClassNameSuffix

protected java.lang.String getClassNameSuffix()
Description copied from class: AbstractSdxObject
Sub classes should element this method to return their class name suffix for SAX output

Specified by:
getClassNameSuffix in class AbstractSdxObject

initToSax

protected boolean initToSax()
Description copied from class: AbstractSdxObject
Init the LinkedHashMap _xmlizable_objects with the objects in order to describ them in XML

Specified by:
initToSax in class AbstractSdxObject

initVolatileObjectsToSax

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

Specified by:
initVolatileObjectsToSax in class AbstractSdxObject


Copyright © 2000-2010 Ministere de la culture et de la communication / AJLSM. All Rights Reserved.