summaryrefslogtreecommitdiff
path: root/www/wiki/includes/search/DummySearchIndexFieldDefinition.php
blob: 3ee3ed5ad0335945908fc5a332f7907f34452333 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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;
	}

}