[ https://issues.apache.org/jira/browse/SOLR-9720?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15631447#comment-15631447 ]
Joel Bernstein commented on SOLR-9720: -------------------------------------- This is quite nice: {code} + public Map toMap(Map<String, Object> map) { + try { + if (!isOpen) { + open(); + isOpen = true; + } + } catch (IOException e) { + throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e); + } + return Collections.singletonMap("docs", new Iterator<Tuple>() { + Tuple tuple; + boolean isEOF = false; + + @Override + public boolean hasNext() { + if (isEOF) return false; + if (tuple != null) return true; + try { + tuple = read(); + if(tuple != null && tuple.EOF) close(); + return tuple != null; + } catch (IOException e) { + throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e); + } + } + + @Override + public Tuple next() { + Tuple tmp = tuple; + tuple = null; + isEOF = tmp == null || tmp.EOF; + return tmp; + } + }); } {code} > Refactor responsewriter to remove dependencies on TupleStream etc > ----------------------------------------------------------------- > > Key: SOLR-9720 > URL: https://issues.apache.org/jira/browse/SOLR-9720 > Project: Solr > Issue Type: Sub-task > Security Level: Public(Default Security Level. Issues are Public) > Reporter: Noble Paul > Assignee: Noble Paul > Attachments: SOLR-9720.patch > > > ResponseWriters are designed to be agnostic of components and they should > work with the well know set of types we already support -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org