Class AbstractOmniSearchHandler
java.lang.Object
com.adobe.granite.omnisearch.commons.AbstractOmniSearchHandler
- All Implemented Interfaces:
OmniSearchHandler,EventListener
public abstract class AbstractOmniSearchHandler
extends Object
implements OmniSearchHandler, EventListener
AbstractOmniSearchHandler is an abstract class
which other can extend to provide implemenation of OmniSearchHandler
If any Module implements OmniSearchHandler using AbstractOmniSearchHandler ,
It needs to create contentNode under path METADATA_PATH. And provide all the property details in that Node.
Properties:
- IS_SUGGESTABLE_PROPERTY
- Property that decide if Predicate should be used in predicate suggestions
- METADAT_PATH
- PATH where metadata of all the modules will be stored
- NODE_TYPE_PROPERTY
- Resource type of Module (eg. dam:Asset)
- OPTION_PATH_PROPERTY
- optionPath property of a Predicate
- PREDICATE_PATH_PROPERTY
- property that stores Predicate Path in METADATA Node
- DEFAULT_SEARCH_PATH_PROPERTY
- property that stores Default Search Path in METADATA Node
- PREDICATE_TYPE_PROPERTY
- property that identifies type of Predicate
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy(ResourceResolver resolver) Deprecated.Removed without replacement (it always was an empty method)getLocationSuggestion(ResourceResolver resolver, I18n i18n, String searchTerm) getModuleConfig(ResourceResolver resolver) Return the moduleConfiguration resource for this handler.getPredicateSuggestions(ResourceResolver resolver, I18n i18n, String searchTerm) This function provide List of Predicates that matched to current request parameters.getSpellCheckQuery(ResourceResolver resolver, String searchTerm) This function returnsQuerythat provides spell check suggestions based on parameters provide in the request.getSuggestionQuery(ResourceResolver resolver, String searchTerm) This function returnsQuerythat provides suggestions based on parameters provide in the request.voidinit(ResourceResolver resolver) Deprecated.Useinitializeinstead.voidinitialize(ResourceResolver resolver) initialize the AbstractOmniSearchHandler.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.jcr.observation.EventListener
onEventMethods inherited from interface com.adobe.granite.omnisearch.spi.core.OmniSearchHandler
getID, getResults
-
Field Details
-
METADATA_PATH
- See Also:
-
-
Constructor Details
-
AbstractOmniSearchHandler
public AbstractOmniSearchHandler()
-
-
Method Details
-
getSuggestionQuery
This function returnsQuerythat provides suggestions based on parameters provide in the request. It will look for "fulltext" paramter in request and "fulltext" parameter will treated as search term. Based on this search term suggestion query will be created.- Specified by:
getSuggestionQueryin interfaceOmniSearchHandler- Parameters:
resolver- ResourceResolver instancesearchTerm- text term for which suggestions are require- Returns:
Querythat returns suggestions on execution
-
getPredicateSuggestions
public List<PredicateSuggestion> getPredicateSuggestions(ResourceResolver resolver, I18n i18n, String searchTerm) This function provide List of Predicates that matched to current request parameters. It will match the value ofPredicateSuggestionto the search term. Currently predicate suggestion works only if length of search term is more than MIN_SUGGESTION_REQUIRE_SIZE- Specified by:
getPredicateSuggestionsin interfaceOmniSearchHandler- Parameters:
resolver- ResourceResolver instancei18n- I18n instancesearchTerm- text term for which suggestions are require @returnListofPredicateSuggestion- Returns:
Listof Predicates
-
getSpellCheckQuery
This function returnsQuerythat provides spell check suggestions based on parameters provide in the request. It will look for "fulltext" paramter in request and "fulltext" parameter will treated as search term. Based on this search term spell check query will be created.- Specified by:
getSpellCheckQueryin interfaceOmniSearchHandler- Parameters:
resolver- ResourceResolver instancesearchTerm- text term for which suggestions are require- Returns:
Querythat returns spell check suggestion on execution.
-
getLocationSuggestion
public PredicateSuggestion getLocationSuggestion(ResourceResolver resolver, I18n i18n, String searchTerm) -
getModuleConfig
Return the moduleConfiguration resource for this handler.- Specified by:
getModuleConfigin interfaceOmniSearchHandler- Parameters:
resolver- the resourceResolver to use- Returns:
- the resource where the configuration is stored.
-
init
Deprecated.Useinitializeinstead.This function intialize theResourceResolverinstace. It usually called on activation ofOmniSearchHandleror on event from implementation ofOmniSearchHandler- Parameters:
resolver-ResourceResolverinstance,AbstractOmniSearchHandlerexpects that thisResourceResolverwill not be closed before deactivation.
-
initialize
initialize the AbstractOmniSearchHandler.- Parameters:
resolver- a ResourceResolver to read the relevant information from the repository. After calling this method the resolver can be closed, it's not expected to keep it open.
-
destroy
Deprecated.Removed without replacement (it always was an empty method)This function clear the predicateSuggestionList and remove all the eventListeners. This is usually called on deactivation ofOmniSearchHandler- Parameters:
resolver-ResourceResolverinstance
-