mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
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:
@@ -49,6 +49,8 @@ class Field implements Typed
|
||||
|
||||
private $used_by_collections;
|
||||
|
||||
private $used_by_databoxes;
|
||||
|
||||
public static function createFromLegacyField(databox_field $field)
|
||||
{
|
||||
$type = self::getTypeFromLegacy($field);
|
||||
@@ -75,7 +77,8 @@ class Field implements Typed
|
||||
'facet' => $facet,
|
||||
'thesaurus_roots' => $roots,
|
||||
'generate_cterms' => $field->get_generate_cterms(),
|
||||
'used_by_collections' => $databox->get_collection_unique_ids()
|
||||
'used_by_collections' => $databox->get_collection_unique_ids(),
|
||||
'used_by_databoxes' => [$databox->get_sbas_id()]
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -107,6 +110,7 @@ class Field implements Typed
|
||||
$this->thesaurus_roots = \igorw\get_in($options, ['thesaurus_roots'], null);
|
||||
$this->generate_cterms = \igorw\get_in($options, ['generate_cterms'], false);
|
||||
$this->used_by_collections = \igorw\get_in($options, ['used_by_collections'], []);
|
||||
$this->used_by_databoxes = \igorw\get_in($options, ['used_by_databoxes'], []);
|
||||
}
|
||||
else {
|
||||
// todo: this is faster code, but need to fix unit-tests to pass all options
|
||||
@@ -117,6 +121,7 @@ class Field implements Typed
|
||||
$this->thesaurus_roots = $options['thesaurus_roots'];
|
||||
$this->generate_cterms = $options['generate_cterms'];
|
||||
$this->used_by_collections = $options['used_by_collections'];
|
||||
$this->used_by_databoxes = $options['used_by_databoxes'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +134,8 @@ class Field implements Typed
|
||||
'facet' => $this->facet,
|
||||
'thesaurus_roots' => $this->thesaurus_roots,
|
||||
'generate_cterms' => $this->generate_cterms,
|
||||
'used_by_collections' => $this->used_by_collections
|
||||
'used_by_collections' => $this->used_by_collections,
|
||||
'used_by_databoxes' => $this->used_by_databoxes
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -168,6 +174,11 @@ class Field implements Typed
|
||||
return $this->used_by_collections;
|
||||
}
|
||||
|
||||
public function getDependantDataboxes()
|
||||
{
|
||||
return $this->used_by_databoxes;
|
||||
}
|
||||
|
||||
public function isSearchable()
|
||||
{
|
||||
return $this->is_searchable;
|
||||
@@ -255,9 +266,20 @@ class Field implements Typed
|
||||
)
|
||||
);
|
||||
|
||||
$used_by_databoxes = array_values(
|
||||
array_unique(
|
||||
array_merge(
|
||||
$this->used_by_databoxes,
|
||||
$other->used_by_databoxes
|
||||
),
|
||||
SORT_REGULAR
|
||||
)
|
||||
);
|
||||
|
||||
return $this->withOptions([
|
||||
'thesaurus_roots' => $thesaurus_roots,
|
||||
'used_by_collections' => $used_by_collections
|
||||
'used_by_collections' => $used_by_collections,
|
||||
'used_by_databoxes' => $used_by_databoxes
|
||||
]);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user