You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Uwe Schindler (JIRA)" <ji...@apache.org> on 2012/06/21 12:24:42 UTC

[jira] [Comment Edited] (LUCENE-3312) Break out StorableField from IndexableField

    [ https://issues.apache.org/jira/browse/LUCENE-3312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13398327#comment-13398327 ] 

Uwe Schindler edited comment on LUCENE-3312 at 6/21/12 10:24 AM:
-----------------------------------------------------------------

Chris: The iterator looks generics-wise correct, the big problem is that it only works correct with Lists implementing RandomAccess. To work performant and correct on all Lists, it should use the ListIterator/Iterator of the wrapped List.

The second problem is that it violates the Iterator pattern: You should be able to call next() without calling hasNext() before and you must also be able to call hasNext() multiple times. So the "iteration" logic must be in next(). Ideally you can do that by coping some code from commons-collections or google-collect. The general pattern how to implement filtering decorators for other Iterators is to use a doNext() method which moves the wrapped iterator forward and is called inside next() after the current value was returned (means the wrapped iterator is already one step further than the outer iterator).

Uwe
                
      was (Author: thetaphi):
    Chris: The iterator looks generics-wise correct, the big problem is that it only works correct with Lists implementing RandomAccess. To work performant and correct on all Lists, it should use the ListIterator/Iterator of the wrapped List.

Uwe
                  
> Break out StorableField from IndexableField
> -------------------------------------------
>
>                 Key: LUCENE-3312
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3312
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: core/index
>            Reporter: Michael McCandless
>            Assignee: Nikola Tankovic
>              Labels: gsoc2012, lucene-gsoc-12
>             Fix For: Field Type branch
>
>         Attachments: lucene-3312-patch-01.patch, lucene-3312-patch-02.patch, lucene-3312-patch-03.patch, lucene-3312-patch-04.patch, lucene-3312-patch-05.patch
>
>
> In the field type branch we have strongly decoupled
> Document/Field/FieldType impl from the indexer, by having only a
> narrow API (IndexableField) passed to IndexWriter.  This frees apps up
> use their own "documents" instead of the "user-space" impls we provide
> in oal.document.
> Similarly, with LUCENE-3309, we've done the same thing on the
> doc/field retrieval side (from IndexReader), with the
> StoredFieldsVisitor.
> But, maybe we should break out StorableField from IndexableField,
> such that when you index a doc you provide two Iterables -- one for the
> IndexableFields and one for the StorableFields.  Either can be null.
> One downside is possible perf hit for fields that are both indexed &
> stored (ie, we visit them twice, lookup their name in a hash twice,
> etc.).  But the upside is a cleaner separation of concerns in API....

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org