1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Remove some redundant information from the Ferret engine index

Summary:
Ref T12819. The "full" field has all other fields, and the "core" field has "title" and "body". Due to the way the "full" and "core" fields were being built, the "core" field also got included in the "full" field, so the "full" field has two copies of the title, two copies of the body, and then one copy of everything else.

Put only one copy of each distinct thing in each "full" and "core". Also, simplify the logic a little bit so we build these virtual fields in a more consistent way.

Test Plan: Ran `bin/search index` and looked at the fields in the database, saw less redundant information.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12819

Differential Revision: https://secure.phabricator.com/D18580
This commit is contained in:
epriestley 2017-09-08 08:13:08 -07:00
parent 7ea6de6e9c
commit d67cc8e5c5

View file

@ -66,9 +66,12 @@ final class PhabricatorFerretFulltextEngineExtension
);
break;
}
}
$key_all = PhabricatorSearchDocumentFieldType::FIELD_ALL;
$virtual_fields[] = array(
PhabricatorSearchDocumentFieldType::FIELD_ALL,
$raw_corpus,
);
}
$empty_template = array(
'raw' => array(),
@ -76,9 +79,7 @@ final class PhabricatorFerretFulltextEngineExtension
'normal' => array(),
);
$ferret_corpus_map = array(
$key_all => $empty_template,
);
$ferret_corpus_map = array();
foreach ($virtual_fields as $field) {
list($key, $raw_corpus) = $field;
@ -98,10 +99,6 @@ final class PhabricatorFerretFulltextEngineExtension
$ferret_corpus_map[$key]['raw'][] = $raw_corpus;
$ferret_corpus_map[$key]['term'][] = $term_corpus;
$ferret_corpus_map[$key]['normal'][] = $normal_corpus;
$ferret_corpus_map[$key_all]['raw'][] = $raw_corpus;
$ferret_corpus_map[$key_all]['term'][] = $term_corpus;
$ferret_corpus_map[$key_all]['normal'][] = $normal_corpus;
}
$ferret_fields = array();