Skip to content

Commit

Permalink
Added some additional metadata fields
Browse files Browse the repository at this point in the history
  • Loading branch information
bnayfeh committed Nov 7, 2024
1 parent 74facc7 commit 68f3492
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,20 @@ public static Builder builder() {
return new Builder();
}

private static String toCSV(List<String> values) {
if (values == null || values.size() == 0) {
return "";
private static String toCSV(List<?> values) {
if (values == null) {
return null;
}
return String.join(",", values);
return String.join(",", values.toString());
}

private static Map<String, String> extractMetadata(SearXNGResult result) {
final Map<String, String> metadata = new HashMap<>();
metadata.put("engine", getOrDefault(result.getEngine(), ""));
metadata.put("engine", result.getEngine());
metadata.put("engines", toCSV(result.getEngines()));
metadata.put("score", Double.toString(result.getScore()));
metadata.put("category", result.getCategory());
metadata.put("positions", toCSV(result.getPositions()));
return metadata;
}

Expand Down

0 comments on commit 68f3492

Please sign in to comment.