Package com.liferay.portal.kernel.search
Class BaseIndexer<T>
Object
com.liferay.portal.kernel.search.BaseIndexer<T>
- All Implemented Interfaces:
Indexer<T>
- Direct Known Subclasses:
BaseSearcher
- Author:
- Brian Wing Shun Chan, Hugo Huijser, Ryan Park, Raymond Augé
-
Field Summary
Fields inherited from interface com.liferay.portal.kernel.search.Indexer
DEFAULT_INTERVAL
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addDefaultHighlightFieldNames
(QueryConfig queryConfig) protected void
addDefaultSelectedFieldNames
(SearchContext searchContext) protected void
addFacetClause
(SearchContext searchContext, BooleanFilter facetBooleanFilter, Collection<Facet> facets) Deprecated.As of Wilberforce (7.0.x)protected void
addFacetSelectedFieldNames
(SearchContext searchContext, QueryConfig queryConfig) protected void
addLocalizedField
(Document document, String field, Locale siteDefaultLocale, Map<Locale, String> map) protected void
addSearchAssetCategoryIds
(BooleanFilter queryBooleanFilter, SearchContext searchContext) protected void
addSearchAssetTagNames
(BooleanFilter queryBooleanFilter, SearchContext searchContext) protected Filter
addSearchClassTypeIds
(BooleanFilter contextBooleanFilter, SearchContext searchContext) protected void
addSearchEntryClassNames
(BooleanFilter queryBooleanFilter, SearchContext searchContext) addSearchExpando
(BooleanQuery searchQuery, SearchContext searchContext, String keywords) protected void
addSearchFolderId
(BooleanFilter queryBooleanFilter, SearchContext searchContext) addSearchKeywords
(BooleanQuery searchQuery, SearchContext searchContext) protected void
addSearchLayout
(BooleanFilter queryBooleanFilter, SearchContext searchContext) addSearchLocalizedTerm
(BooleanQuery searchQuery, SearchContext searchContext, String field, boolean like) protected Query
addSearchTerm
(BooleanQuery searchQuery, SearchContext searchContext, String field, boolean like) protected void
addSearchUserId
(BooleanFilter queryBooleanFilter, SearchContext searchContext) protected void
addSelectedLocalizedFieldNames
(Set<String> selectedFieldNames, String... languageIds) protected void
addStagingGroupKeyword
(Document document, long groupId) protected void
addStatus
(BooleanFilter contextBooleanFilter, SearchContext searchContext) protected BooleanQuery
createFullQuery
(BooleanFilter fullQueryBooleanFilter, SearchContext searchContext) protected Summary
createSummary
(Document document) protected Summary
createSummary
(Document document, String titleField, String contentField) void
void
protected void
deleteDocument
(long companyId, long field1) protected void
deleteDocument
(long companyId, long field1, String field2) protected void
deleteDocument
(long companyId, String field1) protected void
deleteDocument
(long companyId, String field1, String field2) protected abstract void
protected abstract Document
doGetDocument
(T object) protected String
doGetSortField
(String orderByCol) Deprecated.As of Judson (7.1.x), replaced bycom.liferay.portal.search.contributor.sort.SortFieldTranslator
protected abstract Summary
doGetSummary
(Document document, Locale locale, String snippet, PortletRequest portletRequest, PortletResponse portletResponse) protected void
doPostProcessSearchQuery
(Indexer<?> indexer, BooleanQuery searchQuery, SearchContext searchContext) Deprecated.As of Wilberforce (7.0.x), added strictly to support backwards compatibility ofIndexer.postProcessSearchQuery(BooleanQuery, SearchContext)
protected abstract void
protected abstract void
protected abstract void
protected Hits
doSearch
(SearchContext searchContext) boolean
protected Document
getBaseModelDocument
(String portletId, BaseModel<?> baseModel) protected Document
getBaseModelDocument
(String portletId, BaseModel<?> baseModel, BaseModel<?> workflowedBaseModel) protected String
getClassName
(SearchContext searchContext) protected String[]
protected String[]
getDocument
(T object) protected String
getExpandoFieldName
(SearchContext searchContext, ExpandoBridge expandoBridge, String attributeName) protected List<ExpandoQueryContributor>
getFacetBooleanFilter
(String className, SearchContext searchContext) getFullQuery
(SearchContext searchContext) protected Locale
getLocale
(PortletRequest portletRequest) getLocalizedCountryNames
(Country country) String[]
protected Group
getSiteGroup
(long groupId) protected long
getSiteGroupId
(long groupId) protected Locale
getSnippetLocale
(Document document, Locale locale) getSortField
(String orderByCol) Deprecated.As of Judson (7.1.x), replaced by#getSortField
getSummary
(Document document, String snippet, PortletRequest portletRequest, PortletResponse portletResponse) int
hashCode()
boolean
hasPermission
(PermissionChecker permissionChecker, String entryClassName, long entryClassPK, String actionId) boolean
boolean
Returntrue
if the indexer participates in post-search result filtering.boolean
boolean
Returnstrue
if the indexer adds permission related filters to the search query prior to executionboolean
boolean
protected boolean
isStagingGroup
(long groupId) protected boolean
isUseSearchResultPermissionFilter
(SearchContext searchContext) protected boolean
isVisible
(int entryStatus, int queryStatus) boolean
isVisible
(long classPK, int status) protected Document
protected void
populateAddresses
(Document document, List<Address> addresses, long regionId, long countryId) populateMap
(AssetEntry assetEntry, Map<Locale, String> map) void
postProcessContextBooleanFilter
(BooleanFilter contextBooleanFilter, SearchContext searchContext) void
postProcessContextQuery
(BooleanQuery contextQuery, SearchContext searchContext) Deprecated.As of Wilberforce (7.0.x), replaced bypostProcessContextBooleanFilter(BooleanFilter, SearchContext)
protected void
postProcessFullQuery
(BooleanQuery fullQuery, SearchContext searchContext) void
postProcessSearchQuery
(BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter, SearchContext searchContext) void
postProcessSearchQuery
(BooleanQuery searchQuery, SearchContext searchContext) Deprecated.As of Wilberforce (7.0.x), replaced bypostProcessSearchQuery(BooleanQuery, BooleanFilter, SearchContext)
protected void
processHits
(SearchContext searchContext, Hits hits) void
void
void
reindex
(Collection<T> collection) void
protected void
resetFullQuery
(SearchContext searchContext) search
(SearchContext searchContext) search
(SearchContext searchContext, String... selectedFieldNames) long
searchCount
(SearchContext searchContext) void
setCommitImmediately
(boolean commitImmediately) protected void
setDefaultSelectedFieldNames
(String... defaultLocalizedFieldNames) protected void
setDefaultSelectedLocalizedFieldNames
(String... defaultLocalizedFieldNames) protected void
setFilterSearch
(boolean filterSearch) void
setIndexerEnabled
(boolean indexerEnabled) protected void
setPermissionAware
(boolean permissionAware) void
setSelectAllLocales
(boolean selectAllLocales) protected void
setStagingAware
(boolean stagingAware) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.liferay.portal.kernel.search.Indexer
getClassName, getCompanyId, getSummary, reindex
-
Constructor Details
-
BaseIndexer
public BaseIndexer()
-
-
Method Details
-
delete
- Specified by:
delete
in interfaceIndexer<T>
- Throws:
SearchException
-
delete
- Specified by:
delete
in interfaceIndexer<T>
- Throws:
SearchException
-
equals
-
getDocument
- Specified by:
getDocument
in interfaceIndexer<T>
- Throws:
SearchException
-
getFacetBooleanFilter
public BooleanFilter getFacetBooleanFilter(String className, SearchContext searchContext) throws Exception - Specified by:
getFacetBooleanFilter
in interfaceIndexer<T>
- Throws:
Exception
-
getFullQuery
- Specified by:
getFullQuery
in interfaceIndexer<T>
- Throws:
SearchException
-
getIndexerPostProcessors
- Specified by:
getIndexerPostProcessors
in interfaceIndexer<T>
-
getSearchClassNames
- Specified by:
getSearchClassNames
in interfaceIndexer<T>
-
getSortField
Deprecated.As of Judson (7.1.x), replaced by#getSortField
- Specified by:
getSortField
in interfaceIndexer<T>
-
getSummary
public Summary getSummary(Document document, String snippet, PortletRequest portletRequest, PortletResponse portletResponse) throws SearchException - Specified by:
getSummary
in interfaceIndexer<T>
- Throws:
SearchException
-
hashCode
public int hashCode() -
hasPermission
public boolean hasPermission(PermissionChecker permissionChecker, String entryClassName, long entryClassPK, String actionId) throws Exception - Specified by:
hasPermission
in interfaceIndexer<T>
- Throws:
Exception
-
isCommitImmediately
public boolean isCommitImmediately()- Specified by:
isCommitImmediately
in interfaceIndexer<T>
-
isFilterSearch
public boolean isFilterSearch()Description copied from interface:Indexer
Returntrue
if the indexer participates in post-search result filtering.- Specified by:
isFilterSearch
in interfaceIndexer<T>
- Returns:
true
if the indexer participates in post-search result filtering;false
otherwise- See Also:
-
isIndexerEnabled
public boolean isIndexerEnabled()- Specified by:
isIndexerEnabled
in interfaceIndexer<T>
-
isPermissionAware
public boolean isPermissionAware()Description copied from interface:Indexer
Returnstrue
if the indexer adds permission related filters to the search query prior to execution- Specified by:
isPermissionAware
in interfaceIndexer<T>
- Returns:
true
if the indexer adds permission related filters to the search query prior to execution;false
otherwise- See Also:
-
isSelectAllLocales
public boolean isSelectAllLocales() -
isStagingAware
public boolean isStagingAware()- Specified by:
isStagingAware
in interfaceIndexer<T>
-
isVisible
-
postProcessContextBooleanFilter
public void postProcessContextBooleanFilter(BooleanFilter contextBooleanFilter, SearchContext searchContext) throws Exception - Specified by:
postProcessContextBooleanFilter
in interfaceIndexer<T>
- Throws:
Exception
-
postProcessContextQuery
@Deprecated public void postProcessContextQuery(BooleanQuery contextQuery, SearchContext searchContext) throws Exception Deprecated.As of Wilberforce (7.0.x), replaced bypostProcessContextBooleanFilter(BooleanFilter, SearchContext)
- Specified by:
postProcessContextQuery
in interfaceIndexer<T>
- Throws:
Exception
-
postProcessSearchQuery
public void postProcessSearchQuery(BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter, SearchContext searchContext) throws Exception - Specified by:
postProcessSearchQuery
in interfaceIndexer<T>
- Throws:
Exception
-
postProcessSearchQuery
@Deprecated public void postProcessSearchQuery(BooleanQuery searchQuery, SearchContext searchContext) throws Exception Deprecated.As of Wilberforce (7.0.x), replaced bypostProcessSearchQuery(BooleanQuery, BooleanFilter, SearchContext)
- Specified by:
postProcessSearchQuery
in interfaceIndexer<T>
- Throws:
Exception
-
reindex
-
reindex
- Specified by:
reindex
in interfaceIndexer<T>
- Throws:
SearchException
-
reindex
- Specified by:
reindex
in interfaceIndexer<T>
- Throws:
SearchException
-
reindex
- Specified by:
reindex
in interfaceIndexer<T>
- Throws:
SearchException
-
search
- Specified by:
search
in interfaceIndexer<T>
- Throws:
SearchException
-
search
public Hits search(SearchContext searchContext, String... selectedFieldNames) throws SearchException - Specified by:
search
in interfaceIndexer<T>
- Throws:
SearchException
-
searchCount
- Specified by:
searchCount
in interfaceIndexer<T>
- Throws:
SearchException
-
setCommitImmediately
public void setCommitImmediately(boolean commitImmediately) -
setIndexerEnabled
public void setIndexerEnabled(boolean indexerEnabled) - Specified by:
setIndexerEnabled
in interfaceIndexer<T>
-
setSelectAllLocales
public void setSelectAllLocales(boolean selectAllLocales) -
addDefaultHighlightFieldNames
-
addDefaultSelectedFieldNames
-
addFacetClause
@Deprecated protected void addFacetClause(SearchContext searchContext, BooleanFilter facetBooleanFilter, Collection<Facet> facets) throws ParseException Deprecated.As of Wilberforce (7.0.x)- Throws:
ParseException
-
addFacetSelectedFieldNames
-
addLocalizedField
-
addSearchAssetCategoryIds
protected void addSearchAssetCategoryIds(BooleanFilter queryBooleanFilter, SearchContext searchContext) throws Exception - Throws:
Exception
-
addSearchAssetTagNames
protected void addSearchAssetTagNames(BooleanFilter queryBooleanFilter, SearchContext searchContext) throws Exception - Throws:
Exception
-
addSearchClassTypeIds
protected Filter addSearchClassTypeIds(BooleanFilter contextBooleanFilter, SearchContext searchContext) throws Exception - Throws:
Exception
-
addSearchEntryClassNames
protected void addSearchEntryClassNames(BooleanFilter queryBooleanFilter, SearchContext searchContext) throws Exception - Throws:
Exception
-
addSearchExpando
protected Map<String,Query> addSearchExpando(BooleanQuery searchQuery, SearchContext searchContext, String keywords) throws Exception - Throws:
Exception
-
addSearchFolderId
protected void addSearchFolderId(BooleanFilter queryBooleanFilter, SearchContext searchContext) throws Exception - Throws:
Exception
-
addSearchKeywords
protected Map<String,Query> addSearchKeywords(BooleanQuery searchQuery, SearchContext searchContext) throws Exception - Throws:
Exception
-
addSearchLayout
protected void addSearchLayout(BooleanFilter queryBooleanFilter, SearchContext searchContext) throws Exception - Throws:
Exception
-
addSearchLocalizedTerm
protected Map<String,Query> addSearchLocalizedTerm(BooleanQuery searchQuery, SearchContext searchContext, String field, boolean like) throws Exception - Throws:
Exception
-
addSearchTerm
protected Query addSearchTerm(BooleanQuery searchQuery, SearchContext searchContext, String field, boolean like) throws Exception - Throws:
Exception
-
addSearchUserId
protected void addSearchUserId(BooleanFilter queryBooleanFilter, SearchContext searchContext) throws Exception - Throws:
Exception
-
addSelectedLocalizedFieldNames
-
addStagingGroupKeyword
-
addStatus
protected void addStatus(BooleanFilter contextBooleanFilter, SearchContext searchContext) throws Exception - Throws:
Exception
-
createFullQuery
protected BooleanQuery createFullQuery(BooleanFilter fullQueryBooleanFilter, SearchContext searchContext) throws Exception - Throws:
Exception
-
createSummary
-
createSummary
-
deleteDocument
- Throws:
Exception
-
deleteDocument
- Throws:
Exception
-
deleteDocument
- Throws:
Exception
-
deleteDocument
- Throws:
Exception
-
doDelete
- Throws:
Exception
-
doGetDocument
- Throws:
Exception
-
doGetSortField
Deprecated.As of Judson (7.1.x), replaced bycom.liferay.portal.search.contributor.sort.SortFieldTranslator
-
doGetSummary
protected abstract Summary doGetSummary(Document document, Locale locale, String snippet, PortletRequest portletRequest, PortletResponse portletResponse) throws Exception - Throws:
Exception
-
doPostProcessSearchQuery
@Deprecated protected void doPostProcessSearchQuery(Indexer<?> indexer, BooleanQuery searchQuery, SearchContext searchContext) throws Exception Deprecated.As of Wilberforce (7.0.x), added strictly to support backwards compatibility ofIndexer.postProcessSearchQuery(BooleanQuery, SearchContext)
- Throws:
Exception
-
doReindex
- Throws:
Exception
-
doReindex
- Throws:
Exception
-
doReindex
- Throws:
Exception
-
doSearch
- Throws:
SearchException
-
getBaseModelDocument
-
getBaseModelDocument
-
getClassName
-
getDefaultSelectedFieldNames
-
getDefaultSelectedLocalizedFieldNames
-
getExpandoFieldName
protected String getExpandoFieldName(SearchContext searchContext, ExpandoBridge expandoBridge, String attributeName) -
getExpandoQueryContributors
-
getLocale
-
getLocalizedCountryNames
-
getSiteGroup
-
getSiteGroupId
protected long getSiteGroupId(long groupId) -
getSnippetLocale
-
isStagingGroup
protected boolean isStagingGroup(long groupId) -
isUseSearchResultPermissionFilter
-
isVisible
protected boolean isVisible(int entryStatus, int queryStatus) -
newDocument
-
populateAddresses
protected void populateAddresses(Document document, List<Address> addresses, long regionId, long countryId) throws PortalException - Throws:
PortalException
-
populateMap
-
postProcessFullQuery
protected void postProcessFullQuery(BooleanQuery fullQuery, SearchContext searchContext) throws Exception - Throws:
Exception
-
processHits
- Throws:
SearchException
-
resetFullQuery
-
setDefaultSelectedFieldNames
-
setDefaultSelectedLocalizedFieldNames
-
setFilterSearch
protected void setFilterSearch(boolean filterSearch) -
setPermissionAware
protected void setPermissionAware(boolean permissionAware) -
setStagingAware
protected void setStagingAware(boolean stagingAware)
-