sitegeist/taxonomy-elasticsearch

dev-master 2022-04-01 12:18 UTC

This package is auto-updated.

Last update: 2024-08-29 04:37:47 UTC


README

Sitegeist.Taxonomy的Elasticsearch集成

本软件包配置了分类节点的Elasticsearch索引,并提供了一个用于自定义索引配置的EEL助手。它还提供了一个用于分类感知的Elasticsearch查询的EEL助手。

状态

这目前是实验性代码,因此请不要依赖本软件包的任何部分。

作者与赞助商

本软件包的开发和公开发布得到了我们雇主http://www.sitegeist.de的慷慨赞助。

EEL助手

分类索引

  • TaxonomyIndexing.extractIdentifierAndParentIdentifiers() 获取包括给定分类节点所有父分类的分类标识符数组

分类搜索

找到与全文查询匹配的分类。

# Build searchQuery
searchQuery = ${Search.query( Taxonomy.root() ).fulltext( searchTerm ).nodeType('Sitegeist.Taxonomy:Taxonomy')}

# Number of serach results
totalSearchResults = ${this.searchQuery.count()}

# Execute query
searchResults = ${this.searchQuery.execute()}

通常您想将分类的搜索与文档搜索结合起来。以下示例将找到通过全文匹配的术语或引用匹配全文查询的分类的结果。

# Array with IDs of taxonomies that match the term
@context.taxonomyIds = ${this.taxonomies}
@context.taxonomyIds.@process.convertToIds = Neos.Fusion:RawCollection {
    collection = ${Search.query( Taxonomy.root() ).fulltext( searchTerm ).nodeType('Sitegeist.Taxonomy:Taxonomy').execute().toArray()}
    itemName = 'taxon'
    itemRenderer = ${q(taxon).property('_identifier')}
}

# Find documents that either match fulltext or are assigned to a taxon that matched

# Build searchQuery
searchQuery = ${Search.query(site).nodeType('Neos.Neos:Document').limit(100)}

# Append setting to get results with a minimum match of 1
searchQuery.@process.setMinimumShouldMatch = ${value.request('query.filtered.query.bool.minimum_should_match', 1)}

# Append query with fulltext string search term
searchQuery.@process.setTermCondition = ${value.request('query.filtered.query.bool.should', [{'query_string': {'query': searchTerm}}])}

# Append query with search by taxonomy (if any)
searchQuery.@process.setTaxonomyCondition = ${value.appendAtPath('query.filtered.query.bool.should', {'terms': {'taxonomyReferences':taxonomyIds}})}
searchQuery.@process.setTaxonomyCondition.@if.has = ${taxonomyIds ? true : false}

# Number of serach results
totalSearchResults = ${this.searchQuery.count()}

# Execute query
searchResults = ${this.searchQuery.execute()}

分类索引

分类的标题和描述字段被添加到全文索引中。

贡献

我们非常欢迎贡献。请发送给我们pull请求。

许可

LICENSE