You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Joel Bernstein (JIRA)" <ji...@apache.org> on 2016/11/03 03:54:58 UTC
[jira] [Commented] (SOLR-9720) Refactor responsewriter to remove
dependencies on TupleStream etc
[ 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-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org