From 73c2f6be6e7ca537d2de7ce6516a7fde5954a5f2 Mon Sep 17 00:00:00 2001 From: thomas-sc Date: Tue, 19 Nov 2024 17:51:38 +0100 Subject: [PATCH] custom mappings, facettes for creator names, full text search with boosting of phrases --- Classes/Command/IndexCommand.php | 47 ++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/Classes/Command/IndexCommand.php b/Classes/Command/IndexCommand.php index 1a16f3a..be79093 100644 --- a/Classes/Command/IndexCommand.php +++ b/Classes/Command/IndexCommand.php @@ -145,15 +145,58 @@ protected function fullSync(InputInterface $input): void $index = $this->extConf['elasticIndexName']; // create a field "fulltext" and copy content of "tx_lisztcommon_searchable" to fulltext - // ToDo: stemming german in Fulltext? - // ToDo: "mappings": {"dynamic": false, // Prevents automatic mapping of all fields to then make individual fields searchable with "properties": {"first_name": { "type": "text"... + // ToDo: outsorce mapping to BibEntryMapping? + // ToDo: stemming field fulltext german in Fulltext? $mappingParams = [ 'index' => $index, 'body' => [ 'mappings' => [ + 'dynamic' => false, 'properties' => [ + 'version' => [ 'type' => 'long' ], + 'title' => [ 'type' => 'text'], + 'university' => [ 'type' => 'text'], + 'bookTitle' => [ 'type' => 'text'], + 'series' => [ 'type' => 'text', 'fields' => [ 'keyword' => [ 'type' => 'keyword', 'ignore_above' => 256 ] ] ], + 'publicationTitle' => [ 'type' => 'text', 'fields' => [ 'keyword' => [ 'type' => 'keyword', 'ignore_above' => 256 ] ] ], + 'place' => [ 'type' => 'text', 'fields' => [ 'keyword' => [ 'type' => 'keyword', 'ignore_above' => 256 ] ] ], + 'date' => [ 'type' => 'text', 'fields' => [ 'keyword' => [ 'type' => 'keyword', 'ignore_above' => 256 ] ] ], + 'archiveLocation' => [ 'type' => 'text', 'fields' => [ 'keyword' => [ 'type' => 'keyword', 'ignore_above' => 256 ] ] ], + 'itemType' => [ 'type' => 'keyword'], + 'journalTitle' => [ 'type' => 'keyword'], + 'creators' => [ + 'type' => 'nested', + 'properties' => [ + 'creatorType' => [ + 'type' => 'keyword' + ], + 'firstName' => [ + 'type' => 'text', + 'fields' => [ + 'keyword' => [ + 'type' => 'keyword', 'ignore_above' => 256 + ], + ], + 'copy_to' => 'creators.fullName' + ], + 'lastName' => [ + 'type' => 'text', + 'fields' => [ + 'keyword' => [ + 'type' => 'keyword', 'ignore_above' => 256 + ] + ], + 'copy_to' => 'creators.fullName' + ], + 'fullName' => ['type' => 'text', 'fields' => [ 'keyword' => [ 'type' => 'keyword'] ] ], + ] + ], 'fulltext' => [ 'type' => 'text' ], + 'tx_lisztcommon_header' => [ 'type' => 'text' ], + 'tx_lisztcommon_body' => [ 'type' => 'text' ], + 'tx_lisztcommon_footer' => [ 'type' => 'text' ], 'tx_lisztcommon_searchable' => ['type' => 'text', 'copy_to' => 'fulltext'], + 'tx_lisztcommon_boosted' => ['type' => 'text'], ] ] ]