lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject Re: Lucene throws an ArrayIndexOutOfBoundsException() if the first te rm in my query string is a stopWord
Date Thu, 07 Mar 2002 18:05:48 GMT
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" <Goutam-Kumar-Biswas@deshaw.com> 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:lucene-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:lucene-user-help@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

--
To unsubscribe, e-mail:   <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>


Mime
View raw message