summaryrefslogtreecommitdiff
path: root/src/engine/VyOSElasticModernFulltextStorageEngine.php
diff options
context:
space:
mode:
authorYuriy Andamasov <yuriy@vyos.io>2026-05-22 11:40:40 +0300
committerYuriy Andamasov <yuriy@vyos.io>2026-05-23 13:25:01 +0300
commitfc0e71e28e49d9cdc84fadfda40692bdfc415a6c (patch)
treef4fbbcc1ad390680ca45077da6d64a882155207a /src/engine/VyOSElasticModernFulltextStorageEngine.php
parent67d619a782eef8df6437525c45a63c9485c13a6a (diff)
downloadphorge-elasticsearch-modern-fc0e71e28e49d9cdc84fadfda40692bdfc415a6c.tar.gz
phorge-elasticsearch-modern-fc0e71e28e49d9cdc84fadfda40692bdfc415a6c.zip
Engine: Add buildIndexMappings() helper (single typeless mapping)
Single 'properties' block, documentType as a keyword field inside it, no include_in_all anywhere (the field was removed in ES 6). Relationships emit as keyword fields with doc_values: false, matching the bundled engine's ES-5-mode behavior. Field-data multi-analyzer shape (raw, keywords, stems) preserved. 🤖 Generated by [robots](https://vyos.io)
Diffstat (limited to 'src/engine/VyOSElasticModernFulltextStorageEngine.php')
-rw-r--r--src/engine/VyOSElasticModernFulltextStorageEngine.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/engine/VyOSElasticModernFulltextStorageEngine.php b/src/engine/VyOSElasticModernFulltextStorageEngine.php
index 316a02b..16c519c 100644
--- a/src/engine/VyOSElasticModernFulltextStorageEngine.php
+++ b/src/engine/VyOSElasticModernFulltextStorageEngine.php
@@ -48,6 +48,53 @@ abstract class VyOSElasticModernFulltextStorageEngine
);
}
+ public function buildIndexMappings(
+ array $doc_types, array $fields, array $relationships, $text_type) {
+
+ $properties = array();
+
+ foreach ($fields as $field) {
+ $properties[$field] = array(
+ 'type' => $text_type,
+ 'fields' => array(
+ 'raw' => array(
+ 'type' => $text_type,
+ 'analyzer' => 'english_exact',
+ 'search_analyzer' => 'english',
+ 'search_quote_analyzer' => 'english_exact',
+ ),
+ 'keywords' => array(
+ 'type' => $text_type,
+ 'analyzer' => 'letter_stop',
+ ),
+ 'stems' => array(
+ 'type' => $text_type,
+ 'analyzer' => 'english_stem',
+ ),
+ ),
+ );
+ }
+
+ foreach ($relationships as $rel) {
+ $properties[$rel] = array(
+ 'type' => 'keyword',
+ 'doc_values' => false,
+ );
+ $properties[$rel.'_ts'] = array(
+ 'type' => 'date',
+ );
+ }
+
+ $properties['documentType'] = array('type' => 'keyword');
+ $properties['dateCreated'] = array('type' => 'date');
+ $properties['lastModified'] = array('type' => 'date');
+
+ // The $doc_types parameter is part of the signature for symmetry
+ // with the bundled engine's per-type loop, but the typeless API
+ // emits one mapping shared across all doc types.
+ return array('properties' => $properties);
+ }
+
public function getEngineIdentifier() {
return 'elasticsearch-modern';
}