lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Friedman <pfried...@macromedia.com>
Subject RE: QueryParser.parse(...) javadoc is incorrect
Date Wed, 07 Nov 2001 14:03:59 GMT
Here's an example that throws the TokenMgrError.

import org.apache.lucene.queryParser.*; 
import org.apache.lucene.search.*; 
import org.apache.lucene.index.*; 
import org.apache.lucene.analysis.*; 
import org.apache.lucene.analysis.standard.*;
import org.apache.lucene.document.*; 

public class ParseTest { 

    public static void main(String args[]) throws Exception {

    	Analyzer analyzer = new StandardAnalyzer(); 
    	IndexReader reader = IndexReader.open("index");
    	Searcher searcher = new IndexSearcher(reader);
    	String qStr = "[]";
    	Query query = QueryParser.parse(qStr, "text", analyzer);
    }
}

-----Original Message-----
From: Brian Goetz [mailto:brian@quiotix.com]
Sent: Tuesday, November 06, 2001 3:40 PM
To: Lucene Users List
Subject: Re: QueryParser.parse(...) javadoc is incorrect


> The javadoc for QueryParser.parse(...) says that it throws a
ParseException
> if an error occurs, in fact, it throws an
> org.apache.lucene.queryParser.TokenMgrError.

Actually, this is not quite correct.  

It throws a ParseException if it encounters a valid sequence of tokens
but which do not match the parsing rules.  For example, I'll bet 
  foo AND AND bar
would throw a ParseException, even though this is a sequence of valid
tokens.  

It throws a TokenMgrError when it cannot even assemble a sequence of
characters into a token.  This shouldn't happen; post the offending
query and I'll see if it can be fixed.


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

--
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