summaryrefslogtreecommitdiff
path: root/www/wiki/includes/search/DummySearchIndexFieldDefinition.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/includes/search/DummySearchIndexFieldDefinition.php')
-rw-r--r--www/wiki/includes/search/DummySearchIndexFieldDefinition.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/www/wiki/includes/search/DummySearchIndexFieldDefinition.php b/www/wiki/includes/search/DummySearchIndexFieldDefinition.php
new file mode 100644
index 00000000..3ee3ed5a
--- /dev/null
+++ b/www/wiki/includes/search/DummySearchIndexFieldDefinition.php
@@ -0,0 +1,30 @@
+<?php
+
+/**
+ * Dummy implementation of SearchIndexFieldDefinition for testing purposes.
+ *
+ * @since 1.28
+ */
+class DummySearchIndexFieldDefinition extends SearchIndexFieldDefinition {
+
+ /**
+ * @param SearchEngine $engine
+ *
+ * @return array
+ */
+ public function getMapping( SearchEngine $engine ) {
+ $mapping = [
+ 'name' => $this->name,
+ 'type' => $this->type,
+ 'flags' => $this->flags,
+ 'subfields' => []
+ ];
+
+ foreach ( $this->subfields as $subfield ) {
+ $mapping['subfields'][] = $subfield->getMapping( $engine );
+ }
+
+ return $mapping;
+ }
+
+}