Hi,

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:

HTTP Status 500 - null java.lang.NullPointerException at
org.apache.lucene.analysis.StopFilter.<init>(StopFilter.java:74) at
org.apache.solr.analysis.StopFilterFactory.create(StopFilterFactory.java:57)
at org.apache.solr.analysis.StopFilterFactory.create(StopFilterFactory.java:33)
at org.apache.solr.analysis.TokenizerChain.tokenStream(TokenizerChain.java:48)
at bc.solr.StopWordAnalysis.<init>(StopWordAnalysis.java:40) at
bc.solr.DisMaxQueryFactory.getQueryFields(DisMaxQueryFactory.java:130)
at bc.solr.DisMaxQueryFactory.createQuery(DisMaxQueryFactory.java:64)
at 
bc.solr.AdvancedRequestHandler.handleRequestBody(AdvancedRequestHandler.java:101)
at 
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:125)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:965) at
org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:338)
at 
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:272)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)

The problematic code is constructing a token pipeline and using it to
test a user query to see if it is only composed of stop-words:

                TokenizerFactory tokenizer = new WhitespaceTokenizerFactory();

                Map<String, String> args = new HashMap<String, String>();
                args.put("ignoreCase", "true");
                args.put("words", "stopwords.txt");
                StopFilterFactory stopFilter = new StopFilterFactory();
                stopFilter.init(args);

                args = new HashMap<String, String>();
                args.put("generateWordParts", "1");
                args.put("generateNumberParts", "1");
                args.put("catenateWords", "0");
                args.put("catenateNumbers", "0");
                args.put("catenateAll", "0");
                WordDelimiterFilterFactory wordFilter = new 
WordDelimiterFilterFactory();
                wordFilter.init(args);

                TokenFilterFactory[] filters = new TokenFilterFactory[] {
stopFilter, wordFilter };
                TokenizerChain pipeline =TokenizerChain(tokenizer, filters);

                /*** StopWordAnalysis.java:40 is the next line: ***/
                boolean onlyStopWords = pipeline.tokenStream(null, new
StringReader(query)).next() == null;

Failure seems to occur independent of the value for query (e.g.,
"bill").  The code is built against these jars:

lucene-core-2.4-dev.jar
apache-solr-1.3-dev.jar
apache-solr-common-1.3-dev.jar

I poked around the lucene issues (very) briefly and found only
LUCENE-1140, which is closed and presumably already incorporated into
2.4.  It looks like StopFilter was rewritten between 1.2 release and
the current version.  I'm not familiar with the lucene community and
may have well missed something.  It is also conceivable I've got
something mis-setup since I'm just prototyping the 1.3 environment.

Is there a lucene forum I should kick this to, or is this old code
problematic in some way that isn't obvious to a newbie?

Thanks!

Ron

Reply via email to