[
https://issues.apache.org/jira/browse/LUCENE-7394?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15392121#comment-15392121
]
Martijn van Groningen commented on LUCENE-7394:
-----------------------------------------------
bq. We'd still need a way to set a Similarity so that we can encode norms, I
think?
Yes, but that should be set before adding fields as a constructor parameter.
bq. The tricky part here is going to be untangling the various shared block
pools. We need to make sure that calling .addField() doesn't change the data
referenced by a previously created IndexReader, which is where I got stuck last
time I tried playing around with this idea.
I think we should avoid sharing shared block pools between IndexReader
instances, this makes it hard (impossible?) to make MemoryIndex immutable and
cleanup this class. To be clear about this we should from an usage / api
perspective MemoryIndex should be renamed to MemoryIndexBuilder (that has
constructor that accepts a Similarity) and has two methods (addField(...) and
build(), after build has been invoked calling addField(...) will fail).
Later on we can investigate some kind of a reuse by adding an extra constructor
to MemoryIndexBuilder that accepts an IndexReader. This would make copy of the
previous create MemoryIndex and where possible shallow copies / clones of the
previous created data structures.
> Make MemoryIndex immutable
> --------------------------
>
> Key: LUCENE-7394
> URL: https://issues.apache.org/jira/browse/LUCENE-7394
> Project: Lucene - Core
> Issue Type: Improvement
> Reporter: Martijn van Groningen
>
> The MemoryIndex itself should just be a builder that constructs an
> IndexReader instance. The whole notion of freezing a memory index should be
> removed.
> While we change this we should also clean this class up. There are many
> methods to add a field, we should just have a single method that accepts a
> `IndexableField`.
> The `keywordTokenStream(...)` method is unused and untested and should be
> removed and it doesn't belong with the memory index.
> The `setSimilarity(...)`, `createSearcher(...)` and `search(...)` methods
> should be removed, because the MemoryIndex should just be responsible for
> creating an IndexReader instance.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]