Skip to content

Commit 9a278dd

Browse files
authored
ES 6.x Updates (#1907)
1 parent 5b9bac7 commit 9a278dd

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

apps/qubit/modules/search/actions/autocompleteAction.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function execute($request)
8686
$queryBool = new \Elastica\Query\BoolQuery();
8787

8888
// Match in autocomplete
89-
$queryText = new \Elastica\Query\Match();
89+
$queryText = new \Elastica\Query\MatchQuery();
9090
$queryText->setFieldQuery($item['field'].'.autocomplete', $this->queryString);
9191
$queryBool->addMust($queryText);
9292

lib/job/arUpdateEsActorRelationsJob.class.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,10 @@ public static function updateActorRelationships($actor)
101101
public static function previousRelationActorIds($actorId)
102102
{
103103
try {
104+
// Dummy type is needed for ES 6, this should be updated in ES 7.x when type is not required for getDocument()
105+
$esType = QubitSearch::getInstance()::ES_TYPE;
104106
// Get actor's previously indexed relations from Elasticsearch
105-
$doc = QubitSearch::getInstance()->index->getIndex('QubitActor')->getDocument($actorId);
107+
$doc = QubitSearch::getInstance()->index->getIndex('QubitActor')->getType($esType)->getDocument($actorId);
106108

107109
return self::uniqueIdsFromRelationData($doc->getData()['actorRelations']);
108110
} catch (\Elastica\Exception\NotFoundException $e) {

lib/model/QubitInformationObject.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2171,14 +2171,14 @@ public static function getByTitleIdentifierAndRepo($identifier, $title, $repoNam
21712171
$queryBool = new \Elastica\Query\BoolQuery();
21722172

21732173
// Use match query for exact matches.
2174-
$queryText = new \Elastica\Query\Match();
2174+
$queryText = new \Elastica\Query\MatchQuery();
21752175
$queryBool->addMust($queryText->setFieldQuery('identifier', $identifier));
21762176

2177-
$queryText = new \Elastica\Query\Match();
2177+
$queryText = new \Elastica\Query\MatchQuery();
21782178
$queryBool->addMust($queryText->setFieldQuery(sprintf('i18n.%s.title.untouched', $currentCulture), $title));
21792179

21802180
if (null !== $repoName) {
2181-
$queryText = new \Elastica\Query\Match();
2181+
$queryText = new \Elastica\Query\MatchQuery();
21822182
$queryBool->addMust($queryText->setFieldQuery(sprintf('repository.i18n.%s.authorizedFormOfName.untouched', $currentCulture), $repoName));
21832183
}
21842184

lib/task/search/arDocumentTask.class.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ public function execute($arguments = [], $options = [])
3434
{
3535
parent::execute($arguments, $options);
3636

37-
if (null !== $slugObject = QubitObject::getBySlug($arguments[slug])) {
37+
if (null !== $slugObject = QubitObject::getBySlug($arguments['slug'])) {
3838
$this->log(sprintf("Fetching data for %s ID %d...\n", $slugObject->className, $slugObject->id));
3939

40-
$doc = QubitSearch::getInstance()->index->getIndex($slugObject->className)->getDocument($slugObject->id);
40+
// Dummy type is needed for ES 6, this should be updated in ES 7.x when type is not required for getDocument()
41+
$esType = QubitSearch::getInstance()::ES_TYPE;
42+
$doc = QubitSearch::getInstance()->index->getIndex($slugObject->className)->getType($esType)->getDocument($slugObject->id);
4143

4244
echo json_encode($doc->getData(), JSON_PRETTY_PRINT)."\n";
4345
} else {

plugins/arElasticSearchPlugin/lib/arElasticSearchPluginQuery.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function addAggFilters($aggs, $params)
114114
if ('collection' == $param) {
115115
$collection = QubitInformationObject::getById($value);
116116

117-
$querySelf = new \Elastica\Query\Match();
117+
$querySelf = new \Elastica\Query\MatchQuery();
118118
$querySelf->setFieldQuery('slug', $collection->slug);
119119

120120
$queryBool = new \Elastica\Query\BoolQuery();

0 commit comments

Comments
 (0)