Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## fr.gouv.culture.sdx.search.lucene.query
Class Terms

    java.lang.Object
      fr.gouv.culture.sdx.utils.AbstractSdxObject
          fr.gouv.culture.sdx.search.lucene.query.AbstractResponse
              fr.gouv.culture.sdx.search.lucene.query.Terms

All Implemented Interfaces:
  Terms, 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

Direct Known Subclasses:
  RegexTerms

    public class Terms

extends AbstractResponse
implements 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.

Nested Class Summary

Nested classes/interfaces inherited from interface fr.gouv.culture.sdx.utils.SdxObject
`SdxObject.ConfigurationNode`

Field Summary
`protected static java.text.Collator` | `sortCollator` The object of comparison for sorting
`protected java.util.TreeMap` | `termList` The ordered list of terms.

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.Terms
`CLASS_NAME_SUFFIX`

Fields inherited from interface fr.gouv.culture.sdx.utils.Encodable
`DEFAULT_ENCODING`

Constructor Summary
`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.

Method Summary
`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. Use `RegexTerms.getRegexTerms(BitSet)` after a `RegexTerms.setUp(SearchLocations, String, String)`
`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.

Methods inherited from class fr.gouv.culture.sdx.search.lucene.query.AbstractResponse
`count, 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`

Field Detail

### termList

    protected java.util.TreeMap termList

  The ordered list of terms.

### sortCollator

    protected static java.text.Collator sortCollator

  The object of comparison for sorting

Constructor Detail

### Terms

    public 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.

  See Also:
    `AbstractSdxObject.enableLogging(org.apache.avalon.framework.logger.Logger)`, `setUp(fr.gouv.culture.sdx.search.lucene.query.SearchLocations, java.lang.String)`

Method Detail

### setUp

    public void setUp(SearchLocations sLocs,
                      java.lang.String field)
               throws SDXException

  Builds a term list.

  Parameters:
    `sLocs` - The SearchLocations object (indices to be searched).
    `field` - The field name.
  Throws:
    `SDXException`

### setUp

    public void setUp(SearchLocations sLocs,
                      java.lang.String field,
                      java.lang.String str)
               throws SDXException

  Builds a term list.

  Parameters:
    `sLocs` - The SearchLocations object (indices to be searched).
    `field` - The field name.
    `str` - The term
  Throws:
    `SDXException`

### setFieldFilter

    protected void setFieldFilter(java.lang.String field)

### setUp

    public void setUp(Results results,
                      java.lang.String field,
                      java.lang.String value)
               throws SDXException

  Builds a term list.

  Parameters:
    `results` - The Results object (indices to be searched).
    `field` - The field name.
  Throws:
    `SDXException`

### setUp

    public void setUp(Results results,
                      java.lang.String[] fields,
                      java.lang.String[] values)
               throws SDXException

  Throws:
    `SDXException`

### setUp

    public void setUp(SearchLocations sLocs,
                      Results sdxResults,
                      java.lang.String field,
                      java.lang.String value)
               throws SDXException

  Builds a term list filtred by a query

  Parameters:
    `searchLocations` - The SDX Search Locations object
    `results` - The Results object to extract the Lucene Query
    `field` - The field name.
    `value` - The value (may be null)
  Throws:
    `SDXException`

### setUp

    public void setUp(SearchLocations sLocs,
                      Query sdxQuery,
                      java.lang.String field,
                      java.lang.String value)
               throws SDXException

  Builds a term list filtred by a query

  Parameters:
    `searchLocations` - The SDX Search Locations object
    `sdxQuery` - The SDX Query object to extract the Lucene Query
    `field` - The field name.
    `value` - The value (may be null)
  Throws:
    `SDXException`

### setUp

    public void setUp(SearchLocations sLocs,
                      org.apache.lucene.search.Query luceneQuery,
                      java.lang.String field,
                      java.lang.String value)
               throws SDXException

  Builds a term list filtred by a query

  Parameters:
    `searchLocations` - The SDX Search Locations object
    `query` - The Lucene Query object
    `field` - The field name.
    `value` - The value (may be null)
  Throws:
    `SDXException`

### setUp

    public void setUp(SearchLocations sLocs,
                      java.lang.String[] fields,
                      java.lang.String[] values)
               throws SDXException

  Builds a lits of terms from multiple criterias.

  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.

  Parameters:
    `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).
  Throws:
    `SDXException`

### setUp

    public void setUp(SearchLocations sLocs,
                      java.lang.String[] fields,
                      java.lang.String[] values,
                      int operator)
               throws SDXException

  Throws:
    `SDXException`

### toSAX

    public void toSAX(org.xml.sax.ContentHandler hdl)
               throws org.xml.sax.SAXException

  Returns an XML representation of this term list.

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

### toSAX

    public void toSAX(org.xml.sax.ContentHandler hdl,
                      int page)
               throws org.xml.sax.SAXException

  Returns an XML representation of this term list.

  Parameters:
    `hdl` - The ContentHandler to feed with SAX events.
    `page` - The number of the page to show.
  Throws:
    `org.xml.sax.SAXException`

### getList

    public java.util.TreeMap getList()

  Returns a list of the terms.

  Specified by:
    `getList` in interface `Terms`

### getTerms

    public static java.util.TreeMap getTerms(org.apache.lucene.index.IndexReader r,
                                             Field f,
                                             java.lang.String pattern)
                                      throws SDXException

  Deprecated. Use `RegexTerms.getRegexTerms(BitSet)` after a `RegexTerms.setUp(SearchLocations, String, String)`

  Returns a list of terms according to a field and a value. The value can contain masks and?. All terms of this field which respects the masked value will be turned over. If no term satisfied the criterion, an empty list is returned.

  Parameters:
    `r` - The index reader
    `f` - The field
    `pattern` - The pattern
  Throws:
    `SDXException`

### getTerms

    public java.util.TreeMap getTerms(org.apache.lucene.index.IndexReader r,
                                      Field f,
                                      java.util.BitSet docs)
                               throws SDXException

  Builds a list of values for a filtered field

  Parameters:
    `r` - The reader.
    `f` - The f.
    `docs` - A list of documents as a filter.
  Throws:
    `SDXException`

### getTerms

    public java.util.TreeMap getTerms(org.apache.lucene.index.IndexReader r,
                                      Field f,
                                      java.util.BitSet docs,
                                      java.lang.String str)
                               throws SDXException

  Builds a list of values for a filtered field, according to a value (may contains wildcards)

  Parameters:
    `r` - The reader.
    `f` - The field
    `docs` - A list of documents as a filter.
  Throws:
    `SDXException`

### getDocumentSet

    public static java.util.BitSet getDocumentSet(org.apache.lucene.index.IndexReader r,
                                                  org.apache.lucene.index.Term term)
                                           throws java.io.IOException

  Returns a list of the documents associated with a term within the index.

  Parameters:
    `r` - The index reader.
    `term` - The term for searching.
  Throws:
    `java.io.IOException`

### countPages

    public int countPages()

  Counts the number of pages for these terms.

  Specified by:
    `countPages` 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.

### initCollator

    protected void initCollator(Field field)

  Initializes the collator used for sorting .

  Parameters:
    `field` - The field from the document base.

### setAllHits

    public void setAllHits()

  Indicate to return all the results on only one page.

  Overrides:
    `setAllHits` in class `AbstractResponse`

### 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`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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