Class AbstractOmniSearchHandler
- java.lang.Object
-
- com.adobe.granite.omnisearch.commons.AbstractOmniSearchHandler
-
- All Implemented Interfaces:
OmniSearchHandler
,EventListener
public abstract class AbstractOmniSearchHandler extends java.lang.Object implements OmniSearchHandler, EventListener
AbstractOmniSearchHandler
is an abstract class which other can extend to provide implemenation ofOmniSearchHandler
If any Module implementsOmniSearchHandler
usingAbstractOmniSearchHandler
, 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 Modifier and Type Field Description java.lang.String
METADATA_PATH
-
Constructor Summary
Constructors Constructor Description AbstractOmniSearchHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy(ResourceResolver resolver)
This function clear the predicateSuggestionList and remove all the eventListeners.PredicateSuggestion
getLocationSuggestion(ResourceResolver resolver, I18n i18n, java.lang.String searchTerm)
Resource
getModuleConfig(ResourceResolver resolver)
Every search module will store additional configuration i.e.java.util.List<PredicateSuggestion>
getPredicateSuggestions(ResourceResolver resolver, I18n i18n, java.lang.String searchTerm)
This function provide List of Predicates that matched to current request parameters.Query
getSpellCheckQuery(ResourceResolver resolver, java.lang.String searchTerm)
This function returnsQuery
that provides spell check suggestions based on parameters provide in the request.Query
getSuggestionQuery(ResourceResolver resolver, java.lang.String searchTerm)
This function returnsQuery
that provides suggestions based on parameters provide in the request.void
init(ResourceResolver resolver)
This function intialize theResourceResolver
instace.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface javax.jcr.observation.EventListener
onEvent
-
Methods inherited from interface com.adobe.granite.omnisearch.spi.core.OmniSearchHandler
getID, getResults
-
-
-
-
Field Detail
-
METADATA_PATH
public final java.lang.String METADATA_PATH
- See Also:
- Constant Field Values
-
-
Method Detail
-
getSuggestionQuery
public Query getSuggestionQuery(ResourceResolver resolver, java.lang.String searchTerm)
This function returnsQuery
that 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:
getSuggestionQuery
in interfaceOmniSearchHandler
- Parameters:
resolver
- ResourceResolver instancesearchTerm
- text term for which suggestions are require- Returns:
Query
that returns suggestions on execution
-
getPredicateSuggestions
public java.util.List<PredicateSuggestion> getPredicateSuggestions(ResourceResolver resolver, I18n i18n, java.lang.String searchTerm)
This function provide List of Predicates that matched to current request parameters. It will match the value ofPredicateSuggestion
to the search term. Currently predicate suggestion works only if length of search term is more than MIN_SUGGESTION_REQUIRE_SIZE- Specified by:
getPredicateSuggestions
in interfaceOmniSearchHandler
- Parameters:
resolver
- ResourceResolver instancei18n
- I18n instancesearchTerm
- text term for which suggestions are require @returnList
ofPredicateSuggestion
- Returns:
List
of Predicates
-
getSpellCheckQuery
public Query getSpellCheckQuery(ResourceResolver resolver, java.lang.String searchTerm)
This function returnsQuery
that 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:
getSpellCheckQuery
in interfaceOmniSearchHandler
- Parameters:
resolver
- ResourceResolver instancesearchTerm
- text term for which suggestions are require- Returns:
Query
that returns spell check suggestion on execution.
-
getModuleConfig
public Resource getModuleConfig(ResourceResolver resolver)
Description copied from interface:OmniSearchHandler
Every search module will store additional configuration i.e.itemCardType
itemListType
to specify configuration that can be used to represent search module resources i.e. assets, sites, users, groups. This api returns such a resource that stores the config. Additionally, this allows ability to control the visibility of particular search module to a user. If a user does not have access to this resource. OmniSearch will not include this search module in its searches i.e. suggestions, search etc.- Specified by:
getModuleConfig
in interfaceOmniSearchHandler
- Parameters:
resolver
- ResourceResolver instance- Returns:
Resource
of content Node
-
getLocationSuggestion
public PredicateSuggestion getLocationSuggestion(ResourceResolver resolver, I18n i18n, java.lang.String searchTerm)
-
init
public void init(ResourceResolver resolver)
This function intialize theResourceResolver
instace. It usually called on activation ofOmniSearchHandler
or on event from implementation ofOmniSearchHandler
- Parameters:
resolver
-ResourceResolver
instance,AbstractOmniSearchHandler
expects that thisResourceResolver
will not be closed before deactivation.
-
destroy
public void destroy(ResourceResolver resolver)
This function clear the predicateSuggestionList and remove all the eventListeners. This is usually called on deactivation ofOmniSearchHandler
- Parameters:
resolver
-ResourceResolver
instance
-
-