|
|||||||||
| Home >> All >> com >> RuntimeCollective >> [ search overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.RuntimeCollective.search
Class SearchIndex

java.lang.Objectcom.RuntimeCollective.search.SearchIndex
- public class SearchIndex
- extends java.lang.Object
Use the SearchIndex to add/remove Searchables from the search index (addSearchable, removeSearchable).
Construct a new Criterion, giving the string to search for, e.g. "fish rubbish goat". Enclose sentences in quotes.
You add criteria to a Search, before calling Search's getResults() method.
You shouldn't make your own SearchIndex; it's made in the SearchInitialiserServlet. Get it from ((SearchIndex)RuntimeParameters.getSearchIndex()), if you need it.
- Version:
- $Id: SearchIndex.java,v 1.50 2003/09/30 15:12:55 joe Exp $
| Field Summary | |
private org.apache.lucene.analysis.Analyzer |
analyzer
|
private java.lang.String |
indexPath
|
private org.apache.lucene.queryParser.QueryParser |
queryParser
|
private java.lang.Integer |
searchIndexLock
Lock used for writing and deleting in the search index |
| Constructor Summary | |
SearchIndex(java.lang.String path,
org.apache.lucene.analysis.Analyzer a,
boolean create)
Construct a new SearchIndex; creates an IndexWriter and IndexSearcher. |
|
| Method Summary | |
boolean |
addSearchable(java.lang.Object maybeSearchable)
Add an object to the index of objects to search on, if it implements the Searchable interface. |
void |
addSearchable(com.RuntimeCollective.search.bean.Searchable searchable)
Add a Searchable object to the index of objects to search on. |
private org.apache.lucene.index.IndexReader |
getIndexReader()
Returns an IndexReader for internal use. |
private org.apache.lucene.search.IndexSearcher |
getIndexSearcher()
Returns an IndexSearcher for internal use. |
private org.apache.lucene.index.IndexWriter |
getIndexWriter()
Returns an IndexWriter for internal use. |
void |
optimize()
Optimize the search index. |
com.RuntimeCollective.search.bean.SearchResults |
performSearch(com.RuntimeCollective.search.bean.Search search)
Do the search, using the given Search's criteria. |
com.RuntimeCollective.search.bean.SearchResults |
performSearch(com.RuntimeCollective.search.bean.Search search,
int maxNoResults)
Do the search, using the given Search's criteria. |
void |
populate()
Populate the index from scratch. |
boolean |
removeSearchable(java.lang.Object maybeSearchable)
Remove an object from the index of objects to search on, if it implements the Searchable interface. |
boolean |
removeSearchable(com.RuntimeCollective.search.bean.Searchable searchable)
Remove a Searchable object from the index of objects to search on. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
queryParser
private org.apache.lucene.queryParser.QueryParser queryParser
indexPath
private java.lang.String indexPath
analyzer
private org.apache.lucene.analysis.Analyzer analyzer
searchIndexLock
private java.lang.Integer searchIndexLock
- Lock used for writing and deleting in the search index
| Constructor Detail |
SearchIndex
public SearchIndex(java.lang.String path, org.apache.lucene.analysis.Analyzer a, boolean create) throws SearchException
- Construct a new SearchIndex; creates an
IndexWriterandIndexSearcher. This should only be called from SearchInitialiserSerlet; it can be obtained by calling(SearchIndex)RuntimeParameters.getSearchIndex().
| Method Detail |
getIndexWriter
private org.apache.lucene.index.IndexWriter getIndexWriter() throws SearchException
- Returns an IndexWriter for internal use.
You must only call this from within a code block synchronized on searchIndexLock, and you must
close()the writer within the synchronized block.
getIndexReader
private org.apache.lucene.index.IndexReader getIndexReader() throws SearchException
- Returns an IndexReader for internal use.
If you mean to use the IndexReader for deleting documents, you must only call this from within a code block synchronized on searchIndexLock, and you must
close()the reader within the synchronized block.
getIndexSearcher
private org.apache.lucene.search.IndexSearcher getIndexSearcher() throws SearchException
- Returns an IndexSearcher for internal use.
Once you're finished with this IndexSearcher, you should
close()it.
performSearch
public com.RuntimeCollective.search.bean.SearchResults performSearch(com.RuntimeCollective.search.bean.Search search) throws SearchException
- Do the search, using the given
Search's criteria.
performSearch
public com.RuntimeCollective.search.bean.SearchResults performSearch(com.RuntimeCollective.search.bean.Search search, int maxNoResults) throws SearchException
- Do the search, using the given
Search's criteria.
addSearchable
public boolean addSearchable(java.lang.Object maybeSearchable) throws SearchException
- Add an object to the index of objects to search on,
if it implements the
Searchableinterface.
removeSearchable
public boolean removeSearchable(java.lang.Object maybeSearchable) throws SearchException
- Remove an object from the index of objects to search on,
if it implements the
Searchableinterface.
addSearchable
public void addSearchable(com.RuntimeCollective.search.bean.Searchable searchable) throws SearchException
- Add a Searchable object to the index of objects to search on.
The following Fields are always added:
- SearchText - all of the text that is indexed for this object. Got from searchable.getSearchText().
- SearchTitle - the title of the searchable. Got from searchable.getSearchTitle().
- SearchSummary - a short summary of the searchable's content. Got from searchable.getSearchSummary().
- ClassName - the searchable's actual className, so that the EBS can reconstruct it later
- Id - the searchable's objectId, so that the EBS can reconstruct it later
- SearchCategory - the category under which to 'file' the searchable. Got from searchable.searchCategory.
- Link - a link to display the searchable. Got from searchable.getLink().
Obtains a write lock on the search index. You must not call from within code that already has this lock!
removeSearchable
public boolean removeSearchable(com.RuntimeCollective.search.bean.Searchable searchable) throws SearchException
- Remove a Searchable object from the index of objects to search on.
Obtains a write lock on the search index. You must not call from within code that already has this lock!
populate
public void populate()
throws SearchException
- Populate the index from scratch.
optimize
public void optimize()
throws SearchException
Optimize the search index. Isn't actually used yet, as we optimize at every add, but might be useful someday. Maybe we'll stop optimizing on every add, and instead, set up an optimization timer that runs daily.
See ticket #4006.
Obtains a write lock on the search index. You must not call from within code that already has this lock!
|
|||||||||
| Home >> All >> com >> RuntimeCollective >> [ search overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.RuntimeCollective.search.SearchIndex