Escaping special characters

2005-04-06 Thread Mufaddal Khumri
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

Escaping special characters

2007-09-23 Thread Tom Conlon
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

escaping special characters

2008-08-04 Thread Kalani Ruwanpathirana
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

Escaping Special Characters

2011-07-04 Thread govind bhardwaj
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: "(" ... "*

Re: Escaping special characters

2005-04-06 Thread Chuck Williams
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

RE: Escaping special characters

2005-04-06 Thread Mufaddal Khumri
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

Re: Escaping special characters

2005-04-07 Thread Andy Roberts
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

Re: Escaping special characters

2007-09-23 Thread Karl Wettin
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

RE: Escaping special characters

2007-09-23 Thread 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:/

Re: Escaping special characters

2007-09-23 Thread Erick Erickson
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: > > >

RE: Escaping special characters

2007-09-23 Thread Tom Conlon
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

Re: Escaping special characters

2007-09-23 Thread Erick Erickson
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

RE: Escaping special characters

2007-09-30 Thread Tom Conlon
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

Re: escaping special characters

2008-08-06 Thread Chris Hostetter
: 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

Re: escaping special characters

2008-08-06 Thread Aravind . Yarram
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 :

Re: escaping special characters

2008-08-11 Thread Chris Hostetter
: 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 -

RE: escaping special characters

2008-08-11 Thread Steven A Rowe
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

Re: escaping special characters

2008-08-11 Thread Matthew Hall
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

Re: escaping special characters

2008-08-11 Thread Mark Miller
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

Re: Escaping Special Characters

2011-07-04 Thread Adriano Crestani
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

Re: Escaping Special Characters

2011-07-05 Thread govind bhardwaj
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

Re: Escaping Special Characters

2011-07-05 Thread Adriano Crestani
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 -

Issues with escaping special characters

2009-05-14 Thread Ari Miller
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

Re: Issues with escaping special characters

2009-05-14 Thread Erick Erickson
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

Re: Issues with escaping special characters

2009-05-14 Thread Ari Miller
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

Re: Issues with escaping special characters

2009-05-15 Thread Erick Erickson
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