Build a prototype fulltext engine ("Ferret") using only basic MySQL primitives
Summary:
Ref T12819. I gave this stuff a sweet code name because all the terms related to "fulltext" and "search" already mean 5 different things. It, uh, ferrets out documents for you?
I'm building this to work a lot like the existing ngram index, which seems to work pretty well. If this sticks, it will auto-resolve the join issue (in T12443) by letting us do the entire thing locally in a JOIN and thus dodge a lot of mess.
This index gets built alongside other indexes, but only shows up in the UI if you have prototypes enabled. If you do, it appears under the existing fulltext field in Maniphest. No existing functionality is affected or disrupted.
NOTE: The query engine half of this is still EXTREMELY primitive, and this probably performs worse than the existing field for now. If this doesn't show obvious signs of being awful on `secure` I'll improve that in followup changes.
Test Plan:
Indexed my tasks, ran some simple queries, got the results I wanted, even for queries "ko", "k", "v0.1".
{F5147746}
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T12819, T12443
Differential Revision: https://secure.phabricator.com/D18484
2017-08-28 22:04:56 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class ManiphestTaskFerretEngine
|
|
|
|
extends PhabricatorFerretEngine {
|
|
|
|
|
|
|
|
public function newNgramsObject() {
|
|
|
|
return new ManiphestTaskFerretNgrams();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function newDocumentObject() {
|
|
|
|
return new ManiphestTaskFerretDocument();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function newFieldObject() {
|
|
|
|
return new ManiphestTaskFerretField();
|
|
|
|
}
|
|
|
|
|
Use the Ferret engine fulltext document table to drive auxiliary fulltext constraints
Summary:
Ref T12819. I started trying to get individual engines to drive these constraints (e.g., `ManiphestTaskQuery` can do most of the work) but this is a big pain, especially since most engines don't support "any owner" or "no owner", and not everything has an owner, and so on and so on. Going down this path would have meant a huge pile of stub functions everywhere, I think.
Instead, drive these through the main engine using the fulltext document table, which already has everything we need to apply these constraints in a uniform way.
Also tweak some parts of query construction and result ordering.
Test Plan: Searched for documents by author, owner, unowned, any owner, tags, subscribers, fulltext in global search. Got sensible results without any application-specific code.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T12819
Differential Revision: https://secure.phabricator.com/D18550
2017-09-07 17:33:20 +02:00
|
|
|
public function newSearchEngine() {
|
2017-09-06 20:48:21 +02:00
|
|
|
return new ManiphestTaskSearchEngine();
|
|
|
|
}
|
|
|
|
|
2017-09-05 19:28:25 +02:00
|
|
|
protected function getFunctionMap() {
|
|
|
|
$map = parent::getFunctionMap();
|
|
|
|
|
|
|
|
$map['body']['aliases'][] = 'desc';
|
|
|
|
$map['body']['aliases'][] = 'description';
|
|
|
|
|
|
|
|
return $map;
|
|
|
|
}
|
|
|
|
|
Build a prototype fulltext engine ("Ferret") using only basic MySQL primitives
Summary:
Ref T12819. I gave this stuff a sweet code name because all the terms related to "fulltext" and "search" already mean 5 different things. It, uh, ferrets out documents for you?
I'm building this to work a lot like the existing ngram index, which seems to work pretty well. If this sticks, it will auto-resolve the join issue (in T12443) by letting us do the entire thing locally in a JOIN and thus dodge a lot of mess.
This index gets built alongside other indexes, but only shows up in the UI if you have prototypes enabled. If you do, it appears under the existing fulltext field in Maniphest. No existing functionality is affected or disrupted.
NOTE: The query engine half of this is still EXTREMELY primitive, and this probably performs worse than the existing field for now. If this doesn't show obvious signs of being awful on `secure` I'll improve that in followup changes.
Test Plan:
Indexed my tasks, ran some simple queries, got the results I wanted, even for queries "ko", "k", "v0.1".
{F5147746}
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T12819, T12443
Differential Revision: https://secure.phabricator.com/D18484
2017-08-28 22:04:56 +02:00
|
|
|
}
|