mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 23:13:15 +00:00
Merge pull request #1399 from mdarse/new-structure-regression-search-in
Fix IN search regression
This commit is contained in:
@@ -59,7 +59,6 @@ class SearchEngineServiceProvider implements ServiceProviderInterface
|
||||
$app['elasticsearch.client'],
|
||||
$app['elasticsearch.options']['index'],
|
||||
$app['locales.available'],
|
||||
$app['elasticsearch.record_helper'],
|
||||
$app['elasticsearch.facets_response.factory']
|
||||
);
|
||||
});
|
||||
|
@@ -41,15 +41,13 @@ class ElasticSearchEngine implements SearchEngineInterface
|
||||
private $indexName;
|
||||
private $configurationPanel;
|
||||
private $locales;
|
||||
private $recordHelper;
|
||||
|
||||
public function __construct(Application $app, Structure $structure, Client $client, $indexName, array $locales, RecordHelper $recordHelper, Closure $facetsResponseFactory)
|
||||
public function __construct(Application $app, Structure $structure, Client $client, $indexName, array $locales, Closure $facetsResponseFactory)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->structure = $structure;
|
||||
$this->client = $client;
|
||||
$this->locales = array_keys($locales);
|
||||
$this->recordHelper = $recordHelper;
|
||||
$this->facetsResponseFactory = $facetsResponseFactory;
|
||||
|
||||
if ('' === trim($indexName)) {
|
||||
@@ -384,7 +382,7 @@ class ElasticSearchEngine implements SearchEngineInterface
|
||||
// 2015-05-26 (mdarse) Removed databox filtering.
|
||||
// It was already done by the ACL filter in the query scope, so no
|
||||
// document that shouldn't be displayed can go this far.
|
||||
$field_name = RecordHelper::getIndexFieldName($field);
|
||||
$field_name = $field->getIndexFieldName();
|
||||
$aggs[$name]['terms']['field'] = sprintf('%s.raw', $field_name);
|
||||
}
|
||||
|
||||
|
@@ -85,13 +85,4 @@ class RecordHelper
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static function getIndexFieldName(Field $field)
|
||||
{
|
||||
return sprintf(
|
||||
'%scaption.%s',
|
||||
$field->isPrivate() ? 'private_' : '',
|
||||
$field->getName()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -34,7 +34,7 @@ class QueryContext
|
||||
}
|
||||
}
|
||||
|
||||
return new static($this->locales, $this->queryLocale, $fields);
|
||||
return new static($this->structure, $this->locales, $this->queryLocale, $fields);
|
||||
}
|
||||
|
||||
public function getRawFields()
|
||||
@@ -94,7 +94,7 @@ class QueryContext
|
||||
return;
|
||||
}
|
||||
// TODO Field label dereferencing (we only want names)
|
||||
return RecordIndexer::getIndexFieldName($field);
|
||||
return $field->getIndexFieldName();
|
||||
}
|
||||
|
||||
public function getFields()
|
||||
|
@@ -73,6 +73,15 @@ class Field
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getIndexFieldName()
|
||||
{
|
||||
return sprintf(
|
||||
'%scaption.%s',
|
||||
$this->is_private ? 'private_' : '',
|
||||
$this->name
|
||||
);
|
||||
}
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
|
Reference in New Issue
Block a user