mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Merge pull request #17 from nlegoff/thesaurus_indexing
Fix thesaurus indexing with mutli-database
This commit is contained in:
@@ -134,7 +134,7 @@ class Thesaurus implements ControllerProviderInterface
|
|||||||
if ($request->get("typ") == "TH" || $request->get("typ") == "CT") {
|
if ($request->get("typ") == "TH" || $request->get("typ") == "CT") {
|
||||||
try {
|
try {
|
||||||
$databox = $app['phraseanet.appbox']->get_databox((int) $bid);
|
$databox = $app['phraseanet.appbox']->get_databox((int) $bid);
|
||||||
$databox->get_connection();
|
$connbas = $databox->get_connection();
|
||||||
|
|
||||||
if ($request->get("typ") == "TH") {
|
if ($request->get("typ") == "TH") {
|
||||||
$domth = $databox->get_dom_thesaurus();
|
$domth = $databox->get_dom_thesaurus();
|
||||||
|
@@ -42,6 +42,7 @@ class TermIndexer
|
|||||||
foreach ($this->appbox->get_databoxes() as $databox) {
|
foreach ($this->appbox->get_databoxes() as $databox) {
|
||||||
/** @var databox $databox */
|
/** @var databox $databox */
|
||||||
$databoxId = $databox->get_sbas_id();
|
$databoxId = $databox->get_sbas_id();
|
||||||
|
|
||||||
$document = self::thesaurusFromDatabox($databox);
|
$document = self::thesaurusFromDatabox($databox);
|
||||||
$dedicatedFieldTerms = $this->getDedicatedFieldTerms($databox, $document);
|
$dedicatedFieldTerms = $this->getDedicatedFieldTerms($databox, $document);
|
||||||
|
|
||||||
@@ -50,7 +51,9 @@ class TermIndexer
|
|||||||
// Term structure
|
// Term structure
|
||||||
$id = $term['id'];
|
$id = $term['id'];
|
||||||
unset($term['id']);
|
unset($term['id']);
|
||||||
|
|
||||||
$term['databox_id'] = $databoxId;
|
$term['databox_id'] = $databoxId;
|
||||||
|
$term['branch_id'] = $id;
|
||||||
|
|
||||||
// @todo move to the TermVisitor? dunno.
|
// @todo move to the TermVisitor? dunno.
|
||||||
$term['fields'] = null;
|
$term['fields'] = null;
|
||||||
@@ -64,9 +67,10 @@ class TermIndexer
|
|||||||
|
|
||||||
// Index request
|
// Index request
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['id'] = $id;
|
$params['id'] = sprintf('%s_%s', $databoxId, $id);
|
||||||
$params['type'] = self::TYPE_NAME;
|
$params['type'] = self::TYPE_NAME;
|
||||||
$params['body'] = $term;
|
$params['body'] = $term;
|
||||||
|
|
||||||
$bulk->index($params);
|
$bulk->index($params);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -113,6 +117,7 @@ class TermIndexer
|
|||||||
->add('context', 'string')->addAnalyzedVersion($this->locales)
|
->add('context', 'string')->addAnalyzedVersion($this->locales)
|
||||||
->add('path', 'string')->notAnalyzed()
|
->add('path', 'string')->notAnalyzed()
|
||||||
->add('lang', 'string')->notAnalyzed()
|
->add('lang', 'string')->notAnalyzed()
|
||||||
|
->add('branch_id', 'string')->notAnalyzed()
|
||||||
->add('databox_id', 'integer')
|
->add('databox_id', 'integer')
|
||||||
->add('fields', 'string')->notAnalyzed()
|
->add('fields', 'string')->notAnalyzed()
|
||||||
;
|
;
|
||||||
|
Reference in New Issue
Block a user