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

java.lang.Object
  extended by fr.gouv.culture.sdx.utils.AbstractSdxObject
      extended by fr.gouv.culture.sdx.search.lucene.query.AbstractResponse
          extended by fr.gouv.culture.sdx.search.lucene.query.Results
All Implemented Interfaces:
Results, 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 Results
extends AbstractResponse
implements Results

The results of a search. This object also contains information on the search acceptRequest used to obtain them.


Nested Class Summary
 
Nested classes/interfaces inherited from interface fr.gouv.culture.sdx.utils.SdxObject
SdxObject.ConfigurationNode
 
Field Summary
 
Fields inherited from class fr.gouv.culture.sdx.search.lucene.query.AbstractResponse
_count, _hitsPerPage, _nbPages, _searchLocations, HITS_PER_PAGE, HPP_ALL_HITS
 
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.search.Results
CLASS_NAME_SUFFIX
 
Fields inherited from interface fr.gouv.culture.sdx.utils.Encodable
DEFAULT_ENCODING
 
Constructor Summary
Results()
          Creates a Results object A super.getLog() must be set and then this object must be setUp.
Results(Results results)
           
 
Method Summary
 int count()
          Returns the number of results.
 int countPages()
          Counts and returns the number of pages for these results.
protected  java.lang.String getClassNameSuffix()
          Sub classes should element this method to return their class name suffix for SAX output
 java.lang.String[] getDocIds()
          Returns the document id for each document of the result set.
 TermHighlighter getHighliter()
           
 org.apache.lucene.search.Hits getHits()
          Retourne tous les resultats sous la forme d'un element DOM.
 float getMaxScore()
          Returns the score of the first document, which is always the highest score.
 void getNavigationAsSAX(org.xml.sax.ContentHandler hdl, int docNo)
          Returns a representation XML of information on the preceding and following documents.
 void getNavigationAsSAX(org.xml.sax.ContentHandler hdl, java.lang.String id)
          Returns a representation XML of information on the preceding and following documents.
 Query getQuery()
          Returns the search acceptRequest which created these results.
 void getQueryAsSAX(org.xml.sax.ContentHandler hdl)
          Returns an XML representation of the Query.
 void reSort(SortSpecification sorts)
          Resorts the results with a sort specification.
 void setAllHits()
          Indicates that all the results should be returned .
 void setHighliter(TermHighlighter hliter)
           
 void setHitsPerPage(int nb)
          Set the number of hits per page.
 void setUp(SearchLocations sLocs, org.apache.lucene.search.Hits searchHits, Query query)
          Builds the results of a acceptRequest from the Lucene results.
 void setUp(SearchLocations sLocs, org.apache.lucene.search.Hits searchHits, SortSpecification sorts, Query query)
          Builds the results of a acceptRequest from the Lucene results and a sort specification.
 void toSAX(org.xml.sax.ContentHandler hdl)
          Returns an XML representation of the results.
 void toSAX(org.xml.sax.ContentHandler hdl, boolean getDocuments)
          Returns an XML representation of the results.
 void toSAX(org.xml.sax.ContentHandler hdl, int pageNo)
          Returns an XML representation of the results.
 void toSAX(org.xml.sax.ContentHandler hdl, int pageNo, boolean getDocuments)
          Returns an XML representation of the results.
 
Methods inherited from class fr.gouv.culture.sdx.search.lucene.query.AbstractResponse
getHitsPerPage, getNbPages, getSearchLocations, initToSax, initVolatileObjectsToSax, setNbPages, setSearchLocations
 
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, verifyConfigurationResources
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface fr.gouv.culture.sdx.utils.SdxObject
getLog
 
Methods inherited from interface org.apache.avalon.framework.logger.LogEnabled
enableLogging
 
Methods inherited from interface org.apache.avalon.framework.context.Contextualizable
contextualize
 
Methods inherited from interface org.apache.avalon.framework.service.Serviceable
service
 
Methods inherited from interface org.apache.avalon.framework.configuration.Configurable
configure
 
Methods inherited from interface fr.gouv.culture.sdx.utils.Identifiable
getId, setId
 
Methods inherited from interface fr.gouv.culture.sdx.utils.Describable
getDescription, setDescription
 
Methods inherited from interface fr.gouv.culture.sdx.utils.Encodable
getEncoding, setEncoding
 
Methods inherited from interface fr.gouv.culture.sdx.utils.Localizable
getLocale, getXmlLang, setLocale, setXmlLang
 

Constructor Detail

Results

public Results()
Creates a Results 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(fr.gouv.culture.sdx.search.lucene.query.SearchLocations, org.apache.lucene.search.Hits, fr.gouv.culture.sdx.search.lucene.query.SortSpecification, fr.gouv.culture.sdx.search.lucene.query.Query)

Results

public Results(Results results)
        throws SDXException,
               java.io.IOException
Throws:
SDXException
java.io.IOException
Method Detail

setUp

public void setUp(SearchLocations sLocs,
                  org.apache.lucene.search.Hits searchHits,
                  SortSpecification sorts,
                  Query query)
           throws SDXException,
                  java.io.IOException
Builds the results of a acceptRequest from the Lucene results and a sort specification.

Parameters:
sLocs - The SearchLocations object (indices searched).
searchHits - Les resultats Lucene.
sorts - Les specifications de tri.
query - La requete qui a permis d'obtenir ces resultats.
Throws:
SDXException
java.io.IOException

setUp

public void setUp(SearchLocations sLocs,
                  org.apache.lucene.search.Hits searchHits,
                  Query query)
           throws SDXException
Builds the results of a acceptRequest from the Lucene results.

Parameters:
sLocs - The SearchLocations object (indices searched).
searchHits - Les résultats Lucene.
query - La requete qui a permis d'obtenir ces resultats.
Throws:
SDXException

getHits

public org.apache.lucene.search.Hits getHits()
Retourne tous les resultats sous la forme d'un element DOM.

Parameters:
factory - Le document servant de manufacture.

toSAX

public void toSAX(org.xml.sax.ContentHandler hdl)
           throws org.xml.sax.SAXException
Returns an XML representation of the results.

Specified by:
toSAX in interface org.apache.excalibur.xml.sax.XMLizable
Overrides:
toSAX in class AbstractSdxObject
Parameters:
hdl - The ContentHandler to feed with events.
Throws:
org.xml.sax.SAXException

toSAX

public void toSAX(org.xml.sax.ContentHandler hdl,
                  boolean getDocuments)
           throws SDXException,
                  java.lang.Exception
Returns an XML representation of the results.

Parameters:
hdl - The ContentHandler to feed with events.
getDocuments - Indicates if the actual complete documents should be returned
Throws:
SDXException
java.lang.Exception

toSAX

public void toSAX(org.xml.sax.ContentHandler hdl,
                  int pageNo)
           throws SDXException,
                  java.lang.Exception
Returns an XML representation of the results.

Parameters:
hdl - The ContentHandler to feed with events.
pageNo - The page number of the desired results.
Throws:
SDXException
java.lang.Exception

toSAX

public void toSAX(org.xml.sax.ContentHandler hdl,
                  int pageNo,
                  boolean getDocuments)
           throws SDXException,
                  org.xml.sax.SAXException
Returns an XML representation of the results.

Parameters:
hdl - The ContentHandler to feed with events.
pageNo - The requested page number of the desired results. Reaffected when number of results doesn't fit.
getDocuments - Indicates if the actual complete documents should be returned
Throws:
SDXException
org.xml.sax.SAXException

countPages

public int countPages()
Counts and returns the number of pages for these results.

Specified by:
countPages in class AbstractResponse

setAllHits

public void setAllHits()
Indicates that all the results should be returned .

Overrides:
setAllHits in class AbstractResponse

setHitsPerPage

public void setHitsPerPage(int nb)
Set the number of hits per page.

Overrides:
setHitsPerPage in class AbstractResponse
Parameters:
nb - The number of hits.

getQueryAsSAX

public void getQueryAsSAX(org.xml.sax.ContentHandler hdl)
                   throws SDXException,
                          org.xml.sax.SAXException,
                          org.apache.cocoon.ProcessingException
Returns an XML representation of the Query.

Parameters:
hdl - The ContentHandler to feed with events.
Throws:
SDXException
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException

getDocIds

public java.lang.String[] getDocIds()
                             throws SDXException,
                                    java.io.IOException
Returns the document id for each document of the result set.

Throws:
SDXException
java.io.IOException

getQuery

public Query getQuery()
Returns the search acceptRequest which created these results.


getNavigationAsSAX

public void getNavigationAsSAX(org.xml.sax.ContentHandler hdl,
                               int docNo)
                        throws SDXException,
                               org.xml.sax.SAXException,
                               org.apache.cocoon.ProcessingException,
                               java.io.IOException
Returns a representation XML of information on the preceding and following documents. This representation includes the _identifier as well as the page number of the preceding and the following documents as compared to the document whose number is provided

Parameters:
docNo - The 1-based index of the document in the sorted results
hdl - The ContentHandler which will receive the events
Throws:
SDXException
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException
java.io.IOException

getNavigationAsSAX

public void getNavigationAsSAX(org.xml.sax.ContentHandler hdl,
                               java.lang.String id)
                        throws SDXException,
                               org.xml.sax.SAXException,
                               org.apache.cocoon.ProcessingException,
                               java.io.IOException
Returns a representation XML of information on the preceding and following documents. This representation includes the _identifier as well as the page number of the preceding and the following documents as compared to the document whose number is provided

Parameters:
hdl - The ContentHandler which will receive the events
id - The id of the document
Throws:
SDXException
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException
java.io.IOException

reSort

public void reSort(SortSpecification sorts)
            throws java.io.IOException,
                   SDXException
Resorts the results with a sort specification.

Parameters:
sorts - The sort specification.
Throws:
java.io.IOException
SDXException

count

public int count()
Returns the number of results.

Overrides:
count in class AbstractResponse

getMaxScore

public float getMaxScore()
Returns the score of the first document, which is always the highest score.


getHighliter

public TermHighlighter getHighliter()

setHighliter

public void setHighliter(TermHighlighter hliter)

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


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