Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #185 from o19s/fixing-query-attributes-null
Browse files Browse the repository at this point in the history
Fixing query attributes null
  • Loading branch information
epugh authored May 29, 2024
2 parents 5103e23 + 2e6d500 commit 2969a47
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM opensearchproject/opensearch:2.14.0

COPY ./build/distributions/opensearch-ubi-0.0.11-os2.14.0.zip /tmp/
COPY ./build/distributions/opensearch-ubi-0.0.12.1-os2.14.0.zip /tmp/

RUN /usr/share/opensearch/bin/opensearch-plugin install file:/tmp/opensearch-ubi-0.0.11-os2.14.0.zip
RUN /usr/share/opensearch/bin/opensearch-plugin install file:/tmp/opensearch-ubi-0.0.12.1-os2.14.0.zip
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
opensearchVersion = 2.14.0
ubiVersion = 0.0.12
ubiVersion = 0.0.12.1
4 changes: 4 additions & 0 deletions src/main/java/org/opensearch/ubi/ext/UbiParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.opensearch.search.SearchExtBuilder;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
Expand Down Expand Up @@ -239,6 +240,9 @@ public void setUserQuery(String userQuery) {
* @return A map of attributes.
*/
public Map<String, String> getQueryAttributes() {
if(queryAttributes == null) {
queryAttributes = new HashMap<>();
}
return queryAttributes;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,30 @@

- gte: { hits.total: 1 }

- do:
search:
rest_total_hits_as_int: true
index: ecommerce
body: "{\"query\": {\"match\": {\"category\": \"notebook\"}}, \"ext\": {\"ubi\": {\"query_id\": \"abcdef\", \"client_id\": \"abcabc\", \"user_query\": \"notebook\"}}}"

- gte: { hits.total: 1 }

- do:
search:
rest_total_hits_as_int: true
index: ecommerce
body: "{\"query\": {\"match\": {\"category\": \"notebook\"}}, \"ext\": {\"ubi\": {}}}"

- gte: { hits.total: 1 }

- do:
search:
rest_total_hits_as_int: true
index: ecommerce
body: "{\"query\": {\"match\": {\"category\": \"notebook\"}}}"

- gte: { hits.total: 1 }

- do:
cluster.health:
index: [ubi_queries]
Expand All @@ -59,4 +83,4 @@
index: ubi_queries
body: {}

- match: {count : 1}
- match: {count : 4}

0 comments on commit 2969a47

Please sign in to comment.