|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.dlese.dpc.schemedit.SearchHelper
public class SearchHelper
Class to perform searches and cache the results as well as the query and sort information. Used to provide access to search results from different JSP pages (e.g., search, view).
Constructor Summary | |
---|---|
SearchHelper(SimpleLuceneIndex index)
Constructor for the SearchHelper object |
Method Summary | |
---|---|
int |
getCachedRecIndex()
Gets the cachedRecIndex attribute of the SearchHelper object |
String |
getCurrentRecId()
gets the Cached current record id |
int |
getCurrentRecIndex()
Return the index of the current record in the searchResults |
List |
getHits()
Returns all the searchResults |
List |
getHits(int start,
int length)
Returns a range of searchResults |
int |
getIndexOf(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 |
String |
getRecId(int recIndex)
Gets the id of the result at specifiec index of search results. |
ResultDoc |
getResultDoc(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,
Object sortObj)
Description of the Method |
void |
setCachedRecIndex(int i)
Sets the cachedRecIndex attribute of the SearchHelper object |
void |
setCurrentRecId(String id)
Sets the currentRecId attribute of the RecordList object |
void |
setResults(ResultDoc resultDoc)
Sets the results to the single resultDoc provided |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SearchHelper(SimpleLuceneIndex index)
index
- NOT YET DOCUMENTEDMethod Detail |
---|
public 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 Query
public ResultDocList search(org.apache.lucene.search.Query query, Object sortObj)
query
- Description of the ParametersortObj
- Description of the Parameter
public List getHits()
public List getHits(int start, int length)
start
- beginning indexlength
- length of range
public int getIndexOf(String recId)
recId
- a record id
public boolean isEmpty()
public boolean getIsEmpty()
public int getNumHits()
public String getCurrentRecId()
public void setCurrentRecId(String id)
id
- The new currentRecId valuepublic String getRecId(int recIndex)
recIndex
- index into search results
public 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(String id)
If more than one result is found (this should not happen), print a message and return the first result.
id
- record ID
|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |