How to search for issueIds with SearchProvider with streaming

I want to search by issueIds with streaming to reduce memory consumption instead of using pagination.

The searchProvider has a method var1, ApplicationUser var2, Collector var3)

I could write my own collector but there already exists a IssueIdsCollector, but I don't know how to create a new instance of it and the documentation is lacking examples.

I could roll my own f.x.:

public class MyIssueIdCollector extends FieldableDocumentHitCollector {
    private final Set<Long> issueIds = new HashSet<>(4096);

    private final FieldSelector selector = fieldName -> {
        if (fieldName.equals(DocumentConstants.ISSUE_ID)) {
            return FieldSelectorResult.LOAD_AND_BREAK;
        return FieldSelectorResult.NO_LOAD;

    protected FieldSelector getFieldSelector() {
        return selector;

    public void collect(Document d) {
        String issueIdString = d.get(DocumentConstants.ISSUE_ID);

    public Set<Long> getIssueIds() {
        return issueIds;

How can I use the IssueIdsCollector or should I not use it at all?