Re: NullPointerException at lucene.analysis.StopFilter with 1.3

2008-06-09 Thread Ronald K. Braun
 : I'm just looking into transitioning from solr 1.2 to 1.3 (trunk).  I
 : have some legacy handler code (called AdvancedRequestHandler) that
 : used to work with 1.2 but now throws an exception using 1.3 (latest
 : nightly build).

 This is an interesting use case that wasn't really considered when we
 switched away from using hte SolrCore singlton ...
 When I have some more time, i'll spin up a thread on solr-dev to discuss
 what we should do about this -- n the mean time feel free to file a bug
 that StopFilter isn't backwards compatible.

Created SOLR-594 for this issue.

 FWIW: constructing a new TokenizerChain inside your RequestHandlers
 handeRequest method seems  unneccessary.   if nothing else, you could
 do this in your init method and reuse the TokenizerChain on every request.
 but if it were me, I'd just use the schema.xml to declare a fieldtype that
 had the behavior i want, and then use
 schema.getFieldType(specialType).getQueryAnalyzer().tokenStream(...)

I actually had a single reusable version, but flattened it back out in
the code snippet for clarity.  But thanks for the tactful suggestion.
:-)  I didn't know that you could fetch the tokenizer chain directly
from the schema (how cool), which was what was originally desired --
the constructed tokenizer was just mirroring an existing field.  I
appreciate the tip, Hoss -- much cleaner!

r


Re: NullPointerException at lucene.analysis.StopFilter with 1.3

2008-06-02 Thread Chris Hostetter

: I'm just looking into transitioning from solr 1.2 to 1.3 (trunk).  I
: have some legacy handler code (called AdvancedRequestHandler) that
: used to work with 1.2 but now throws an exception using 1.3 (latest
: nightly build). The exception is this:

The short answer is: right after you call stopFilter.init(args) call 
stopFilter.inform(solrCore.getSolrConfig().getResourceLoader());

This is an interesting use case that wasn't really considered when we 
switched away from using hte SolrCore singlton and the the 
ResourceLoaderAware interface was added.  we made sure things would still 
work for people who had their own custom Analysis Factories, but some of 
the functionality in *existing* Factories was moved from the init() method 
to inform() ... which means the classes aren't technically backwards 
compatibly for people doing what you're doing: constructing them directly.

When I have some more time, i'll spin up a thread on solr-dev to discuss 
what we should do about this -- n the mean time feel free to file a bug 
that StopFilter isn't backwards compatible.

FWIW: constructing a new TokenizerChain inside your RequestHandlers 
handeRequest method seems  unneccessary.   if nothing else, you could 
do this in your init method and reuse the TokenizerChain on every request.  
but if it were me, I'd just use the schema.xml to declare a fieldtype that 
had the behavior i want, and then use 
schema.getFieldType(specialType).getQueryAnalyzer().tokenStream(...)



-Hoss