Skip to content

Commit

Permalink
Adding todo for shortcircuit in PPTSS.
Browse files Browse the repository at this point in the history
Signed-off-by: jzonthemtn <[email protected]>
  • Loading branch information
jzonthemtn committed Dec 10, 2024
1 parent 5e388bb commit d62ca4d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
#!/bin/bash -e

#QUERY_SET=`curl -s -X POST "http://localhost:9200/_plugins/search_quality_eval/queryset?name=test&description=fake&sampling=pptss" | jq .query_set | tr -d '"'`
curl -s -X POST "http://localhost:9200/_plugins/search_quality_eval/queryset?name=test&description=fake&sampling=none&query_set_size=500"

#echo ${QUERY_SET}

#curl -s http://localhost:9200/search_quality_eval_query_sets/_search | jq

# Run the query set now.
#curl -s -X POST "http://localhost:9200/_plugins/search_quality_eval/run?id=${QUERY_SET}" | jq
curl -s -X DELETE "http://localhost:9200/search_quality_eval_query_sets"

curl -s -X POST "http://localhost:9200/_plugins/search_quality_eval/queryset?name=test&description=fake&sampling=none&query_set_size=10"
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,4 @@

curl -s -X DELETE "http://localhost:9200/search_quality_eval_query_sets"

curl -s -X POST "http://localhost:9200/_plugins/search_quality_eval/queryset?name=test&description=fake&sampling=pptss&query_set_size=100"


#QUERY_SET=`curl -s -X POST "http://localhost:9200/_plugins/search_quality_eval/queryset?name=test&description=fake&sampling=pptss" | jq .query_set | tr -d '"'`
#curl -s -X POST "http://localhost:9200/_plugins/search_quality_eval/queryset?name=test&description=fake&sampling=pptss&query_set_size=100"

#echo ${QUERY_SET}

#curl -s -X GET http://localhost:9200/search_quality_eval_query_sets/_doc/${QUERY_SET} | jq

# Run the query set now.
#curl -s -X POST "http://localhost:9200/_plugins/search_quality_eval/run?id=${QUERY_SET}" | jq

curl -s -X POST "http://localhost:9200/_plugins/search_quality_eval/queryset?name=test&description=fake&sampling=pptss&query_set_size=20"
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public String sample() throws Exception {
final SearchRequest searchRequest = new SearchRequest(SearchQualityEvaluationPlugin.UBI_QUERIES_INDEX_NAME);
searchRequest.source(searchSourceBuilder);

// TODO: Don't use .get()
final SearchResponse searchResponse = client.search(searchRequest).get();

final Map<String, Long> queries = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ public String sample() throws Exception {

while (searchHits != null && searchHits.length > 0) {

LOGGER.info("search hits size = {}", searchHits.length);

for(final SearchHit hit : searchHits) {
final Map<String, Object> fields = hit.getSourceAsMap();
userQueries.add(fields.get("user_query").toString());
Expand Down Expand Up @@ -137,7 +135,10 @@ public String sample() throws Exception {
// This may require generating more random numbers than what was requested
// because removing duplicate user queries will require randomly picking more queries.
int count = 1;
while(querySet.size() < parameters.getQuerySetSize() && count < userQueries.size()) {

// TODO: How to short-circuit this such that if the same query gets picked over and over, the loop will never end.
final int max = 5000;
while(querySet.size() < parameters.getQuerySetSize() && count < max) {

// Make a random number not yet used.
double random;
Expand All @@ -160,7 +161,7 @@ public String sample() throws Exception {
querySet.put(closestQuery, weights.get(closestQuery));
count++;

// LOGGER.info("Generated random value: {}; Smallest delta = {}; Closest query = {}", random, smallestDelta, closestQuery);
//LOGGER.info("Generated random value: {}; Smallest delta = {}; Closest query = {}", random, smallestDelta, closestQuery);

}

Expand Down

0 comments on commit d62ca4d

Please sign in to comment.