public class Terms extends AbstractResponse implements Terms
SdxObject.ConfigurationNode| Modifier and Type | Field and Description |
|---|---|
protected static java.text.Collator |
sortCollator
The object of comparison for sorting
|
protected java.util.TreeMap |
termList
The ordered list of terms.
|
_count, _hitsPerPage, _nbPages, _searchLocations, HITS_PER_PAGE, HPP_ALL_HITS_configuration, _context, _description, _encoding, _id, _locale, _logger, _manager, _xmlizable_objects, _xmlLang, isToSaxInitializedCLASS_NAME_SUFFIXDEFAULT_ENCODING| Constructor and Description |
|---|
Terms()
Creates a list of terms according to a chain with truncation
A super.getLog() must be set and then the Terms must be setUp.
|
| Modifier and Type | Method and Description |
|---|---|
int |
countPages()
Counts the number of pages for these terms.
|
protected java.lang.String |
getClassNameSuffix()
Sub classes should element this method to return their class name suffix for SAX output
|
static java.util.BitSet |
getDocumentSet(org.apache.lucene.index.IndexReader r,
org.apache.lucene.index.Term term)
Returns a list of the documents associated with a term within the index.
|
java.util.TreeMap |
getList()
Returns a list of the terms.
|
java.util.TreeMap |
getTerms(org.apache.lucene.index.IndexReader r,
Field f,
java.util.BitSet docs)
Builds a list of values for a filtered field
|
java.util.TreeMap |
getTerms(org.apache.lucene.index.IndexReader r,
Field f,
java.util.BitSet docs,
java.lang.String str)
Builds a list of values for a filtered field, according to a value (may contains wildcards)
|
static java.util.TreeMap |
getTerms(org.apache.lucene.index.IndexReader r,
Field f,
java.lang.String pattern)
Deprecated.
|
protected void |
initCollator(Field field)
Initializes the collator used for sorting .
|
void |
setAllHits()
Indicate to return all the results on only one page.
|
protected void |
setFieldFilter(java.lang.String field) |
void |
setHitsPerPage(int nb)
Set the number of hits per page.
|
void |
setUp(Results results,
java.lang.String[] fields,
java.lang.String[] values) |
void |
setUp(Results results,
java.lang.String field,
java.lang.String value)
Builds a term list.
|
void |
setUp(SearchLocations sLocs,
Query sdxQuery,
java.lang.String field,
java.lang.String value)
Builds a term list filtred by a query
|
void |
setUp(SearchLocations sLocs,
org.apache.lucene.search.Query luceneQuery,
java.lang.String field,
java.lang.String value)
Builds a term list filtred by a query
|
void |
setUp(SearchLocations sLocs,
Results sdxResults,
java.lang.String field,
java.lang.String value)
Builds a term list filtred by a query
|
void |
setUp(SearchLocations sLocs,
java.lang.String field)
Builds a term list.
|
void |
setUp(SearchLocations sLocs,
java.lang.String[] fields,
java.lang.String[] values)
Builds a lits of terms from multiple criterias.
|
void |
setUp(SearchLocations sLocs,
java.lang.String[] fields,
java.lang.String[] values,
int operator) |
void |
setUp(SearchLocations sLocs,
java.lang.String field,
java.lang.String str)
Builds a term list.
|
void |
toSAX(org.xml.sax.ContentHandler hdl)
Returns an XML representation of this term list.
|
void |
toSAX(org.xml.sax.ContentHandler hdl,
int page)
Returns an XML representation of this term list.
|
count, getHitsPerPage, getNbPages, getSearchLocations, initToSax, initVolatileObjectsToSax, setNbPages, setSearchLocationsconfigure, configureDescription, contextualize, enableLogging, getBaseAttributes, getConfiguration, getContext, getDescription, getEncoding, getId, getLocale, getLog, getServiceManager, getXmlLang, service, setDescription, setEncoding, setId, setLocale, setUpSdxObject, setUpSdxObject, setXmlLang, verifyConfigurationResourcesclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetId, setIdgetDescription, setDescriptiongetEncoding, setEncodinggetLocale, getXmlLang, setLocale, setXmlLangprotected java.util.TreeMap termList
protected static java.text.Collator sortCollator
public Terms()
A super.getLog() must be set and then the Terms must be setUp.
public void setUp(SearchLocations sLocs, java.lang.String field) throws SDXException
sLocs - The SearchLocations object (indices to be searched).field - The field name.SDXExceptionpublic void setUp(SearchLocations sLocs, java.lang.String field, java.lang.String str) throws SDXException
sLocs - The SearchLocations object (indices to be searched).field - The field name.str - The termSDXExceptionprotected void setFieldFilter(java.lang.String field)
public void setUp(Results results, java.lang.String field, java.lang.String value) throws SDXException
results - The Results object (indices to be searched).field - The field name.SDXExceptionpublic void setUp(Results results, java.lang.String[] fields, java.lang.String[] values) throws SDXException
SDXExceptionpublic void setUp(SearchLocations sLocs, Results sdxResults, java.lang.String field, java.lang.String value) throws SDXException
searchLocations - The SDX Search Locations objectresults - The Results object to extract the Lucene Queryfield - The field name.value - The value (may be null)SDXExceptionpublic void setUp(SearchLocations sLocs, Query sdxQuery, java.lang.String field, java.lang.String value) throws SDXException
searchLocations - The SDX Search Locations objectsdxQuery - The SDX Query object to extract the Lucene Queryfield - The field name.value - The value (may be null)SDXExceptionpublic void setUp(SearchLocations sLocs, org.apache.lucene.search.Query luceneQuery, java.lang.String field, java.lang.String value) throws SDXException
searchLocations - The SDX Search Locations objectquery - The Lucene Query objectfield - The field name.value - The value (may be null)SDXExceptionpublic void setUp(SearchLocations sLocs, java.lang.String[] fields, java.lang.String[] values) throws SDXException
IMPORTANT : only one search location is actually used. TODO : fix this...
Criterias are field=value pairs. This method lets a developer creates hierarchical lists.
There should be one value less than fields; the last field will then be the field to return values from.
For instance, if the first field is 'region', the second is 'department' and the third is 'city', and the first value is 'Aquitaine' and the second value is 'Gironde', you will get a list of cities that appear in documents that also have region=Aquitaine and department=Gironde.
sLocs - Where to find the terms (may not bu null).fields - The list of fields (may not be null).values - The list of values (there should be one less value than fields).SDXExceptionpublic void setUp(SearchLocations sLocs, java.lang.String[] fields, java.lang.String[] values, int operator) throws SDXException
SDXExceptionpublic 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 SAX events.org.xml.sax.SAXExceptionpublic void toSAX(org.xml.sax.ContentHandler hdl,
int page)
throws org.xml.sax.SAXException
hdl - The ContentHandler to feed with SAX events.page - The number of the page to show.org.xml.sax.SAXExceptionpublic java.util.TreeMap getList()
public static java.util.TreeMap getTerms(org.apache.lucene.index.IndexReader r,
Field f,
java.lang.String pattern)
throws SDXException
RegexTerms.getRegexTerms(BitSet) after a RegexTerms.setUp(SearchLocations, String, String)r - The index readerf - The fieldpattern - The patternSDXExceptionpublic java.util.TreeMap getTerms(org.apache.lucene.index.IndexReader r,
Field f,
java.util.BitSet docs)
throws SDXException
r - The reader.f - The f.docs - A list of documents as a filter.SDXExceptionpublic java.util.TreeMap getTerms(org.apache.lucene.index.IndexReader r,
Field f,
java.util.BitSet docs,
java.lang.String str)
throws SDXException
r - The reader.f - The fielddocs - A list of documents as a filter.SDXExceptionpublic static java.util.BitSet getDocumentSet(org.apache.lucene.index.IndexReader r,
org.apache.lucene.index.Term term)
throws java.io.IOException
r - The index reader.term - The term for searching.java.io.IOExceptionpublic int countPages()
countPages in class AbstractResponsepublic void setHitsPerPage(int nb)
setHitsPerPage in class AbstractResponsenb - The number of hits.protected void initCollator(Field field)
field - The field from the document base.public void setAllHits()
setAllHits in class AbstractResponseprotected java.lang.String getClassNameSuffix()
AbstractSdxObjectgetClassNameSuffix in class AbstractSdxObjectCopyright © 2000-2010 Ministere de la culture et de la communication / AJLSM. All Rights Reserved.