Merge "LuceneAccountIndex: Return results from read method"

This commit is contained in:
Edwin Kempin 2016-06-27 14:04:58 +00:00 committed by Gerrit Code Review
commit 3a9284b9a2
1 changed files with 19 additions and 1 deletions

View File

@ -53,6 +53,8 @@ import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutionException;
@ -165,6 +167,23 @@ public class LuceneAccountIndex
Document doc = searcher.doc(sd.doc, fields(opts));
result.add(toAccountState(doc));
}
final List<AccountState> r = Collections.unmodifiableList(result);
return new ResultSet<AccountState>() {
@Override
public Iterator<AccountState> iterator() {
return r.iterator();
}
@Override
public List<AccountState> toList() {
return r;
}
@Override
public void close() {
// Do nothing.
}
};
} catch (IOException e) {
throw new OrmException(e);
} finally {
@ -176,7 +195,6 @@ public class LuceneAccountIndex
}
}
}
return null;
}
}