-
Notifications
You must be signed in to change notification settings - Fork 128
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
Support source filtering for model search #162
Support source filtering for model search #162
Conversation
Added test case to make sure output from get model can be reduced by adding filter_path parameter. Signed-off-by: Vijayan Balasubramanian <[email protected]>
cbf2087
to
9224d68
Compare
@@ -395,7 +395,10 @@ public void search(SearchRequest request, ActionListener<SearchResponse> actionL | |||
request.indices(MODEL_INDEX_NAME); | |||
client.search(request,ActionListener.wrap(response -> { | |||
for (SearchHit hit : response.getHits()) { | |||
ToXContentObject xContentObject = Model.getModelFromSourceMap(hit.getSourceAsMap(), hit.getId()); | |||
if(hit.getSourceAsMap() == null){ |
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.
Im not convinced we need to do anything special here. Why can't we just return the search response directly to the listener? I know we need to add the model_id, but I think it would be better to just add that to the mapping in another PR.
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.
+1
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.
Removed processing. Now search response will have field called "model_id". This will be updated once model id is added to the mapping parameter.
9714763
to
aa13e10
Compare
Codecov Report
@@ Coverage Diff @@
## main #162 +/- ##
============================================
- Coverage 82.82% 82.66% -0.16%
- Complexity 801 803 +2
============================================
Files 117 117
Lines 3580 3582 +2
Branches 339 338 -1
============================================
- Hits 2965 2961 -4
- Misses 461 466 +5
- Partials 154 155 +1
Continue to review full report at Codecov.
|
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.
Minor comments. Otherwise looks good.
actionListener.onResponse(response); | ||
|
||
}, actionListener::onFailure)); | ||
client.search(request,actionListener); |
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.
Nit: space after ,
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.
Ack
@@ -105,6 +108,44 @@ public void testGetModelExists() throws IOException { | |||
assertEquals(testModelMetadata.getTimestamp(), responseMap.get(MODEL_TIMESTAMP)); | |||
} | |||
|
|||
|
|||
|
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.
Extra line
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.
Ack
Return model index search response as output for model search api. Signed-off-by: Vijayan Balasubramanian <[email protected]>
aa13e10
to
7ae6668
Compare
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.
LGTM! Thanks
ModelMetadata modelMetadata = ModelMetadata.getMetadataFromSourceMap(sourceMap); | ||
byte[] blob = getModelBlobFromResponse(sourceMap); |
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.
Want to confirm: what happens if these are null?
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 will not throw any exception. Field value will be empty.
Signed-off-by: Vijayan Balasubramanian <[email protected]>
Signed-off-by: Vijayan Balasubramanian <[email protected]> Signed-off-by: Martin Gaievski <[email protected]>
Signed-off-by: Vijayan Balasubramanian <[email protected]>
Description
Update Model Search API response to Model Index document search response.
Issues Resolved
#160
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.