|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--org.openprivacy.reptile.search.AbstractSearchProvider
|
+--org.openprivacy.reptile.search.impl.ArticleSearchProvider
Handles searching articles in the OM database article store.
SearchProvider,
AbstractSearchProvider| Fields inherited from interface org.openprivacy.reptile.search.SearchProvider |
STATE_NEVER_SEARCHED, STATE_SEARCH_COMPLETE, STATE_SEARCH_IN_PROGRESS |
| Constructor Summary | |
ArticleSearchProvider()
|
|
| Method Summary | |
void |
destroy()
Called before garbage collection by the SearchProviderGCThread. |
void |
record(SearchRecord record)
Get the given SearchRecord from this SearchProvider. |
void |
search(SearchRequest sr)
Run a search with a given query. |
| Methods inherited from class org.openprivacy.reptile.search.AbstractSearchProvider |
assertSearchable, getHandle, getResultCount, getSearchCompletedTime, getSearchRequest, getSearchStartTime, getState, getState, getTimeCreated, isSearchable, setResultCount, setSearchCompletedTime, setSearchRequest, setSearchStartTime, setState |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ArticleSearchProvider()
| Method Detail |
public void search(SearchRequest sr)
throws java.lang.Exception
SearchProviderRun a search with a given query. Note that some search providers may NOT finish the search here.. Specifically some search providers may take a few minutes to fill in results as results are collected. A good example of this is code that executes within a P2P network and is waiting or other peers to reply.
Only one 'search' can be run on any search provder. If you wish to run multiple searches you need to instantiate multiple SearchProviders.
If you want to develop a mutltithreaded/asynchronous SearchProvider, you should set the state to STATE_SEARCH_IN_PROGRESS, kick off any threads or async queries an then set the state to STATE_SEARCH_COMPLETE (possibly outside of the search method)
Note that when you are running this method you should synchronize around 'this' object instance. This should only be done int code that could break the search if it is requested to early.
AKA This IS thread reentrant!
SearchProviders also need to pay attention to the SearchRequest and implement any settings here. Specifically we need to pay attention to sort order, search fields, criteria, etc.
SearchProvider.search(org.openprivacy.reptile.search.SearchRequest)
public void record(SearchRecord record)
throws java.lang.Exception
SearchProviderGet the given SearchRecord from this SearchProvider.
It is important that all SearchProviders implement this method correctly.
The given implementation needs to fill in all necessary information into this SearchRecord, this includes the title, description, etc.
Note. This is basically a visitor pattern. Callers use a search provider and then fetch a record from the SearchProvider by index.
java.lang.Exception - When an invalid SearchRecord index is usedSearchProvider.record(org.openprivacy.reptile.search.SearchRecord)public void destroy()
SearchProviderCalled before garbage collection by the SearchProviderGCThread. If your search provider needs to perform any garbage collection it should do so here.
If your SearchProvider has executed an asynchronous query, it should abort this before returning.
SearchProvider.destroy()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||