Skip to content

Commit

Permalink
wow we sort them too
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Sikina committed Jan 2, 2024
1 parent 572f66c commit baffc45
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ public QueryService (

public AsyncResult runQuery(Query query) throws ClassNotFoundException, IOException {
// Merging fields from filters into selected fields for user validation of results

Collections.sort(query.getFields());
List<String> fields = query.getFields();
Collections.sort(fields);
query.setFields(fields);

AsyncResult result = initializeResult(query);

Expand Down Expand Up @@ -125,7 +126,6 @@ private AsyncResult initializeResult(Query query) throws ClassNotFoundException,
queryDecorator.setId(query);
result.id = query.getId();
result.processor = p;
queryDecorator.setId(query);
results.put(result.id, result);
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.util.LinkedHashSet;
import java.util.Set;
import java.util.TreeSet;
import java.util.*;

@Component
public class QueryDecorator {
Expand All @@ -24,6 +22,11 @@ public void setId(Query query) {
// first. This can mutate the query, resulting in shifting UUIDs
// To stabilize things, we're always going to call that, and shift the logic here
mergeFilterFieldsIntoSelectedFields(query);

// we also sort things sometimes
List<String> fields = query.getFields();
Collections.sort(fields);
query.setFields(fields);

String id = UUIDv5.UUIDFromString(query.toString()).toString();
query.setId(id);
Expand Down

0 comments on commit baffc45

Please sign in to comment.