-
Notifications
You must be signed in to change notification settings - Fork 70
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
Adding search processor for score normalization and combination #227
Adding search processor for score normalization and combination #227
Conversation
35463f8
to
9b0a28a
Compare
Codecov Report
@@ Coverage Diff @@
## feature/normalization #227 +/- ##
===========================================================
+ Coverage 84.95% 85.55% +0.59%
- Complexity 216 296 +80
===========================================================
Files 15 24 +9
Lines 678 872 +194
Branches 109 134 +25
===========================================================
+ Hits 576 746 +170
- Misses 60 67 +7
- Partials 42 59 +17
|
9b0a28a
to
6580a8c
Compare
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
6580a8c
to
3ebe720
Compare
src/main/java/org/opensearch/neuralsearch/plugin/NeuralSearch.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/plugin/NeuralSearch.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/ScoreNormalizer.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/ScoreNormalizer.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/ScoreCombiner.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/ScoreCombiner.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/ScoreNormalizer.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/ScoreNormalizer.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/ScoreNormalizer.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/ScoreNormalizer.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/ScoreNormalizer.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/ScoreCombiner.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
319d4bb
to
1a196ce
Compare
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
08fc6d5
to
150ff33
Compare
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
src/main/java/org/opensearch/neuralsearch/processor/combination/ScoreCombiner.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/combination/ScoreCombinationFactory.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
61e5b44
to
74b23b2
Compare
src/test/java/org/opensearch/neuralsearch/OpenSearchSecureRestTestCase.java
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessor.java
Outdated
Show resolved
Hide resolved
...a/org/opensearch/neuralsearch/processor/normalization/MinMaxScoreNormalizationTechnique.java
Outdated
Show resolved
Hide resolved
...a/org/opensearch/neuralsearch/processor/normalization/MinMaxScoreNormalizationTechnique.java
Outdated
Show resolved
Hide resolved
...a/org/opensearch/neuralsearch/processor/normalization/MinMaxScoreNormalizationTechnique.java
Outdated
Show resolved
Hide resolved
...a/org/opensearch/neuralsearch/processor/normalization/MinMaxScoreNormalizationTechnique.java
Outdated
Show resolved
Hide resolved
...a/org/opensearch/neuralsearch/processor/normalization/MinMaxScoreNormalizationTechnique.java
Outdated
Show resolved
Hide resolved
...a/org/opensearch/neuralsearch/processor/normalization/MinMaxScoreNormalizationTechnique.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/normalization/ScoreNormalizer.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
f2ba35a
to
29b397f
Compare
src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessorWorkflow.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessorWorkflow.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessor.java
Outdated
Show resolved
Hide resolved
...a/org/opensearch/neuralsearch/processor/normalization/MinMaxScoreNormalizationTechnique.java
Outdated
Show resolved
Hide resolved
...a/org/opensearch/neuralsearch/processor/normalization/MinMaxScoreNormalizationTechnique.java
Outdated
Show resolved
Hide resolved
...a/org/opensearch/neuralsearch/processor/normalization/MinMaxScoreNormalizationTechnique.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/combination/ScoreCombiner.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessorWorkflow.java
Outdated
Show resolved
Hide resolved
@martin-gaievski all the comments which you have resolved please mark them as resolved. |
int shardId = compoundQueryTopDocs.scoreDocs[0].shardIndex; | ||
for (int j = 0; j < maxHits && j < sortedScores.size(); j++) { | ||
int docId = sortedScores.get(j); | ||
finalScoreDocs[j] = new ScoreDoc(docId, combinedNormalizedScoresByDocId.get(docId), shardId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are not updating the shard id? why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at this step we're working with a single shard results. It's the same shard id, so we need just to copy it to new results
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be useful if you can add the comments in the code, around which operation is at shard level and what is not.
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
sure, I addressed all comments, @navneet1v please check PR again |
* Adding search processor for score normalization and combination Signed-off-by: Martin Gaievski <gaievski@amazon.com>
Description
Added processor that does score normalization and combination for Hybrid query results. Processor is registered via search pipeline API as search phase result processor.
In this PR we're adding support for techniques "min-max" for normalization and "arithmetic mean" for combination. Support for weights and other techniques will be added in next PRs to keep size of a single PR minimal.
Below is example of definition for registering new processor as part of search pipeline:
Issues Resolved
#228, part of solution for #126
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.