drop partial search

This commit is contained in:
Daniël Klabbers 2022-02-21 10:20:46 +01:00
parent 8ab60b2fb8
commit cc8145c236
1 changed files with 10 additions and 10 deletions

View File

@ -61,10 +61,10 @@ class SearchController extends ListDiscussionsController
if (! empty($search)) { if (! empty($search)) {
$filterQuery $filterQuery
// @todo commented out to use only partial matching for now // @todo commented out to use only partial matching for now
// ->add($this->sentenceMatch($search)) ->add($this->sentenceMatch($search))
// ->add($this->wordMatch($search, 'and')) ->add($this->wordMatch($search, 'and'))
// ->add($this->wordMatch($search, 'or')) ->add($this->wordMatch($search, 'or'))
->add($this->partialMatch($search)) // ->add($this->partialMatch($search))
; ;
} }
@ -225,14 +225,14 @@ class SearchController extends ListDiscussionsController
->add( ->add(
BoolQuery::create() BoolQuery::create()
->add(TermQuery::create('type', 'discussions'), 'filter') ->add(TermQuery::create('type', 'discussions'), 'filter')
->add($query->boost(1)), ->add($query->boost(2)),
'should' 'should'
) )
// Post bodies // Post bodies
->add( ->add(
BoolQuery::create() BoolQuery::create()
->add(TermQuery::create('type', 'posts'), 'filter') ->add(TermQuery::create('type', 'posts'), 'filter')
->add($query->boost(.9)), ->add($query->boost(1.9)),
'should' 'should'
); );
} }
@ -242,21 +242,21 @@ class SearchController extends ListDiscussionsController
$query = (new MatchQuery('content', $q)) $query = (new MatchQuery('content', $q))
->operator($operator); ->operator($operator);
$boost = $operator === 'and' ? 1 : .5; $boost = $operator === 'and' ? 1 : .8;
return BoolQuery::create() return BoolQuery::create()
// Discussion titles // Discussion titles
->add( ->add(
BoolQuery::create() BoolQuery::create()
->add(TermQuery::create('type', 'discussions'), 'filter') ->add(TermQuery::create('type', 'discussions'), 'filter')
->add($query->boost($boost * 1.2)), ->add($query->boost($boost * 1.8)),
'should' 'should'
) )
// Post bodies // Post bodies
->add( ->add(
BoolQuery::create() BoolQuery::create()
->add(TermQuery::create('type', 'posts'), 'filter') ->add(TermQuery::create('type', 'posts'), 'filter')
->add($query->boost($boost * 1.1)), ->add($query->boost($boost * 1.8)),
'should' 'should'
); );
} }
@ -270,7 +270,7 @@ class SearchController extends ListDiscussionsController
->add( ->add(
BoolQuery::create() BoolQuery::create()
->add(TermQuery::create('type', 'discussions'), 'filter') ->add(TermQuery::create('type', 'discussions'), 'filter')
->add(clone $query->boost(2)), ->add(clone $query->boost(1.6)),
'should' 'should'
) )
// Post bodies // Post bodies