Completed
Pull Request — master (#12)
by Robbie
02:28
created
src/Model/CwpSearchIndex.php 1 patch
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -18,88 +18,88 @@
 block discarded – undo
18 18
 abstract class CwpSearchIndex extends SolrIndex
19 19
 {
20 20
 
21
-    /**
22
-     * Copy all fields into both search and spellcheck data source
23
-     *
24
-     * @var array
25
-     * @config
26
-     */
27
-    private static $copy_fields = [
28
-        '_text',
29
-        '_spellcheckText',
30
-    ];
21
+	/**
22
+	 * Copy all fields into both search and spellcheck data source
23
+	 *
24
+	 * @var array
25
+	 * @config
26
+	 */
27
+	private static $copy_fields = [
28
+		'_text',
29
+		'_spellcheckText',
30
+	];
31 31
 
32
-    /**
33
-     * Default dictionary to use. This will overwrite the 'spellcheck.dictionary' option for searches given,
34
-     * unless set to empty.
35
-     *
36
-     * '_spellcheck' is a predefined by the cwp infrastructure, which is configured
37
-     * to be built from the '_spellcheckText' field. You can't rename this within CWP.
38
-     *
39
-     * @var string
40
-     * @config
41
-     */
42
-    private static $dictionary = '_spellcheck';
32
+	/**
33
+	 * Default dictionary to use. This will overwrite the 'spellcheck.dictionary' option for searches given,
34
+	 * unless set to empty.
35
+	 *
36
+	 * '_spellcheck' is a predefined by the cwp infrastructure, which is configured
37
+	 * to be built from the '_spellcheckText' field. You can't rename this within CWP.
38
+	 *
39
+	 * @var string
40
+	 * @config
41
+	 */
42
+	private static $dictionary = '_spellcheck';
43 43
 
44
-    public function init()
45
-    {
46
-        // Add optional boost
47
-        if (class_exists(CwpSearchBoostExtension::class)
48
-            && SiteTree::has_extension(CwpSearchBoostExtension::class)
49
-        ) {
50
-            $this->setFieldBoosting(SiteTree::class . '_SearchBoost', SiteTree::config()->get('search_boost'));
51
-        }
52
-    }
44
+	public function init()
45
+	{
46
+		// Add optional boost
47
+		if (class_exists(CwpSearchBoostExtension::class)
48
+			&& SiteTree::has_extension(CwpSearchBoostExtension::class)
49
+		) {
50
+			$this->setFieldBoosting(SiteTree::class . '_SearchBoost', SiteTree::config()->get('search_boost'));
51
+		}
52
+	}
53 53
 
54
-    /**
55
-     * Upload config for this index to the given store
56
-     *
57
-     * @param SolrConfigStore $store
58
-     */
59
-    public function uploadConfig($store)
60
-    {
61
-        parent::uploadConfig($store);
54
+	/**
55
+	 * Upload config for this index to the given store
56
+	 *
57
+	 * @param SolrConfigStore $store
58
+	 */
59
+	public function uploadConfig($store)
60
+	{
61
+		parent::uploadConfig($store);
62 62
 
63
-        // Upload configured synonyms {@see SynonymsSiteConfig}
64
-        $siteConfig = SiteConfig::current_site_config();
65
-        if ($siteConfig->SearchSynonyms) {
66
-            $store->uploadString(
67
-                $this->getIndexName(),
68
-                'synonyms.txt',
69
-                $siteConfig->SearchSynonyms
70
-            );
71
-        }
72
-    }
63
+		// Upload configured synonyms {@see SynonymsSiteConfig}
64
+		$siteConfig = SiteConfig::current_site_config();
65
+		if ($siteConfig->SearchSynonyms) {
66
+			$store->uploadString(
67
+				$this->getIndexName(),
68
+				'synonyms.txt',
69
+				$siteConfig->SearchSynonyms
70
+			);
71
+		}
72
+	}
73 73
 
74
-    /**
75
-     *
76
-     * @return string
77
-     */
78
-    public function getFieldDefinitions()
79
-    {
80
-        $xml = parent::getFieldDefinitions();
81
-        $xml .= "\n\n\t\t<!-- Additional custom fields for spell checking -->";
82
-        $xml .= "\n\t\t<field name='_spellcheckText' type='textSpellHtml' indexed='true' "
83
-            . "stored='false' multiValued='true' />";
74
+	/**
75
+	 *
76
+	 * @return string
77
+	 */
78
+	public function getFieldDefinitions()
79
+	{
80
+		$xml = parent::getFieldDefinitions();
81
+		$xml .= "\n\n\t\t<!-- Additional custom fields for spell checking -->";
82
+		$xml .= "\n\t\t<field name='_spellcheckText' type='textSpellHtml' indexed='true' "
83
+			. "stored='false' multiValued='true' />";
84 84
 
85
-        return $xml;
86
-    }
85
+		return $xml;
86
+	}
87 87
 
88
-    /**
89
-     *
90
-     * @param SearchQuery $query
91
-     * @param int $offset
92
-     * @param int $limit
93
-     * @param array $params
94
-     * @return ArrayData
95
-     */
96
-    public function search(SearchQuery $query, $offset = -1, $limit = -1, $params = [])
97
-    {
98
-        // Override dictionary if given
99
-        if ($dictionary = $this->config()->dictionary) {
100
-            $params["spellcheck.dictionary"] = $dictionary;
101
-        }
88
+	/**
89
+	 *
90
+	 * @param SearchQuery $query
91
+	 * @param int $offset
92
+	 * @param int $limit
93
+	 * @param array $params
94
+	 * @return ArrayData
95
+	 */
96
+	public function search(SearchQuery $query, $offset = -1, $limit = -1, $params = [])
97
+	{
98
+		// Override dictionary if given
99
+		if ($dictionary = $this->config()->dictionary) {
100
+			$params["spellcheck.dictionary"] = $dictionary;
101
+		}
102 102
 
103
-        return parent::search($query, $offset, $limit, $params);
104
-    }
103
+		return parent::search($query, $offset, $limit, $params);
104
+	}
105 105
 }
Please login to merge, or discard this patch.