Mailing List Archive

Lexical Error
I just encountered an Error searching for a Term like ${test}.
org.apache.lucene.queryParser.TokenMgrError: Lexical error at line 1, column
1. Encountered: "$" (36), after : ""

Is this error known?

Chris


--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
AW: Lexical Error [ In reply to ]
Is there a good reason, why the QueryParser should throw an Error instead of
an Exception?

> -----Ursprungliche Nachricht-----
> Von: Christian Schrader [mailto:schrader.news@evendi.de]
> Gesendet: December 7, 2001 12:57 PM
> An: Lucene Users List
> Betreff: Lexical Error
>
>
> I just encountered an Error searching for a Term like ${test}.
> org.apache.lucene.queryParser.TokenMgrError: Lexical error at
> line 1, column
> 1. Encountered: "$" (36), after : ""
>
> Is this error known?
>
> Chris
>
>
> --
> 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>
Re: AW: Lexical Error [ In reply to ]
Christian Schrader wrote:

>Is there a good reason, why the QueryParser should throw an Error instead of
>an Exception?
>
Unfortunatly this is the feature of JavaCC and not only of Lucene's
QueryParser.

peter

>
>>-----Ursprungliche Nachricht-----
>>Von: Christian Schrader [mailto:schrader.news@evendi.de]
>>Gesendet: December 7, 2001 12:57 PM
>>An: Lucene Users List
>>Betreff: Lexical Error
>>
>>
>>I just encountered an Error searching for a Term like ${test}.
>>org.apache.lucene.queryParser.TokenMgrError: Lexical error at
>>line 1, column
>>1. Encountered: "$" (36), after : ""
>>
>>Is this error known?
>>
>>Chris
>>
>>
>>--
>>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>
>




--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
AW: AW: Lexical Error [ In reply to ]
Couldn't QueryParser catch the Error and throw an Exception?
"Subclasses of Error, unlike subclasses of Exception, should not be caught
and generally cause termination of the program. Subclasses of Error need not
be declared in the throws clause of a method definition."

I am complaining, because my Servlet just crashed, even though it had a
try{}catch(Exception e){}, which should catch everything, unless catching is
worthless anyways (OutOfMemoryError) :-).

> -----Ursprungliche Nachricht-----
> Von: Halacsy Peter [mailto:halacsy.peter@axelero.com]
> Gesendet: December 7, 2001 3:06 PM
> An: Lucene Users List
> Betreff: Re: AW: Lexical Error
>
>
> Christian Schrader wrote:
>
> >Is there a good reason, why the QueryParser should throw an
> Error instead of
> >an Exception?
> >
> Unfortunatly this is the feature of JavaCC and not only of Lucene's
> QueryParser.
>
> peter
>
> >
> >>-----Ursprungliche Nachricht-----
> >>Von: Christian Schrader [mailto:schrader.news@evendi.de]
> >>Gesendet: December 7, 2001 12:57 PM
> >>An: Lucene Users List
> >>Betreff: Lexical Error
> >>
> >>
> >>I just encountered an Error searching for a Term like ${test}.
> >>org.apache.lucene.queryParser.TokenMgrError: Lexical error at
> >>line 1, column
> >>1. Encountered: "$" (36), after : ""
> >>
> >>Is this error known?
> >>
> >>Chris
> >>
> >>
> >>--
> >>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>
>




--
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>
RE: Lexical Error [ In reply to ]
I often encounter this problem when using QueryParser to parse queries that contain certain punctuation. I believe the only solution is to parse the query yourself (allowing the punctuation) and build the query objects directly.

Paul

-----Original Message-----
From: Christian Schrader [mailto:schrader.news@evendi.de]
Sent: Friday, December 07, 2001 6:57 AM
To: Lucene Users List
Subject: Lexical Error


I just encountered an Error searching for a Term like ${test}.
org.apache.lucene.queryParser.TokenMgrError: Lexical error at line 1, column
1. Encountered: "$" (36), after : ""

Is this error known?

Chris


--
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>
RE: AW: Lexical Error [ In reply to ]
try {
}
catch (Throwable th) {
// do something with error
}

-----Original Message-----
From: Christian Schrader [mailto:schrader.news@evendi.de]
Sent: Friday, December 07, 2001 9:21 AM
To: Lucene Users List
Subject: AW: AW: Lexical Error


Couldn't QueryParser catch the Error and throw an Exception?
"Subclasses of Error, unlike subclasses of Exception, should not be caught
and generally cause termination of the program. Subclasses of Error need not
be declared in the throws clause of a method definition."

I am complaining, because my Servlet just crashed, even though it had a
try{}catch(Exception e){}, which should catch everything, unless catching is
worthless anyways (OutOfMemoryError) :-).

> -----Ursprungliche Nachricht-----
> Von: Halacsy Peter [mailto:halacsy.peter@axelero.com]
> Gesendet: December 7, 2001 3:06 PM
> An: Lucene Users List
> Betreff: Re: AW: Lexical Error
>
>
> Christian Schrader wrote:
>
> >Is there a good reason, why the QueryParser should throw an
> Error instead of
> >an Exception?
> >
> Unfortunatly this is the feature of JavaCC and not only of Lucene's
> QueryParser.
>
> peter
>
> >
> >>-----Ursprungliche Nachricht-----
> >>Von: Christian Schrader [mailto:schrader.news@evendi.de]
> >>Gesendet: December 7, 2001 12:57 PM
> >>An: Lucene Users List
> >>Betreff: Lexical Error
> >>
> >>
> >>I just encountered an Error searching for a Term like ${test}.
> >>org.apache.lucene.queryParser.TokenMgrError: Lexical error at
> >>line 1, column
> >>1. Encountered: "$" (36), after : ""
> >>
> >>Is this error known?
> >>
> >>Chris
> >>
> >>
> >>--
> >>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>
>




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

--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
Re: AW: Lexical Error [ In reply to ]
> >Is there a good reason, why the QueryParser should throw an Error instead of
> >an Exception?
> >
> Unfortunatly this is the feature of JavaCC and not only of Lucene's
> QueryParser.

Sort of. It should be possible to fix this by using a different approach
to token building.

--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
Re: AW: Lexical Error [ In reply to ]
Perhaps something as simple as adding a catch-all token. When the parser
encounters something goofy, it will match the last token (and not throw an
Error), but since it isn't expecting a <CATCHALL> token,
you'll get a nice ParseException.

<*> TOKEN : {
< WHATEVER_TOKEN_DEFS_YOU_WANT: "blah" > |
< CATCHALL: ~[] >
}

-Lex



>From: Brian Goetz <brian@quiotix.com>
>Reply-To: "Lucene Users List" <lucene-user@jakarta.apache.org>
>To: Lucene Users List <lucene-user@jakarta.apache.org>
>Subject: Re: AW: Lexical Error
>Date: Fri, 7 Dec 2001 12:44:09 -0800
>
> > >Is there a good reason, why the QueryParser should throw an Error
>instead of
> > >an Exception?
> > >
> > Unfortunatly this is the feature of JavaCC and not only of Lucene's
> > QueryParser.
>
>Sort of. It should be possible to fix this by using a different approach
>to token building.
>
>--
>To unsubscribe, e-mail:
><mailto:lucene-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail:
><mailto:lucene-user-help@jakarta.apache.org>
>


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
Re: AW: Lexical Error [ In reply to ]
> Perhaps something as simple as adding a catch-all token. When the parser
> encounters something goofy, it will match the last token (and not throw an
> Error), but since it isn't expecting a <CATCHALL> token,
> you'll get a nice ParseException.
>
> <*> TOKEN : {
> < WHATEVER_TOKEN_DEFS_YOU_WANT: "blah" > |
> < CATCHALL: ~[] >
> }

Yes, this is the standard JavaCC trick for preventing the
TokenMgrError from being thrown, and it works just fine (then the
error becomes a ParseException which can be caught.)

However, I'd prefer to just fix the damn thing.

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