Skip to content

Commit

Permalink
Need to ensure that Query is always the first component.
Browse files Browse the repository at this point in the history
The fact that we are calling .keySet may be a problem...  Because that means other components might be in a random order?  Maybe we shouldn't even use a map of string/class, it should just be a list of classes?
  • Loading branch information
epugh committed Nov 27, 2024
1 parent 83842e9 commit c128c4a
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,24 @@ public class SearchHandler extends RequestHandlerBase
private PluginInfo shfInfo;
private SolrCore core;

/**
* The default set of components that every handler gets. You can change this by defining the
* specific components for a handler. It puts the {@link QueryComponent} first as subsequent
* components assume that the QueryComponent ran and populated the document list.
*
* @return A list of component names.
*/
protected List<String> getDefaultComponents() {
return SearchComponent.STANDARD_COMPONENTS.keySet().stream().toList();
List<String> l = new ArrayList<String>(SearchComponent.STANDARD_COMPONENTS.keySet());
moveToFirst(l, QueryComponent.COMPONENT_NAME);
return l;
}

private static void moveToFirst(List<String> list, String target) {
int index = list.indexOf(target);
assert index != -1;
list.remove(index);
list.add(0, target);
}

@Override
Expand Down

0 comments on commit c128c4a

Please sign in to comment.