mirror of
https://github.com/flarum/framework.git
synced 2025-02-06 12:44:58 +08:00
Revert search performance regression
We decided it is better to have a less intelligent search (that does not match search terms in titles) for some people than a bad-performing search for everyone. We will revisit the search performance topic in the next release cycle, possibly with larger changes around indexing. Refs #1738, #1741, #1764.
This commit is contained in:
parent
2febb2653f
commit
fef6612d62
|
@ -53,7 +53,7 @@ class FulltextGambit implements GambitInterface
|
||||||
// discussions that have a relevant title or that contain relevant posts.
|
// discussions that have a relevant title or that contain relevant posts.
|
||||||
$query
|
$query
|
||||||
->addSelect('posts_ft.most_relevant_post_id')
|
->addSelect('posts_ft.most_relevant_post_id')
|
||||||
->leftJoin(
|
->join(
|
||||||
new Expression('('.$subquery->toSql().') '.$grammar->wrapTable('posts_ft')),
|
new Expression('('.$subquery->toSql().') '.$grammar->wrapTable('posts_ft')),
|
||||||
'posts_ft.discussion_id', '=', 'discussions.id'
|
'posts_ft.discussion_id', '=', 'discussions.id'
|
||||||
)
|
)
|
||||||
|
|
|
@ -76,7 +76,7 @@ class ListDiscussionsControllerTest extends ApiControllerTestCase
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function can_search_for_word_in_title_and_post()
|
public function can_search_for_word_in_post()
|
||||||
{
|
{
|
||||||
$this->database()->table('posts')->insert([
|
$this->database()->table('posts')->insert([
|
||||||
['id' => 2, 'discussion_id' => 2, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>not in text</p></t>'],
|
['id' => 2, 'discussion_id' => 2, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>not in text</p></t>'],
|
||||||
|
@ -98,7 +98,7 @@ class ListDiscussionsControllerTest extends ApiControllerTestCase
|
||||||
}, $data['data']);
|
}, $data['data']);
|
||||||
|
|
||||||
// Order-independent comparison
|
// Order-independent comparison
|
||||||
$this->assertEquals(['2', '3'], $ids, 'IDs do not match', 0.0, 10, true);
|
$this->assertEquals(['3'], $ids, 'IDs do not match', 0.0, 10, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -126,7 +126,7 @@ class ListDiscussionsControllerTest extends ApiControllerTestCase
|
||||||
}, $data['data']);
|
}, $data['data']);
|
||||||
|
|
||||||
// Order-independent comparison
|
// Order-independent comparison
|
||||||
$this->assertEquals(['2', '3'], $ids, 'IDs do not match', 0.0, 10, true);
|
$this->assertEquals(['3'], $ids, 'IDs do not match', 0.0, 10, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user