[ 
https://issues.apache.org/jira/browse/SOLR-243?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499369
 ] 

Hoss Man commented on SOLR-243:
-------------------------------

regarding the IndexReaderFactory.DEFAULT, i have  ahard time viewing it as good 
coding style at all ..but then again i've never seen any literature arguming 
for or against the concept, so i'm not sure what the "pros" are.  My personal 
list of "cons"...
a) violates the API / impl abstraction; interfaces shouldn't have to know about 
any of their Impls
b) forces people who want to write their own impl to have the "default" class 
loaded at run time even if they don't use it.
c) can't be changed; static variables in interfaces are be final (even if they 
aren't declared final) and can give the false impression to people reading an 
API that they can change it to something else.

as far as #6 above (an init method)  SolrCore.parseListener is a good example 
of how to NamedList style initing (see the SolrEventListener API).  
IndexSchema.readTokenFilterFactory is a good example of the simpler Map style 
initing.

I saw an idea thrown around recently about making super interfaces for each of 
the two types of initialization so a lot of this code could be refactored away 
... but that probably won't happen soon, and when/if it does it will be a big 
undertaking that will clean up everything, so in the mean time a 
cut/paste/tweak approach would be the best way to proceed

> Create a hook to allow custome code to create custome index readers
> -------------------------------------------------------------------
>
>                 Key: SOLR-243
>                 URL: https://issues.apache.org/jira/browse/SOLR-243
>             Project: Solr
>          Issue Type: Improvement
>          Components: search
>    Affects Versions: 1.3
>         Environment: Solr core
>            Reporter: John Wang
>             Fix For: 1.3
>
>         Attachments: indexReaderFactory.patch
>
>
> I have a customized IndexReader and I want to write a Solr plugin to use my 
> derived IndexReader implementation. Currently IndexReader instantiation is 
> hard coded to be: 
> IndexReader.open(path)
> It would be really useful if this is done thru a plugable factory that can be 
> configured, e.g. IndexReaderFactory
> interface IndexReaderFactory{
>      IndexReader newReader(String name,String path);
> }
> the default implementation would just return: IndexReader.open(path)
> And in the newSearcher and getSearcher methods in SolrCore class can call the 
> current factory implementation to get the IndexReader instance and then build 
> the SolrIndexSearcher by passing in the reader.
> It would be really nice to add this improvement soon (This seems to be a 
> trivial addition) as our project really depends on this.
> Thanks
> -John

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to