Hi Govind,
I think you are wrong by assuming escape should receive a query string as
parameter. However, it's meant to receive a term as parameter, which will
later be used to create a query. See the example below:
// this is bad, since +, &, * and - will be escaped
String query = "+lucene&solr -
Hi,
I'm not getting you. escape() method takes String as an argument.
The code snippet I am using is as follows
*String escaped = MultiFieldQueryParser.escape(queryString);
Query query1 = parser.parse(escaped);
TopDocs results = searcher.search(query1);
*Please point out where I may be going wro
Hi Govind,
escape() method should only be used to escape term, not the query itself. If
the user is entering the query, it's his responsibility to escape the query.
On Mon, Jul 4, 2011 at 4:21 AM, govind bhardwaj wrote:
> Hi,
>
> I am using Lucene version 3.1
> Previously I had trouble regardin
Hi,
I am using Lucene version 3.1
Previously I had trouble regarding special characters as when I entered
"---" as my input, it gave the following error
*Caused by: org.apache.lucene.queryParser.ParseException: Encountered " "-"
"- "" at line 1, column 1.
Was expecting one of:
"(" ...
"*
First, kudos for making this test and attaching it. If nothing else that
makesme curious to see whether I really understand what's going on or not.
I think you're looking at the wrong tab in Luke ... I modified your test
to
write to an FSDir. When you look at the "overview" tab, you'll see three
t
I buy your theory that StandardAnalyzer is breaking up the stream, and that
this might be an indexing issue, rather than a query issue. When I look at
my index in Luke, as far as I can tell the literal (Parenth+eses is stored,
not the broken up tokens. Also, I can't seem to find an Analyzer that
I suspect that what's happening is that StandardAnalyzer is breaking
your stream up on the "odd" characters. All escaping them on the
query does is insure that they're not interpreted by the parser as (in
this case), the beginning of a group and a MUST operator. So, I
claim it correctly feeds (Pare
Say I have a book title, literally:
(Parenth+eses
How would I do a search to find exactly that book title, given the presence
of the ( and + ? QueryParser.escape isn't working.
I would expect to be able to search for (Parenth+eses [exact match] or
(Parenth+e [partial match]
I can use QueryPars
Steven A Rowe wrote:
On 08/11/2008 at 2:14 PM, Chris Hostetter wrote:
Aravind R Yarram wrote:
can i escape built in lucene keywords like OR, AND aswell?
as of the last time i checked: no, they're baked into the grammer.
I have not tested this, but I've read somewhere on t
You can simply change your input string to lowercase before passing it
to the analyzers, which will give you the effect of escaping the boolean
operators. (I.E you will now search on and or and not) Remember
however that these are extremely common words, and chances are high that
you are remo
On 08/11/2008 at 2:14 PM, Chris Hostetter wrote:
> Aravind R Yarram wrote:
> > can i escape built in lucene keywords like OR, AND aswell?
>
> as of the last time i checked: no, they're baked into the grammer.
I have not tested this, but I've read somewhere on this list that enclosing OR
and AND
: can i escape built in lucene keywords like OR, AND aswell?
as of the last time i checked: no, they're baked into the grammer.
(that may have changed when it switchedfrom a javac to a flex grammer
though, so i'm not 100% positive)
-Hoss
-
can i escape built in lucene keywords like OR, AND aswell?
Regards,
Aravind R Yarram
Chris Hostetter <[EMAIL PROTECTED]>
08/06/2008 07:05 PM
Please respond to
java-user@lucene.apache.org
To
java-user@lucene.apache.org
cc
Subject
Re: escaping special characters
:
: String escapedKeywords = QueryParser.escape(keywords);
: Query query = new QueryParser("content", new
: StandardAnalyzer()).parse(escapedKeywords);
:
: this works with most of the special characters like * and ~ except \ . I
: can't do a search for a keyword like "ho\w" and get results.
: am I
Hi,
I followed the following procedure to escape special characteres.
String escapedKeywords = QueryParser.escape(keywords);
Query query = new QueryParser("content", new
StandardAnalyzer()).parse(escapedKeywords);
this works with most of the special characters like * and ~ except \ . I
can't do
Hi,
In case this is of help to others:
Crux of problem:
I wanted numbers and characters such as # and + to be considered.
Solution:
implement a LowercaseWhitespaceAnalyzer and a
LowercaseWhitespaceTokenizer.
Tom
===
Diagnostic
ed
>
> Enter Querystring:
> (c++ and c#)
> Searching for: c c
>
> Enter Querystring:
> (c\+\+ and c\#)
> Searching for: c c
>
> -Original Message-
> From: Erick Erickson [mailto:[EMAIL PROTECTED]
> Sent: 23 September 2007 14:47
> To: java-user@lucene.a
ailto:[EMAIL PROTECTED]
Sent: 23 September 2007 14:47
To: java-user@lucene.apache.org
Subject: Re: Escaping special characters
Default as in StandardAnalyzer? "Stuff happens" with StandardAnalyzer.
I'd recommend that you use something really simple like
WhitespaceAnalyzer for something li
7;ll try.
>
> Tom
>
> -Original Message-
> From: Karl Wettin [mailto:[EMAIL PROTECTED]
> Sent: 23 September 2007 10:39
> To: java-user@lucene.apache.org
> Subject: Re: Escaping special characters
>
>
> 23 sep 2007 kl. 10.53 skrev Tom Conlon:
>
> >
---Original Message-
From: Karl Wettin [mailto:[EMAIL PROTECTED]
Sent: 23 September 2007 10:39
To: java-user@lucene.apache.org
Subject: Re: Escaping special characters
23 sep 2007 kl. 10.53 skrev Tom Conlon:
>
> Unless I'm missing something, according to:
>
> http:/
23 sep 2007 kl. 10.53 skrev Tom Conlon:
Unless I'm missing something, according to:
http://lucene.apache.org/java/docs/queryparsersyntax.html#Escaping%
20Spe
cial%20Characters
I should be able to search for C++ and C# using something like:
C\+\+ and C\#.
That is correct.
This doesn't
Hi,
Unless I'm missing something, according to:
http://lucene.apache.org/java/docs/queryparsersyntax.html#Escaping%20Spe
cial%20Characters
I should be able to search for C++ and C# using something like:
C\+\+ and C\#.
This doesn't work.
I apologise if this sort of question has been asked man
On Thursday 07 Apr 2005 06:38, Chuck Williams wrote:
> Mufaddal Khumri writes (4/6/2005 11:21 PM):
> >Hi,
> >
> >Am new to Lucene. I found the following page:
> >http://lucene.apache.org/java/docs/queryparsersyntax.html. At the bottom
> >of the page there is a section that in order to escape specia
Analyzer?
Thanks.
-Original Message-
From: Chuck Williams [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 06, 2005 11:39 PM
To: java-user@lucene.apache.org
Subject: Re: Escaping special characters
Mufaddal Khumri writes (4/6/2005 11:21 PM):
>Hi,
>
>
>
>Am new to Luce
Mufaddal Khumri writes (4/6/2005 11:21 PM):
Hi,
Am new to Lucene. I found the following page:
http://lucene.apache.org/java/docs/queryparsersyntax.html. At the bottom
of the page there is a section that in order to escape special
characters one would use "\".
I have an Indexer that indexes produc
Hi,
Am new to Lucene. I found the following page:
http://lucene.apache.org/java/docs/queryparsersyntax.html. At the bottom
of the page there is a section that in order to escape special
characters one would use "\".
I have an Indexer that indexes product names. Some product names have
"-" c
26 matches
Mail list logo