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

[Core] No edge ngram decomposition in termVectors #3406

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 @@ -164,6 +164,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 @@ -172,9 +173,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 @@ -184,6 +184,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 @@ -243,6 +247,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
Loading