|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.weborganic.bastille.flint.helpers.IndexMaster
public final class IndexMaster
Centralizes all the indexing and searching function using Flint for one index.
Constructor Summary | |
---|---|
IndexMaster(File directory)
Sets up the index master using the default Flint configuration. |
Method Summary | |
---|---|
void |
clear()
Clears the content of the wrapped index. |
IndexConfig |
config()
Returns the index config this class operates on. |
Facet |
getFacet(String field,
int upTo,
Query query)
Returns the list of term and how frequently they are used by performing a fuzzy match on the specified term. |
SearchResults |
getSuggestions(List<String> fields,
List<String> texts,
int max,
String predicate)
Suggests results for the given fields and text. |
IndexReader |
grabReader()
Return an index reader on the index. |
IndexSearcher |
grabSearcher()
Return an index searcher on the index. |
Index |
index()
Returns the index instance this class operates on. |
void |
index(File file,
Map<String,String> parameters)
Index the specified file with the given parameters. |
long |
lastModified()
Returns the last time an index job was requested or if none was requested the last time the index was updated. |
List<File> |
list()
Returns the list of files that have been indexed form the index content. |
List<File> |
list(Term t)
Deprecated. This method ignores the term, use list() instead. |
IndexManager |
manager()
Returns the underlying Index Manager. |
SearchResults |
query(SearchQuery query)
Makes a query to the wrapped index. |
SearchResults |
query(SearchQuery query,
SearchPaging paging)
Makes a query to the wrapped index. |
void |
releaseSilently(IndexReader reader)
Releases this reader for use by other threads silently (any exception will be ignored). |
void |
releaseSilently(IndexSearcher searcher)
Releases this searcher for use by other threads silently (any exception will be ignored). |
static Query |
toQuery(String predicate)
Returns the query for the specified predicate using the Query Parser. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IndexMaster(File directory)
directory
- the index directoryMethod Detail |
---|
public Index index()
public IndexConfig config()
public IndexManager manager()
public void index(File file, Map<String,String> parameters)
file
- The file to index.parameters
- The parameters to pass to the stylesheet.public void clear()
public SearchResults query(SearchQuery query) throws IndexException
query
- The query to make
IndexException
- Should any error while the query is made.public SearchResults query(SearchQuery query, SearchPaging paging) throws IndexException
query
- The query to makepaging
- The paging configuration
IndexException
- Should any error while the query is made.public long lastModified()
public Facet getFacet(String field, int upTo, Query query) throws IndexException, IOException
field
- the field to use as a facetupTo
- the max number of values to returnquery
- a predicate to apply on the facet (can be null or empty)
IOException
- if there was an error reading the index or creating the condition query
IndexException
- if there was an error getting the reader or searcher.@Deprecated public List<File> list(Term t) throws IOException
list()
instead.
IOException
- if there was an error getting the reader.public List<File> list() throws IOException
IOException
public SearchResults getSuggestions(List<String> fields, List<String> texts, int max, String predicate) throws IOException, IndexException
fields
- The list of fields to use.texts
- The list of term texts to use.max
- The maximum number of suggested results.predicate
- By default, assumes that it is the document type.
IOException
IndexException
public static Query toQuery(String predicate) throws IndexException
predicate
- The predicate to parse
null
.
IndexException
- should any error occurpublic IndexReader grabReader() throws IndexException
IndexException
- If thrown by index manager.public IndexSearcher grabSearcher() throws IndexException
IndexException
- If thrown by index manager.public void releaseSilently(IndexReader reader)
Provided for convenience when used inside a finally
block.
reader
- The Lucene index reader to release.public void releaseSilently(IndexSearcher searcher)
Provided for convenience when used inside a finally
block.
searcher
- The Lucene index searcher to release.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |