-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Backport 2.x] Adds a new parameter, max_analyzer_offset, for the highlighter #4031
Merged
reta
merged 2 commits into
opensearch-project:2.x
from
hauck-jvsh:backport/backport-3893-to-2.x
Jul 28, 2022
Merged
[Backport 2.x] Adds a new parameter, max_analyzer_offset, for the highlighter #4031
reta
merged 2 commits into
opensearch-project:2.x
from
hauck-jvsh:backport/backport-3893-to-2.x
Jul 28, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…earch-project#3893) * opensearch-project#3842 adds a new parameter to the highlighter, the max_analyzer_offset. When this parameter is provided the highlight stops in its value. This prevents the highlighter to go beyond the index maxAnalyzedOffset. Signed-off-by: Hauck <joaoh14@gmail.com> * Adds a test for the new parameter Signed-off-by: Hauck <joaoh14@gmail.com> * Fix the test add in the previous commit; Signed-off-by: Hauck <joaoh14@gmail.com> * This was checking against the wrong field Signed-off-by: Hauck <joaoh14@gmail.com> * Only runs the test for the correct version Signed-off-by: Hauck <joaoh14@gmail.com> * Skips the test in Elasticsearch as well; Signed-off-by: Hauck <joaoh14@gmail.com> * Remove elastic 3.0 to test Signed-off-by: Hauck <joaoh14@gmail.com> * Skips all versions Signed-off-by: Hauck <joaoh14@gmail.com> * Remove unnecessary fields as pointed by @reta Signed-off-by: Hauck <joaoh14@gmail.com> * Compute if fieldMaxAnalyzedIsNotValid in the constructor as suggest by @reta Signed-off-by: Hauck <joaoh14@gmail.com> * As discussed, it is better to throws different exceptions for when the fieldMaxAnalyzed is not valid and for when it is disabled; Signed-off-by: Hauck <joaoh14@gmail.com> * hint what to do to allow highlight of bigger documents Signed-off-by: Hauck <joaoh14@gmail.com> * Let the user define the new parameter globally for all fields highlighted Signed-off-by: Hauck <joaoh14@gmail.com> * Change the fieldMaxAnalyzedOffset Integer in order to use null when it is absent in highlight. This allows the error messages to much more precise, showing invalid for all negative numbers; Signed-off-by: Hauck <joaoh14@gmail.com> * Update javadocs and implements the stream methods for the new fields; Signed-off-by: Hauck <joaoh14@gmail.com> * builder.field do not accept null, so check before calling the method is necessary Signed-off-by: Hauck <joaoh14@gmail.com> * Only send and read the new fields if the version supports it Signed-off-by: Hauck <joaoh14@gmail.com> * the previous commit was checking the wrong field Signed-off-by: Hauck <joaoh14@gmail.com> * Check for version 3.0.0 instead of current version Signed-off-by: Hauck <joaoh14@gmail.com> * Update server/src/main/java/org/apache/lucene/search/uhighlight/CustomUnifiedHighlighter.java Co-authored-by: Andriy Redko <drreta@gmail.com> Signed-off-by: Hauck <joaoh14@gmail.com> * Execute the test after version 3.0.0 Signed-off-by: Hauck <joaoh14@gmail.com> Co-authored-by: Andriy Redko <drreta@gmail.com> (cherry picked from commit 931813f) Signed-off-by: Hauck <joaoh14@gmail.com>
Signed-off-by: Hauck <joaoh14@gmail.com>
reta
reviewed
Jul 28, 2022
...src/main/java/org/opensearch/search/fetch/subphase/highlight/AbstractHighlighterBuilder.java
Show resolved
Hide resolved
reta
approved these changes
Jul 28, 2022
Gradle Check (Jenkins) Run Completed with:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 2.x #4031 +/- ##
============================================
- Coverage 70.68% 70.51% -0.18%
+ Complexity 56489 56430 -59
============================================
Files 4527 4527
Lines 271761 271794 +33
Branches 39975 39983 +8
============================================
- Hits 192092 191647 -445
- Misses 63513 64062 +549
+ Partials 16156 16085 -71 ☔ View full report in Codecov by Sentry. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was not able to edit the original pull request so I open another one