|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfr.gouv.culture.sdx.utils.SdxObjectImpl
fr.gouv.culture.sdx.search.lucene.query.Terms
A list of terms for a document base. The terms are single values of fields. One can build one list of all the terms, a list of terms which respect one regular expression (with an aim of managing truncation), one list of terms for a field, as well as a list of terms for a field according to a search acceptRequest.
Field Summary | |
static int |
HITS_PER_PAGE
The default number of documents to show per page. |
Fields inherited from class fr.gouv.culture.sdx.utils.SdxObjectImpl |
encoding |
Constructor Summary | |
Terms()
Creates a list of terms according to a chain with truncation A logger must be set and then the Terms must be setUp. |
Method Summary | |
void |
enableLogging(org.apache.avalon.framework.logger.Logger logger)
Sets the logger. |
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. |
int |
getHitsPerPage()
Get the number of hits per page. |
java.util.TreeMap |
getList()
Returns a list of the terms. |
SearchLocations |
getSearchLocations()
|
static java.util.TreeMap |
getTerms(org.apache.lucene.index.IndexReader r,
Field f,
java.lang.String pattern)
Returns a list of terms according to a field and a value. |
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 |
setId(java.lang.String id)
Sets the identifier for this list of terms. |
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,
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 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. |
Methods inherited from class fr.gouv.culture.sdx.utils.SdxObjectImpl |
getChildLogger, setEncoding |
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 |
setEncoding |
Field Detail |
public static final int HITS_PER_PAGE
Constructor Detail |
public Terms()
A logger must be set and then the Terms must be setUp.
enableLogging(org.apache.avalon.framework.logger.Logger)
,
setUp(fr.gouv.culture.sdx.search.lucene.query.SearchLocations, java.lang.String)
Method Detail |
public void setUp(SearchLocations sLocs, java.lang.String field) throws SDXException
sLocs
- The SearchLocations object (indices to be searched).field
- The field name.
SDXException
public 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 term
SDXException
protected 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.
SDXException
public void setUp(Results results, java.lang.String[] fields, java.lang.String[] values) throws SDXException
SDXException
public 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).
SDXException
public void toSAX(org.xml.sax.ContentHandler hdl) throws org.xml.sax.SAXException, org.apache.cocoon.ProcessingException
toSAX
in interface org.apache.cocoon.xml.XMLizable
hdl
- The ContentHandler to feed with SAX events.
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException
public void toSAX(org.xml.sax.ContentHandler hdl, int page) throws org.xml.sax.SAXException, org.apache.cocoon.ProcessingException
hdl
- The ContentHandler to feed with SAX events.page
- The number of the page to show.
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException
public java.util.TreeMap getList()
getList
in interface Terms
public static java.util.TreeMap getTerms(org.apache.lucene.index.IndexReader r, Field f, java.lang.String pattern) throws SDXException
r
- The index readerf
- The fieldpattern
- The pattern
SDXException
public 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.IOException
public void setId(java.lang.String id)
id
- The id.public int getHitsPerPage()
public void setHitsPerPage(int nb)
nb
- The number of hits.public void setAllHits()
public void enableLogging(org.apache.avalon.framework.logger.Logger logger)
enableLogging
in interface org.apache.avalon.framework.logger.LogEnabled
enableLogging
in class SdxObjectImpl
logger
- The logger to use.public SearchLocations getSearchLocations()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |