CwpSolrIndex   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 9
c 1
b 0
f 0
dl 0
loc 19
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A init() 0 17 1
1
<?php
2
3
namespace CWP\Search\Solr;
4
5
use CWP\Search\CwpSearchIndex;
6
use SilverStripe\CMS\Model\SiteTree;
7
8
/**
9
 * Default search index
10
 */
11
class CwpSolrIndex extends CwpSearchIndex
12
{
13
    public function init()
14
    {
15
        $this->addClass(SiteTree::class);
16
17
        // By default, we only add text fields that are 'visible' to users (where the content is directly visible on
18
        // the website), along with the 'meta' fields that are commonly used to boost / refine search results
19
        $this->addFulltextField('Title');
20
        $this->addFulltextField('MenuTitle');
21
        $this->addFulltextField('Content');
22
        $this->addFulltextField('MetaDescription');
23
        $this->addFulltextField('ExtraMeta');
24
25
        // Adds 'ShowInSearch' boolean field to Solr document so we can later ensure that only documents included in
26
        // search are returned by Solr.
27
        $this->addFilterField('ShowInSearch');
28
29
        parent::init();
30
    }
31
}
32