silverstripe / cwp-search

Compare 4638152 ... +27 ... f1649ac

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.

Showing 3 of 8 files from the diff.

@@ -30,6 +30,12 @@
Loading
30 30
    private static $search_options = [
31 31
        'hl' => 'true',
32 32
    ];
33 +
    
34 +
    /**
35 +
     * @var boolean
36 +
     * @config
37 +
     */
38 +
    private static $use_spellcheck = true;
33 39
34 40
    /**
35 41
     * Additional search options to send to search when spellcheck
@@ -132,7 +138,8 @@
Loading
132 138
133 139
        try {
134 140
            // Begin search
135 -
            $result = $this->getResult($keywords, $classes, $searchIndex, $limit, $start, true);
141 +
            $spellcheck = $this->config()->get('use_spellcheck');
142 +
            $result = $this->getResult($keywords, $classes, $searchIndex, $limit, $start, $spellcheck);
136 143
137 144
            // Return results if we don't need to refine this any further
138 145
            if (!$followSuggestions || $result->hasResults() || !$result->getSuggestion()) {

@@ -111,7 +111,14 @@
Loading
111 111
                    : BASE_PATH . '/.solr',
112 112
                'remotepath' => Environment::getEnv('SOLR_REMOTE_PATH')
113 113
                    ? Environment::getEnv('SOLR_REMOTE_PATH')
114 -
                    : null
114 +
                    : null,
115 +
                'port' => Environment::getEnv('SOLR_INDEXSTORE_PORT')
116 +
                    ? Environment::getEnv('SOLR_INDEXSTORE_PORT')
117 +
                    : (
118 +
                        Environment::getEnv('SOLR_PORT')
119 +
                            ? Environment::getEnv('SOLR_PORT')
120 +
                            : 8983
121 +
                    )
115 122
            ]
116 123
        ];
117 124
    }

@@ -2,6 +2,7 @@
Loading
2 2
3 3
namespace CWP\Search;
4 4
5 +
use SilverStripe\FullTextSearch\Search\Services\SearchableService;
5 6
use SilverStripe\ORM\PaginatedList;
6 7
use SilverStripe\View\ArrayData;
7 8
use SilverStripe\View\ViewableData;
@@ -61,15 +62,15 @@
Loading
61 62
    public function __construct($terms = '', ArrayData $results = null)
62 63
    {
63 64
        $this->query = $terms;
65 +
        $searchableService = SearchableService::singleton();
64 66
        if ($results) {
65 67
            // Clean up the results.
66 68
            $matches = $results->Matches;
67 69
            foreach ($matches as $result) {
68 -
                if (!$result->canView()) {
70 +
                if (!$searchableService->isViewable($result)) {
69 71
                    $matches->remove($result);
70 72
                }
71 73
            }
72 -
73 74
            $this->matches = $matches;
74 75
            $this->suggestion = $results->SuggestionNice;
75 76
        }

Learn more Showing 3 files with coverage changes found.

Changes in src/Extensions/CwpSearchBoostExtension.php
-1
Loading file...
Changes in src/CwpSearchEngine.php
-3
Loading file...
Changes in src/Extensions/SearchControllerExtension.php
-2
Loading file...

29 Commits

Hiding 2 contexual commits
+1
+1
Hiding 4 contexual commits
Hiding 3 contexual commits
Hiding 1 contexual commits
-1
-1
+2
+2
-2
-2
+2
+2
+5
+5
Hiding 1 contexual commits
-6
-6
Files Complexity Coverage
src ø -0.07% 22.51%
Project Totals (12 files) 109 22.51%
Loading