You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Ashley Ryan <av...@gmail.com> on 2016/10/13 15:47:33 UTC

Lucene Query Parser Special Characters

Hi,

I'm working on a project that uses
the org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser.
I found in the documentation online that the list of special characters is
as follows:

+ - && || ! ( ) { } [ ] ^ " ~ * ? : \

This list does not include angle brackets (< >) but the
StandardSyntaxParser generates the following exception when it attempts to
parse a string containing these characters:

INVALID_SYNTAX_CANNOT_PARSE: Syntax Error, cannot parse

Obviously, our work around of escaping the angle brackets works as we need
it to, but it seems to me that your documentation is incorrect. Am I
misunderstanding the documentation or conflating the issue I'm seeing with
the topic of special characters?

Thanks,
Ashley Ryan

Re: Lucene Query Parser Special Characters

Posted by Ashley Ryan <av...@gmail.com>.
The documentation I'm referencing is here:
https://lucene.apache.org/core/4_5_1/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package_description,
with a note:  org.apache.lucene.queryparser.flexible.standard
<https://lucene.apache.org/core/4_5_1/queryparser/org/apache/lucene/queryparser/flexible/standard/package-summary.html>
has
an alternative queryparser that matches the syntax of this one, but is more
modular, enabling substantial customization to how a query is created.


On Thu, Oct 13, 2016 at 7:56 PM, Trejkaz <tr...@trypticon.org> wrote:

> On Fri, Oct 14, 2016 at 2:47 AM, Ashley Ryan <av...@gmail.com>
> wrote:
> > Obviously, our work around of escaping the angle brackets works as we
> need
> > it to, but it seems to me that your documentation is incorrect. Am I
> > misunderstanding the documentation or conflating the issue I'm seeing
> with
> > the topic of special characters?
>
> Maybe the documentation you're reading is for the older QueryParser
> and not StandardQueryParser? Neither StandardQueryParser and
> StandardSyntaxParser appear to say anything about special
> characters... or indeed very much about the syntax at all, which is a
> bit of a gap.
>
> TX
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>


-- 
Ashley Ryan

Re: Lucene Query Parser Special Characters

Posted by Trejkaz <tr...@trypticon.org>.
On Fri, Oct 14, 2016 at 2:47 AM, Ashley Ryan <av...@gmail.com> wrote:
> Obviously, our work around of escaping the angle brackets works as we need
> it to, but it seems to me that your documentation is incorrect. Am I
> misunderstanding the documentation or conflating the issue I'm seeing with
> the topic of special characters?

Maybe the documentation you're reading is for the older QueryParser
and not StandardQueryParser? Neither StandardQueryParser and
StandardSyntaxParser appear to say anything about special
characters... or indeed very much about the syntax at all, which is a
bit of a gap.

TX

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org