Hm, I've got the latest Lucene (from CVS) and don't have this issue. The query I tried on our index is: +title:of +title:someotherwordthatDOESgetmeresults
Otis --- "Biswas, Goutam_Kumar" <[EMAIL PROTECTED]> wrote: > Dear Lucene Users > > Lucene throws an ArrayIndexOutOfBoundsException() if the first > term in > my query string is a stopWord. Why is it so ? > > I'm making AND as the default mode of search. So I'm adding an > AND > operator between each term of my query. That is if my query > is 'cats dogs' I'm rephrasing it as 'cats AND dogs'. But if the > first > term is a stopWord (example: 'of cats ...') I get the > ArrayIndexOutOfBoundsException. > > I'm tried something like the following to get away with this: > > // <<<<<<<<<<<<<<<<< > String queryStr = "of AND by AND for AND cats AND dogs"; // > 'of', 'by', > 'for' are stopwords > Query query = null; > Analyzer myAnalyzer = new MyAnalyzer(stopWords); > try { > query = QueryParser.parse(queryStr, "content", myAnalyzer); > // > content is the default field to search. > } catch (ArrayIndexOutOfBoundsException e) { > queryStr = queryStr.substring(queryStr.indexOf("AND") + 3); > } > // > // so my final queryStr becomes 'cats AND dogs' which works > fine! > // > // >>>>>>>>>>>>>>>>>> > > Is there a better way to handle this situation ? or can someone > throw a > pointer on why this error is occuring in the first place ? > > Thanks in advance > -Goutam > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > __________________________________________________ Do You Yahoo!? Try FREE Yahoo! Mail - the world's greatest free email! http://mail.yahoo.com/ -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>