Skip to content

Commit

Permalink
Merge branch '2.10.x' into 2.11.x
Browse files Browse the repository at this point in the history
  • Loading branch information
rbayet committed Oct 8, 2024
2 parents 21b6590 + 21249e8 commit cea85ae
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ private function getTermVectors(RequestInterface $request)
MappingInterface::DEFAULT_SPELLING_FIELD => $request->getQueryText(),
],
];
$perFieldAnalyzer = [];

if ($request->isUsingReference()) {
$doc['fields'][] = MappingInterface::DEFAULT_REFERENCE_FIELD . "." . FieldInterface::ANALYZER_REFERENCE;
Expand All @@ -171,9 +172,15 @@ private function getTermVectors(RequestInterface $request)

if ($request->isUsingEdgeNgram()) {
$doc['fields'][] = MappingInterface::DEFAULT_EDGE_NGRAM_FIELD . "." . FieldInterface::ANALYZER_EDGE_NGRAM;
$perFieldAnalyzer[MappingInterface::DEFAULT_EDGE_NGRAM_FIELD . "." . FieldInterface::ANALYZER_EDGE_NGRAM]
= FieldInterface::ANALYZER_STANDARD;
$doc['doc'][MappingInterface::DEFAULT_EDGE_NGRAM_FIELD] = $request->getQueryText();
}

if (!empty($perFieldAnalyzer)) {
$doc['per_field_analyzer'] = $perFieldAnalyzer;
}

$docs = [];

// Compute the mtermvector query on all indices.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ public function testEdgeNgramTermVectorsParams()
MappingInterface::DEFAULT_SEARCH_FIELD . "." . FieldInterface::ANALYZER_WHITESPACE,
MappingInterface::DEFAULT_EDGE_NGRAM_FIELD . "." . FieldInterface::ANALYZER_EDGE_NGRAM,
],
'per_field_analyzer' => [
MappingInterface::DEFAULT_EDGE_NGRAM_FIELD . "." . FieldInterface::ANALYZER_EDGE_NGRAM
=> FieldInterface::ANALYZER_STANDARD,
],
'doc' => [
MappingInterface::DEFAULT_SEARCH_FIELD => $queryText,
MappingInterface::DEFAULT_SPELLING_FIELD => $queryText,
Expand Down Expand Up @@ -239,6 +243,10 @@ public function testReferenceAndEdgeNgramTermVectorsParams()
MappingInterface::DEFAULT_REFERENCE_FIELD . "." . FieldInterface::ANALYZER_REFERENCE,
MappingInterface::DEFAULT_EDGE_NGRAM_FIELD . "." . FieldInterface::ANALYZER_EDGE_NGRAM,
],
'per_field_analyzer' => [
MappingInterface::DEFAULT_EDGE_NGRAM_FIELD . "." . FieldInterface::ANALYZER_EDGE_NGRAM
=> FieldInterface::ANALYZER_STANDARD,
],
'doc' => [
MappingInterface::DEFAULT_SEARCH_FIELD => $queryText,
MappingInterface::DEFAULT_SPELLING_FIELD => $queryText,
Expand Down

0 comments on commit cea85ae

Please sign in to comment.