Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES 6.x Updates #1907

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function execute($request)
$queryBool = new \Elastica\Query\BoolQuery();

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

Expand Down
4 changes: 3 additions & 1 deletion lib/job/arUpdateEsActorRelationsJob.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@ public static function updateActorRelationships($actor)
public static function previousRelationActorIds($actorId)
{
try {
// Dummy type is needed for ES 6, this should be updated in ES 7.x when type is not required for getDocument()
$esType = QubitSearch::getInstance()::ES_TYPE;
// Get actor's previously indexed relations from Elasticsearch
$doc = QubitSearch::getInstance()->index->getIndex('QubitActor')->getDocument($actorId);
$doc = QubitSearch::getInstance()->index->getIndex('QubitActor')->getType($esType)->getDocument($actorId);

return self::uniqueIdsFromRelationData($doc->getData()['actorRelations']);
} catch (\Elastica\Exception\NotFoundException $e) {
Expand Down
6 changes: 3 additions & 3 deletions lib/model/QubitInformationObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -2171,14 +2171,14 @@ public static function getByTitleIdentifierAndRepo($identifier, $title, $repoNam
$queryBool = new \Elastica\Query\BoolQuery();

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

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

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

Expand Down
6 changes: 4 additions & 2 deletions lib/task/search/arDocumentTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ public function execute($arguments = [], $options = [])
{
parent::execute($arguments, $options);

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

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

echo json_encode($doc->getData(), JSON_PRETTY_PRINT)."\n";
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function addAggFilters($aggs, $params)
if ('collection' == $param) {
$collection = QubitInformationObject::getById($value);

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

$queryBool = new \Elastica\Query\BoolQuery();
Expand Down
Loading