PHRAS-3389_use-only-conceptpaths-from-selected-dbs_MASTER

fix : search only concept-paths from the relevant thesaurus
fix : search only fields from the relevant databoxes (collections)
This commit is contained in:
jygaulier
2021-04-08 18:15:27 +02:00
parent e29926bcd4
commit 63bee24775
18 changed files with 290 additions and 141 deletions

View File

@@ -32,17 +32,21 @@ class QueryCompiler
public function compile($string, QueryContext $context)
{
$query = $this->parse($string);
$this->injectThesaurusConcepts($query);
$this->injectThesaurusConcepts($query, $context);
return $query->build($context);
}
private function injectThesaurusConcepts(Query $query)
/**
* @param Query $query
* @param QueryContext $context
*/
private function injectThesaurusConcepts(Query $query, $context)
{
// TODO We must restrict thesaurus matching for IN queries, and only
// search in each field's root concepts.
$nodes = $query->getTermNodes();
$concepts = $this->thesaurus->findConceptsBulk($nodes);
$concepts = $this->thesaurus->findConceptsBulk($nodes, $context->getDataboxes());
foreach ($concepts as $index => $termConcepts) {
$node = $nodes[$index];