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

java.lang.Object
  extended byfr.gouv.culture.sdx.search.lucene.query.SearchLocations
All Implemented Interfaces:
org.apache.avalon.framework.logger.LogEnabled

public class SearchLocations
extends java.lang.Object
implements org.apache.avalon.framework.logger.LogEnabled

A list of LuceneIndex where searches can be made.


Constructor Summary
SearchLocations()
          Builds an empty search location.
 
Method Summary
 void addIndex(Index index)
          Adds an index to locations.
 boolean contains(Index index)
           
 void enableLogging(org.apache.avalon.framework.logger.Logger logger)
          Sets the logger.
 Field getDefaultField()
          Returns the default field for the first search location (first index).
 Field getField(java.lang.String name)
          Returns a field given a name.
 int getFieldType(java.lang.String name)
          Returns the type of a field given its name.
 org.apache.lucene.index.IndexReader getIndexReader(int idx)
          Returns an index reader at the specified index.
 java.util.Locale getLocale(java.lang.String name)
          Returns the locale for a field given its name.
 QueryParser getQueryParser()
           
 org.apache.lucene.search.Searcher getSearcher()
          Returns a searcher for these locations.
 java.lang.String getTypeName(java.lang.String name)
          Returns the typeName of a field given its name.
 void setQueryParser(QueryParser qParser)
           
 void setUp(Index index)
          Builds a search location with a single index.
 int size()
          Returns the number of indices in this search location.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchLocations

public SearchLocations()
Builds an empty search location. Use enableLoggin and addIndex() afterwards to add at least one index.

See Also:
enableLogging(org.apache.avalon.framework.logger.Logger), addIndex(fr.gouv.culture.sdx.search.lucene.query.Index)
Method Detail

setUp

public void setUp(Index index)
Builds a search location with a single index.

Parameters:
index - The Lucene index to use.

addIndex

public void addIndex(Index index)
Adds an index to locations.

Parameters:
index - The index to add.

getDefaultField

public Field getDefaultField()
                      throws SDXException
Returns the default field for the first search location (first index).

Throws:
SDXException

getField

public Field getField(java.lang.String name)
               throws SDXException
Returns a field given a name. Will return the first field having this name, null if none found.

Parameters:
name - The name of the field for which the Field is desired.
Returns:
Throws:
SDXException

getFieldType

public int getFieldType(java.lang.String name)
                 throws SDXException
Returns the type of a field given its name. The first field with this name will be returned.

Parameters:
name - The field name.
Throws:
SDXException

getTypeName

public java.lang.String getTypeName(java.lang.String name)
                             throws SDXException
Returns the typeName of a field given its name. The first field with this name will be returned.

Parameters:
name - The field name.
Throws:
SDXException

getIndexReader

public org.apache.lucene.index.IndexReader getIndexReader(int idx)
                                                   throws SDXException
Returns an index reader at the specified index.

Parameters:
idx - The index of the desired reader.
Throws:
SDXException

getLocale

public java.util.Locale getLocale(java.lang.String name)
                           throws SDXException
Returns the locale for a field given its name. The first field found with this name will be used.

Parameters:
name - The name of the field for which the Locale is desired.
Throws:
SDXException

getSearcher

public org.apache.lucene.search.Searcher getSearcher()
                                              throws SDXException
Returns a searcher for these locations.

Throws:
SDXException

enableLogging

public void enableLogging(org.apache.avalon.framework.logger.Logger logger)
Sets the logger.

Specified by:
enableLogging in interface org.apache.avalon.framework.logger.LogEnabled
Parameters:
logger - The logger to use.

size

public int size()
Returns the number of indices in this search location.


getQueryParser

public QueryParser getQueryParser()

setQueryParser

public void setQueryParser(QueryParser qParser)

contains

public boolean contains(Index index)


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