Skip to content

Commit

Permalink
Storing metrics as doubles.
Browse files Browse the repository at this point in the history
  • Loading branch information
jzonthemtn committed Dec 10, 2024
1 parent 5b20319 commit 7faaaad
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +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=none&query_set_size=10"
curl -s -X POST "http://localhost:9200/_plugins/search_quality_eval/queryset?name=test&description=fake&sampling=none&query_set_size=500"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -e

QUERY_SET_ID="955df665-9cd5-4828-bda0-9aea2d002279"
QUERY_SET_ID="1b25e19b-24d2-4efc-9c3e-59470c68f7b6"
JUDGMENTS_ID="0615e159-675b-4c60-875a-24daeb8c126c"
INDEX="ecommerce"
ID_FIELD="asin"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ public Double getJudgmentValue(final String judgmentsId, final String query, fin

final Map<String, Object> j = searchResponse.getHits().getAt(0).getSourceAsMap();

LOGGER.info("Judgment contains a value: {}", j.get("judgment"));

// TODO: Why does this not exist in some cases?
if(j.containsKey("judgment")) {
judgment = (Double) j.get("judgment");
Expand Down Expand Up @@ -178,7 +180,7 @@ protected List<Double> getRelevanceScores(final String judgmentsId, final String
if(!Double.isNaN(judgmentValue)) {
scores.add(judgmentValue);
} else {
LOGGER.info("No score found for document ID {} with judgments {} and query {}", documentId, judgmentsId, query);
//LOGGER.info("No score found for document ID {} with judgments {} and query {}", documentId, judgmentsId, query);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public void save(final QuerySetRunResult result) throws Exception {

// Add each metric to the object to index.
for (final String metric : result.getSearchMetrics().keySet()) {
results.put(metric, String.valueOf(result.getSearchMetrics().get(metric)));
results.put(metric, result.getSearchMetrics().get(metric));
}

final IndexRequest indexRequest = new IndexRequest(SearchQualityEvaluationPlugin.QUERY_SETS_RUN_RESULTS_INDEX_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public Collection<Map<String, Object>> getQueryResultsAsMap() {

// Calculate and add each metric to the map.
for(final SearchMetric searchMetric : queryResult.getSearchMetrics()) {
q.put(searchMetric.getName(), String.valueOf(searchMetric.calculate()));
q.put(searchMetric.getName(), searchMetric.calculate());
}

qs.add(q);
Expand Down

0 comments on commit 7faaaad

Please sign in to comment.