Package com.levigo.jadice.search.engine
Class SearchEngineRegistry
- java.lang.Object
-
- com.levigo.jadice.search.engine.SearchEngineRegistry
-
public final class SearchEngineRegistry extends Object
TheSearchEngineRegistry
manages the registeredSearchEngine
s. Therefore SearchEngines can be registered with a priority (registerSearchEngine(SearchEngine, int)
) and can also be deregistered individually (deregisterSearchEngine(SearchEngine)
).By default the
JadiceSearchEngine
is registered. Even if JadiceSearchEngine is deregistered, it will still be used if no matching SearchEngine is found for a requested search.From the registered SearchEngines the best one for a search with the specified
SearchConfiguration
is determined (getBestSearchEngine(SearchConfiguration, Boolean)
).
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
changePriority(SearchEngine searchEngine, int priority)
Change the priority of a already registered SearchEngine.void
deregisterSearchEngine(SearchEngine searchEngine)
If the SearchEngine is registered the SearchEngine gets deregistered.boolean
executableSearchEngine(SearchConfiguration searchConfiguration)
It gets checked whether at least one of the registered search engines is executable for the current SearchConfiguration.SearchEngine
getBestSearchEngine(SearchConfiguration searchConfiguration, Boolean considerFeasibility)
Determines the best SearchEngine for this search based on the Quality.static SearchEngineRegistry
getInstance()
int
getPriority(SearchEngine searchEngine)
Retrieve the priority of a given search engineCollection<SearchEngine>
getRegisteredEngines()
void
registerSearchEngine(SearchEngine searchEngine, int priority)
SearchEngines get registered if they are not already registered.
-
-
-
Method Detail
-
getInstance
public static SearchEngineRegistry getInstance()
-
getBestSearchEngine
public SearchEngine getBestSearchEngine(SearchConfiguration searchConfiguration, Boolean considerFeasibility)
Determines the best SearchEngine for this search based on the Quality. If no SearchEngine is found for the search, then jadice search is used as a fallback.- Parameters:
searchConfiguration
- provides information about the demanded searchconsiderFeasibility
- specifies whether the feasibility of aSearchEngine
should be taken into account
-
registerSearchEngine
public void registerSearchEngine(SearchEngine searchEngine, int priority)
SearchEngines get registered if they are not already registered.- Parameters:
searchEngine
- the SearchEngine to be registeredpriority
- the priority of the SearchEngine
-
deregisterSearchEngine
public void deregisterSearchEngine(SearchEngine searchEngine)
If the SearchEngine is registered the SearchEngine gets deregistered.- Parameters:
searchEngine
- the SearchEngine to be deregistered
-
changePriority
public void changePriority(SearchEngine searchEngine, int priority)
Change the priority of a already registered SearchEngine.- Parameters:
searchEngine
- the SearchEngine whose priority is being changedpriority
- the new priority
-
getRegisteredEngines
public Collection<SearchEngine> getRegisteredEngines()
- Returns:
- a collection of registered SearchEngines
-
getPriority
public int getPriority(SearchEngine searchEngine)
Retrieve the priority of a given search engine- Parameters:
searchEngine
- The search engine for which the priority shall be retrieved- Returns:
- The priority if the search engine is registered, otherwise -1
-
executableSearchEngine
public boolean executableSearchEngine(SearchConfiguration searchConfiguration)
It gets checked whether at least one of the registered search engines is executable for the current SearchConfiguration. If no SearchEngine is registered, theJadiceSearchEngine
, which is then set by default, is checked for feasibility.- Returns:
- true if at least one executable SearchEngine is available, false otherwise
-
-