Follows the outline in D15656 for implementing ngram search for names of File objects. Also created FileFullTextEngine, because without implementing PhabricatorFulltextInterface, ./bin/search complains that File is not an indexable type.
- Maniphest Tasks
- T8788: Allow querying for files by name
- rP976fbee877c9: Implement ngram search for File objects
- ran ./bin/storage upgrade to apply the schema change
- confirmed the presence of a new file_filename_ngrams table
- added a couple file objects
- ran bin/search index --type file --force
- confirmed the presence of rows in file_filename_ngrams
- did a few keyword searches and saw expected results
|5 ↗||(On Diff #42576)|
Need to remove this unless we want to force a reindex of all documents during storage upgrade.
|3 ↗||(On Diff #42576)|
Not sure if this class needs to exist, but I couldn't force reindexing without implementing PhabricatorFulltextInterface.
This is right, except that we probably should't implement FulltextInterface or fulltext-index these. bin/search index was written before the ngrams stuff was written, let me see if I can send you a quick patch to let it work without needing fulltext.
The cleanup should happen automatically as a side effect of DestructionEngine, but neither PhabricatorFileTemporaryGarbageCollector nor PhabricatorFileDeleteController use the destruction engine properly (bin/remove destroy will). Swapping those to use a destruction engine should fix the ngrams stuff, maybe as part of T10828.
To use the destruction engine, replace this:
$engine = new PhabricatorDestructionEngine(); $engine->destroyObject($file);