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

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

some comments after reading the patch (haven't run it yet) ...

1) in the future, please use 2 spaces for indenting (and no tabs)

2) the existing public constructors for SolrIndexSearcher are now private which 
is an API change that has to be carefully considered ... on top of that, they 
don't even use the new IndexReder factory at all (they could get it by asking 
the SolrCore - it's a singleton).

3) instead of adding a new indexReaderFactory element directly to the 
solrconfig.xml, it would probably make sense to get it when parsing the 
mainIndex/indexDefaults blocks.

4) StandardIndexReaderFactory" might be a better class name then 
"DefaultIndexReaderFactory"

5) I don't think we really need IndexReaderFactory.DEFAULT (static final 
instances in interfaces never make sense to me, they are not part of the 
"interface")  ... just let SolrCore have a hardcoded instance of to use if it 
can't find one in the config.

6) people should be able to specify configuration options for their factories 
... either using an init(NamedLIst) method (like RequestHandlers) or using an 
init(Map<String,String>) method (like Caches, TokenFilters, etc...)

7) catching "Exception" when calling newInstance() is too broad. explicitly 
catch only the exceptions that are expected and warrant using the default 
factory, otherwise you might silently ignore a really serious problem. ... 
although frankly, if someone configures an explict IndexReader, and it can't be 
instantiated, that should probably be SEVERE not just WARNING.





> 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