Passed
Push — master ( 13f5f8...8d20f1 )
by Gordon
03:52 queued 01:52
created

FreeTextSearchSiteConfig::updateCMSFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 1
nc 1
nop 1
1
<?php declare(strict_types=1);
2
3
/**
4
 * Created by PhpStorm.
5
 * User: gordon
6
 * Date: 24/3/2561
7
 * Time: 20:36 น.
8
 */
9
10
namespace Suilven\FreeTextSearch\SiteConfig;
11
12
use SilverStripe\Forms\CheckboxField;
13
use SilverStripe\Forms\FieldList;
14
use SilverStripe\Forms\NumericField;
15
use SilverStripe\ORM\DataExtension;
16
use Suilven\FreeTextSearch\Container\SuggesterResults;
17
18
class FreeTextSearchSiteConfig extends DataExtension
19
{
20
    private static $db = array(
21
        'BulkSize' => 'Int',
22
23
        // Enums do not work, breaks build.  True to index in bulk, false not to
24
        'FreeTextSearchIndexingModeInBulk' => 'Boolean',
25
    );
26
27
    private static $defaults = [
28
        'BulkSize' => 500,
29
        'FreeTextSearchIndexingModeInBulk' => false,
30
    ];
31
32
33
    public function updateCMSFields(FieldList $fields)
34
    {
35
        $fields->addFieldToTab("Root.FreeTextSearch", new NumericField("BulkSize", 'The number of documents to index at once in bulk'));
36
        $fields->addFieldToTab('Root.FreeTextSearch', new CheckboxField('FreeTextSearchIndexingModeInBulk', 'True to index in bulk, false to index individually'));
37
38
        return $fields;
39
    }
40
}
41