Merge pull request #17 from nlegoff/thesaurus_indexing

Fix thesaurus indexing with mutli-database
This commit is contained in:
Mathieu Darse
2015-01-02 18:20:27 +01:00
2 changed files with 7 additions and 2 deletions

View File

@@ -134,7 +134,7 @@ class Thesaurus implements ControllerProviderInterface
if ($request->get("typ") == "TH" || $request->get("typ") == "CT") {
try {
$databox = $app['phraseanet.appbox']->get_databox((int) $bid);
$databox->get_connection();
$connbas = $databox->get_connection();
if ($request->get("typ") == "TH") {
$domth = $databox->get_dom_thesaurus();

View File

@@ -42,6 +42,7 @@ class TermIndexer
foreach ($this->appbox->get_databoxes() as $databox) {
/** @var databox $databox */
$databoxId = $databox->get_sbas_id();
$document = self::thesaurusFromDatabox($databox);
$dedicatedFieldTerms = $this->getDedicatedFieldTerms($databox, $document);
@@ -50,7 +51,9 @@ class TermIndexer
// Term structure
$id = $term['id'];
unset($term['id']);
$term['databox_id'] = $databoxId;
$term['branch_id'] = $id;
// @todo move to the TermVisitor? dunno.
$term['fields'] = null;
@@ -64,9 +67,10 @@ class TermIndexer
// Index request
$params = array();
$params['id'] = $id;
$params['id'] = sprintf('%s_%s', $databoxId, $id);
$params['type'] = self::TYPE_NAME;
$params['body'] = $term;
$bulk->index($params);
});
@@ -113,6 +117,7 @@ class TermIndexer
->add('context', 'string')->addAnalyzedVersion($this->locales)
->add('path', 'string')->notAnalyzed()
->add('lang', 'string')->notAnalyzed()
->add('branch_id', 'string')->notAnalyzed()
->add('databox_id', 'integer')
->add('fields', 'string')->notAnalyzed()
;