Mailing List Archive

Queryparser croaking on "[" and "]"
Hi,

I'm currently building a small app that allows searching of Java sourcecode.
The problem I'm getting is when parsing a query string that contains an
array specifier (ie. String[] or int[][]) the query parser seem to croak
with a

Lexical error at line XX, column XX. Encountered: after : "[]"


So what am I doing wrong / what should I write to fix this?


Les


--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
RE: Queryparser croaking on "[" and "]" [ In reply to ]
Les

Parse your query string to remove the charactors '[' , ']' etc. which
are deemed illegal by lucene query-semantics.

-Goutam


-----Original Message-----
From: Les Hughes [mailto:leslie.hughes@rubus.com]
Sent: Wednesday, February 20, 2002 4:44 PM
To: 'lucene-user@jakarta.apache.org'
Subject: Queryparser croaking on "[" and "]"


Hi,

I'm currently building a small app that allows searching of Java sourcecode.
The problem I'm getting is when parsing a query string that contains an
array specifier (ie. String[] or int[][]) the query parser seem to croak
with a

Lexical error at line XX, column XX. Encountered: after : "[]"


So what am I doing wrong / what should I write to fix this?


Les


--
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: Queryparser croaking on "[" and "]" [ In reply to ]
This is because the query parser uses [] to denote ranges of numbers.
(I always thought this was a bad choice of syntax for exactly this
reason.)


On Wed, Feb 20, 2002 at 11:14:05AM -0000, Les Hughes wrote:
> Hi,
>
> I'm currently building a small app that allows searching of Java sourcecode.
> The problem I'm getting is when parsing a query string that contains an
> array specifier (ie. String[] or int[][]) the query parser seem to croak
> with a
>
> Lexical error at line XX, column XX. Encountered: after : "[]"
>
>
> So what am I doing wrong / what should I write to fix this?
>
>
> Les
>
>
> --
> 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: Queryparser croaking on "[" and "]" [ In reply to ]
Actually, [] denotes an inclusive range of Terms. Anyway, why not change
the syntax if this is bad...?

Scott

> -----Original Message-----
> From: Brian Goetz [mailto:brian@quiotix.com]
> Sent: Wednesday, February 20, 2002 10:08 AM
> To: Lucene Users List
> Subject: Re: Queryparser croaking on "[" and "]"
>
>
> This is because the query parser uses [] to denote ranges of numbers.
> (I always thought this was a bad choice of syntax for exactly this
> reason.)
>
>
> On Wed, Feb 20, 2002 at 11:14:05AM -0000, Les Hughes wrote:
> > Hi,
> >
> > I'm currently building a small app that allows searching of
> Java sourcecode.
> > The problem I'm getting is when parsing a query string that
> contains an
> > array specifier (ie. String[] or int[][]) the query parser
> seem to croak
> > with a
> >
> > Lexical error at line XX, column XX. Encountered: after : "[]"
> >
> >
> > So what am I doing wrong / what should I write to fix this?
> >
> >
> > Les
> >
> >
> > --
> > 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: Queryparser croaking on "[" and "]" [ In reply to ]
On the developer list someone recently asked if special query characters should be escapable and I think this problem demonstrates that they should. So if you want to search for the literals [ and ] in a query like String[] you could escape them with the possibly a backslash so the query would be formatted as String\[\].


-----Original Message-----
From: Scott Ganyo [mailto:scott.ganyo@eTapestry.com]
Sent: Wednesday, February 20, 2002 2:58 PM
To: 'Lucene Users List'
Subject: RE: Queryparser croaking on "[" and "]"


Actually, [] denotes an inclusive range of Terms. Anyway, why not change
the syntax if this is bad...?

Scott

> -----Original Message-----
> From: Brian Goetz [mailto:brian@quiotix.com]
> Sent: Wednesday, February 20, 2002 10:08 AM
> To: Lucene Users List
> Subject: Re: Queryparser croaking on "[" and "]"
>
>
> This is because the query parser uses [] to denote ranges of numbers.
> (I always thought this was a bad choice of syntax for exactly this
> reason.)
>
>
> On Wed, Feb 20, 2002 at 11:14:05AM -0000, Les Hughes wrote:
> > Hi,
> >
> > I'm currently building a small app that allows searching of
> Java sourcecode.
> > The problem I'm getting is when parsing a query string that
> contains an
> > array specifier (ie. String[] or int[][]) the query parser
> seem to croak
> > with a
> >
> > Lexical error at line XX, column XX. Encountered: after : "[]"
> >
> >
> > So what am I doing wrong / what should I write to fix this?
> >
> >
> > Les
> >
> >
> > --
> > 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: Queryparser croaking on "[" and "]" [ In reply to ]
Hi,

No can do. [] means something to my content (i.e. show me the methods that
take an array as a parameter).

Do I need to write a specialised "JavaQueryParser" then?

Bye,

Les


-----Original Message-----
From: Biswas, Goutam_Kumar
To: 'Lucene Users List'
Sent: 20/02/02 12:00
Subject: RE: Queryparser croaking on "[" and "]"

Les

Parse your query string to remove the charactors '[' , ']' etc.
which
are deemed illegal by lucene query-semantics.

-Goutam


-----Original Message-----
From: Les Hughes [mailto:leslie.hughes@rubus.com]
Sent: Wednesday, February 20, 2002 4:44 PM
To: 'lucene-user@jakarta.apache.org'
Subject: Queryparser croaking on "[" and "]"


Hi,

I'm currently building a small app that allows searching of Java
sourcecode.
The problem I'm getting is when parsing a query string that contains an
array specifier (ie. String[] or int[][]) the query parser seem to croak
with a

Lexical error at line XX, column XX. Encountered: after : "[]"


So what am I doing wrong / what should I write to fix this?


Les


--
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: Queryparser croaking on "[" and "]" [ In reply to ]
Hi,

No can do. [] means something to my content (i.e. show me the methods that
take an array as a parameter).

Do I need to write a specialised "JavaQueryParser" then?

Bye,

Les


-----Original Message-----
From: Biswas, Goutam_Kumar
To: 'Lucene Users List'
Sent: 20/02/02 12:00
Subject: RE: Queryparser croaking on "[" and "]"

Les

Parse your query string to remove the charactors '[' , ']' etc.
which
are deemed illegal by lucene query-semantics.

-Goutam


-----Original Message-----
From: Les Hughes [mailto:leslie.hughes@rubus.com]
Sent: Wednesday, February 20, 2002 4:44 PM
To: 'lucene-user@jakarta.apache.org'
Subject: Queryparser croaking on "[" and "]"


Hi,

I'm currently building a small app that allows searching of Java
sourcecode.
The problem I'm getting is when parsing a query string that contains an
array specifier (ie. String[] or int[][]) the query parser seem to croak
with a

Lexical error at line XX, column XX. Encountered: after : "[]"


So what am I doing wrong / what should I write to fix this?


Les


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