#PHRAS-668 #time 1d

- fix: facets number (admin/field) is now used by prod.
- add: query/es : removed useless & pack clauses on status masks -> shortest (fastest ?) query
This commit is contained in:
Jean-Yves Gaulier
2015-08-20 11:08:55 +02:00
parent ceaca1c53c
commit 72bb1877a7
5 changed files with 66 additions and 8 deletions

View File

@@ -19,7 +19,8 @@ class Field
private $type;
private $is_searchable;
private $is_private;
private $is_facet;
private $is_facet; // bool return facet for this field
private $facets_size; // number of facets to return (null=default, 0= no limit)
private $thesaurus_roots;
private $used_by_collections;
@@ -36,10 +37,19 @@ class Field
$roots = null;
}
// for phraseanet : 0=no facets (also returns isAggregable()=false) ; -1=all facets
$facet = $field->isAggregable();
$facets_size = $field->getAggregableSize();
if($facets_size === -1) {
// for ES 0=all facets
$facets_size = 0;
}
return new self($field->get_name(), $type, [
'searchable' => $field->is_indexable(),
'private' => $field->isBusiness(),
'facet' => $field->isAggregable(),
'facet' => $facet,
'facets_size' => $facets_size,
'thesaurus_roots' => $roots,
'used_by_collections' => $databox->get_collection_unique_ids()
]);
@@ -68,6 +78,7 @@ class Field
$this->is_searchable = \igorw\get_in($options, ['searchable'], true);
$this->is_private = \igorw\get_in($options, ['private'], false);
$this->is_facet = \igorw\get_in($options, ['facet'], false);
$this->facets_size = $this->is_facet ? \igorw\get_in($options, ['facets_size'], null) : 0; // here 0 means "no facets"
$this->thesaurus_roots = \igorw\get_in($options, ['thesaurus_roots'], null);
$this->used_by_collections = \igorw\get_in($options, ['used_by_collections'], []);
@@ -86,6 +97,7 @@ class Field
'searchable' => $this->is_searchable,
'private' => $this->is_private,
'facet' => $this->is_facet,
'facets_size' => $this->facets_size,
'thesaurus_roots' => $this->thesaurus_roots,
'used_by_collections' => $this->used_by_collections
]);
@@ -171,6 +183,11 @@ class Field
return $this->is_facet;
}
public function getFacetsSize()
{
return $this->facets_size;
}
public function hasConceptInference()
{
return $this->thesaurus_roots !== null;