public class CmsGallerySearchIndex extends CmsSearchIndex
限定符和类型 | 字段和说明 |
---|---|
static java.lang.String |
FOLDER_SYSTEM
The system folder.
|
static java.lang.String |
FOLDER_SYSTEM_GALLERIES
The system galleries path.
|
static java.lang.String |
FOLDER_SYTEM_MODULES
The system modules folder path.
|
static java.lang.String |
GALLERY_INDEX_NAME
The advanced gallery index name.
|
static java.lang.String |
TYPE_XMLCONTENT_GALLERIES
The gallery document type name for xml-contents.
|
static java.lang.String |
TYPE_XMLPAGE_GALLERIES
The gallery document type name for xml-pages.
|
A_PARAM_PREFIX, BACKUP_REINDEXING, DATES, DOC_META_FIELDS, EXCERPT, EXTRACT_CONTENT, IGNORE_EXPIRATION, LANGUAGEDETECTION, LUCENE_AUTO_COMMIT, LUCENE_RAM_BUFFER_SIZE_MB, LUCENE_VERSION, MAX_HITS, MAX_HITS_DEFAULT, MAX_YEAR_RANGE, PERMISSIONS, PRIORITY, PROPERTY_SEARCH_EXCLUDE_VALUE_ALL, PROPERTY_SEARCH_EXCLUDE_VALUE_GALLERY, REBUILD_MODE_AUTO, REBUILD_MODE_MANUAL, REBUILD_MODE_OFFLINE, TIME_RANGE, TYPE_XMLCONTENT, USE_ALL_LOCALE, VISITOR
ADD_PARAMETER_METHOD, INIT_CONFIGURATION_METHOD
构造器和说明 |
---|
CmsGallerySearchIndex()
Default constructor only intended to be used by the XML configuration.
|
CmsGallerySearchIndex(java.lang.String name)
Creates a new gallery search index with the given name.
|
限定符和类型 | 方法和说明 |
---|---|
protected org.apache.lucene.queries.BooleanFilter |
appendContainerTypeFilter(CmsObject cms,
org.apache.lucene.queries.BooleanFilter filter,
java.util.List<java.lang.String> containers)
Appends a container type filter to the given filter clause that matches all given container types.
|
protected org.apache.lucene.queries.BooleanFilter |
appendIgnoreSearchExclude(org.apache.lucene.queries.BooleanFilter filter,
boolean ignoreSearchExclude)
Appends the ignore search exclude property filter.
|
protected org.apache.lucene.queries.BooleanFilter |
appendLocaleFilter(CmsObject cms,
org.apache.lucene.queries.BooleanFilter filter,
java.lang.String locale)
Appends the locale filter to the given filter clause that matches the given locale.
|
protected org.apache.lucene.queries.BooleanFilter |
appendPathFilter(CmsObject cms,
org.apache.lucene.queries.BooleanFilter filter,
java.util.List<java.lang.String> roots)
Appends the a VFS path filter to the given filter clause that matches all given root paths.
|
java.util.List<java.lang.String> |
computeScopeFolders(CmsObject cms,
CmsGallerySearchParameters params)
Computes the search root folders for the given search parameters based on the search scope.
|
protected org.apache.lucene.queries.TermsFilter |
createPathFilter(java.util.Collection<java.lang.String> roots)
Creates a search filter for the given search root paths.
|
protected boolean |
excludeFromIndex(CmsObject cms,
CmsResource resource)
Checks if the provided resource should be excluded from this search index.
|
I_CmsSearchDocument |
getDocument(CmsUUID structureId)
已过时。
Use
CmsSearchIndex.getDocument(String, String) instead and provide CmsGallerySearchFieldMapping.FIELD_RESOURCE_STRUCTURE_ID as field to search in |
I_CmsDocumentFactory |
getDocumentFactory(CmsResource res)
Returns the document type factory used for the given resource in this index, or
null
in case the resource is not indexed by this index. |
protected java.util.List<java.lang.String> |
getLocaleExtendedFields(java.util.List<java.lang.String> fields,
java.util.Locale locale)
Returns a list of locale extended field names.
|
java.util.Locale |
getLocaleForResource(CmsObject cms,
CmsResource resource,
java.util.List<java.util.Locale> availableLocales)
Returns the language locale for the given resource in this index.
|
protected CmsResource |
getResource(CmsObject cms,
I_CmsSearchDocument doc)
We are overriding getResource since the default implementation uses the path to read the resource,
which doesn't work for resources in a different site.
|
java.util.List<java.lang.String> |
getSearchRootsForScope(CmsGallerySearchScope scope,
java.lang.String siteParam,
java.lang.String subSiteParam)
Gets the search roots to use for the given site/subsite parameters.
|
CmsGallerySearchResultList |
searchGallery(CmsObject cms,
CmsGallerySearchParameters params)
Performs a search on the gallery index.
|
addConfigurationParameter, addSourceName, appendCategoryFilter, appendDateCreatedFilter, appendDateLastModifiedFilter, appendResourceTypeFilter, checkConfiguration, createDateRangeFilter, createEmptyDocument, createIndexBackup, createIndexWriter, equals, extendPathFilter, generateIndexDirectory, getAnalyzer, getConfiguration, getDateRangeSpan, getDocument, getDocument, getDocument, getFieldConfiguration, getFieldConfigurationName, getIndexWriter, getLocale, getLocaleString, getMaxHits, getMultiTermQueryFilter, getMultiTermQueryFilter, getMultiTermQueryFilter, getName, getPath, getPriority, getProject, getRebuildMode, getSearcher, getSourceNames, getSources, getTermQueryFilter, hashCode, hasReadPermission, indexSearcherClose, indexSearcherClose, indexSearcherOpen, indexSearcherUpdate, indexWriterUnlock, initConfiguration, initialize, isBackupReindexing, isCheckingPermissions, isCheckingTimeRange, isCheckPermissions, isCreatingExcerpt, isEnabled, isExtractingContent, isIgnoreExpiration, isInTimeRange, isLanguageDetection, isRequireViewPermission, isSortScoring, isUpdatedIncremental, needsPermissionCheck, removeIndexBackup, removeSourceName, search, setAnalyzer, setCheckPermissions, setEnabled, setFieldConfiguration, setFieldConfigurationName, setIgnoreExpiration, setIndexWriter, setLanguageDetection, setLocale, setLocaleString, setMaxHits, setName, setProject, setRebuildMode, setRequireViewPermission, shutDown, toString
public static final java.lang.String FOLDER_SYSTEM
public static final java.lang.String FOLDER_SYSTEM_GALLERIES
public static final java.lang.String FOLDER_SYTEM_MODULES
public static final java.lang.String GALLERY_INDEX_NAME
public static final java.lang.String TYPE_XMLCONTENT_GALLERIES
public static final java.lang.String TYPE_XMLPAGE_GALLERIES
public CmsGallerySearchIndex()
It is recommended to use the constructor
as it enforces the mandatory name argument. CmsGallerySearchIndex(String)
public CmsGallerySearchIndex(java.lang.String name) throws CmsIllegalArgumentException
name
- the system-wide unique name for the search indexCmsIllegalArgumentException
- if the given name is null, empty or already taken by another search indexpublic java.util.List<java.lang.String> computeScopeFolders(CmsObject cms, CmsGallerySearchParameters params)
cms
- the current CMS contextparams
- the current search parameters@Deprecated public I_CmsSearchDocument getDocument(CmsUUID structureId)
CmsSearchIndex.getDocument(String, String)
instead and provide CmsGallerySearchFieldMapping.FIELD_RESOURCE_STRUCTURE_ID
as field to search instructureId
- the structure id of the document to retrievepublic I_CmsDocumentFactory getDocumentFactory(CmsResource res)
CmsSearchIndex
null
in case the resource is not indexed by this index.A resource is indexed if the following is all true:
getDocumentFactory
在类中 CmsSearchIndex
res
- the resource to checknull
in case the resource is not indexed by this indexCmsSearchIndex.getDocumentFactory(org.opencms.file.CmsResource)
public java.util.Locale getLocaleForResource(CmsObject cms, CmsResource resource, java.util.List<java.util.Locale> availableLocales)
getLocaleForResource
在类中 CmsSearchIndex
cms
- the current OpenCms user contextresource
- the resource to checkavailableLocales
- a list of locales supported by the resourcepublic java.util.List<java.lang.String> getSearchRootsForScope(CmsGallerySearchScope scope, java.lang.String siteParam, java.lang.String subSiteParam)
scope
- the search scopesiteParam
- the current sitesubSiteParam
- the current subsitepublic CmsGallerySearchResultList searchGallery(CmsObject cms, CmsGallerySearchParameters params) throws CmsSearchException
cms
- the current users OpenCms contextparams
- the parameters to use for the searchCmsSearchException
- if something goes wrongprotected org.apache.lucene.queries.BooleanFilter appendContainerTypeFilter(CmsObject cms, org.apache.lucene.queries.BooleanFilter filter, java.util.List<java.lang.String> containers)
In case the provided List is null or empty, the original filter is left unchanged.
The original filter parameter is extended and also provided as return value.
cms
- the current OpenCms search contextfilter
- the filter to extendcontainers
- the containers that will compose the filterprotected org.apache.lucene.queries.BooleanFilter appendIgnoreSearchExclude(org.apache.lucene.queries.BooleanFilter filter, boolean ignoreSearchExclude)
filter
- the filter to extendignoreSearchExclude
- true
if the search exclude property should be ignoredprotected org.apache.lucene.queries.BooleanFilter appendLocaleFilter(CmsObject cms, org.apache.lucene.queries.BooleanFilter filter, java.lang.String locale)
In case the provided List is null or empty, the original filter is left unchanged.
The original filter parameter is extended and also provided as return value.
cms
- the current OpenCms search contextfilter
- the filter to extendlocale
- the locale that will compose the filterprotected org.apache.lucene.queries.BooleanFilter appendPathFilter(CmsObject cms, org.apache.lucene.queries.BooleanFilter filter, java.util.List<java.lang.String> roots)
In case the provided List is null or empty, the current request context site root is appended.
The original filter parameter is extended and also provided as return value.
appendPathFilter
在类中 CmsSearchIndex
cms
- the current OpenCms search contextfilter
- the filter to extendroots
- the VFS root paths that will compose the filterprotected org.apache.lucene.queries.TermsFilter createPathFilter(java.util.Collection<java.lang.String> roots)
roots
- the search root pathsprotected boolean excludeFromIndex(CmsObject cms, CmsResource resource)
excludeFromIndex
在类中 CmsSearchIndex
cms
- the OpenCms context used for building the search indexresource
- the resource to indexprotected java.util.List<java.lang.String> getLocaleExtendedFields(java.util.List<java.lang.String> fields, java.util.Locale locale)
fields
- the field name to extendlocale
- the locale to extend the field names withprotected CmsResource getResource(CmsObject cms, I_CmsSearchDocument doc)
getResource
在类中 CmsSearchIndex
cms
- the OpenCms user context to use for permission testingdoc
- the search result document to checkCmsResource
or null
if the user is not permittedCmsSearchIndex.getResource(org.opencms.file.CmsObject, org.opencms.search.I_CmsSearchDocument)