[
https://issues.apache.org/jira/browse/LUCENE-3312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13398324#comment-13398324
]
Chris Male commented on LUCENE-3312:
------------------------------------
Hey Nikola,
Just did a quick pass over the patch.
I have an alternative way to do the Indexable/StorableFieldsIterator in
Document (it'll need the policeman's tick though):
{code}
public abstract class SelectiveIterator<T> implements Iterator<T> {
private T next;
private final List<T> list;
private int pos;
public SelectiveIterator(List<T> list) {
this.list = list;
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
@Override
public boolean hasNext() {
for (; pos < list.size(); pos++) {
T t = list.get(pos);
if (isNext(t)) {
next = t;
return true;
}
}
return false;
}
@Override
public T next() {
return next;
}
abstract boolean isNext(T t);
}
{code}
I think that'll work. Then you can just create two instances which implement
{{isNext}} differently.
I also noticed that you've included {{import
org.apache.commons.lang.NotImplementedException;}} in Document which will also
need to be removed.
> 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: [email protected]
For additional commands, e-mail: [email protected]