public class SearchHelper
extends java.lang.Object
Constructor and Description |
---|
SearchHelper(SimpleLuceneIndex index)
Constructor for the SearchHelper object
|
Modifier and Type | Method and Description |
---|---|
int |
getCachedRecIndex()
Gets the cachedRecIndex attribute of the SearchHelper object
|
java.lang.String |
getCurrentRecId()
gets the Cached current record id
|
int |
getCurrentRecIndex()
Return the index of the current record in the searchResults
|
java.util.List |
getHits()
Returns all the searchResults
|
java.util.List |
getHits(int start,
int length)
Returns a range of searchResults
|
int |
getIndexOf(java.lang.String recId)
gets the index in the searchResults for the record having provided id.
|
boolean |
getIsEmpty()
Convienence caller of isEmpty for jsp pages.
|
int |
getNumHits()
Gets the number of searchResult items
|
java.lang.String |
getRecId(int recIndex)
Gets the id of the result at specifiec index of search results.
|
ResultDoc |
getResultDoc(java.lang.String id)
Gets the ResultDoc for given record id from the index, returning null if a
result is not found.
|
ResultDocList |
getResults()
Returns the current searchResults, doing a fresh search and sort if the
index has changed since the searchResults were calculated.
|
boolean |
isEmpty()
Returns true if there are no searchResults
|
ResultDocList |
search(org.apache.lucene.search.Query query)
Return the results of search with the provided query, performing new search
only if a new query string is provided or if the index has changed since
the last search.
|
ResultDocList |
search(org.apache.lucene.search.Query query,
java.lang.Object sortObj)
Description of the Method
|
void |
setCachedRecIndex(int i)
Sets the cachedRecIndex attribute of the SearchHelper object
|
void |
setCurrentRecId(java.lang.String id)
Sets the currentRecId attribute of the RecordList object
|
void |
setResults(ResultDoc resultDoc)
Sets the results to the single resultDoc provided
|
public SearchHelper(SimpleLuceneIndex index)
index
- NOT YET DOCUMENTEDpublic ResultDocList getResults()
When do we FORCE a new search?? - during sort (where the sort may have changed, but the index has not, so search would not have otherwise have been performed. NOTE: we could also force search by reseting the lastIndexMod to -1!
RETHINK this logic. why cache anything? why not just return the searchResults or an empty list??
public ResultDocList search(org.apache.lucene.search.Query query)
query
- the lucene Querypublic ResultDocList search(org.apache.lucene.search.Query query, java.lang.Object sortObj)
query
- Description of the ParametersortObj
- Description of the Parameterpublic java.util.List getHits()
public java.util.List getHits(int start, int length)
start
- beginning indexlength
- length of rangepublic int getIndexOf(java.lang.String recId)
recId
- a record idpublic boolean isEmpty()
public boolean getIsEmpty()
public int getNumHits()
public java.lang.String getCurrentRecId()
public void setCurrentRecId(java.lang.String id)
id
- The new currentRecId valuepublic java.lang.String getRecId(int recIndex)
recIndex
- index into search resultspublic int getCurrentRecIndex()
public int getCachedRecIndex()
public void setCachedRecIndex(int i)
i
- The new cachedRecIndex valuepublic void setResults(ResultDoc resultDoc)
resultDoc
- The new results valuepublic ResultDoc getResultDoc(java.lang.String id)
If more than one result is found (this should not happen), print a message and return the first result.
id
- record ID