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 ruchi thakur <ru...@gmail.com> on 2007/03/12 07:44:21 UTC

search for phrase with specail chars?

I want to search for phrase     „innere Organe" bezeichnet
am using query q1  =     "„innere Organe\" bezeichnet"

is there any issue with q1
am getting Exception in retrieveQuery().IndexDirec:Lexical error at line 1,
column 30. Encountered: <EOF> after : ""

Regards,
Ruchika

Re: search for phrase with specail chars?

Posted by Steven Rowe <sa...@syr.edu>.
Hi Ruchika,

Are there are any quote characters in your index (may the Luke be with
you[1])?  If not, you could just remove all quotes from your query
(except the surrounding ones indicating phrase matching, of course), and
things will work, as you have indicated.

Which version of Lucene are you using?  The bug below, a fix for which
was included in the 2.1.0 release, may address your issue:

   http://issues.apache.org/jira/browse/LUCENE-573

>From the release notes for 2.1.0[2]:

   7. LUCENE-573: QueryParser now allows backslash escaping in
      quoted terms and phrases. (Michael Busch via Yonik Seeley)

Steve

[1] http://www.getopt.org/luke/
[2]
http://svn.apache.org/repos/asf/lucene/java/tags/lucene_2_1_0/CHANGES.txt

ruchi thakur wrote:
> yes that is exactly what i am doing
> in java String i have something like
> String aSearchStr = "\"„innere Organe\\\" bezeichnet\"";
> Query query = parser.parse(aSearchStr);
> 
> 2nd line to parse gives me the Exception. In this case as i understand the
> search String input that goes to lucene is actually  "„innere Organe\"
> bezeichnet"
> Should i send something else..
> Regards,
> Ruchika
> On 3/12/07, karl wettin <ka...@gmail.com> wrote:
>>
>>
>> 12 mar 2007 kl. 07.53 skrev ruchi thakur:
>>
>> > no, i just get the folowing
>> > org.apache.lucene.queryParser.ParseException: Lexical error at line 1,
>> > column 30. Encountered: <EOF> after : ""
>>
>> The problem is probably that you have a " in your query, and it
>> expects an end "-token. So it needs to be escaped. Programatically:
>>
>> String q = "\"„innere Organe\\\" bezeichnet\"";
>>
>> -- 
>> karl
>>
>> >
>> > On 3/12/07, karl wettin <ka...@gmail.com> wrote:
>> >>
>> >>
>> >> 12 mar 2007 kl. 07.44 skrev ruchi thakur:
>> >>
>> >> > I want to search for phrase     „innere Organe" bezeichnet
>> >> > am using query q1  =     "„innere Organe\" bezeichnet"
>> >> >
>> >> > is there any issue with q1
>> >> > am getting Exception in retrieveQuery().IndexDirec:Lexical error at
>> >> > line 1,
>> >> > column 30. Encountered: <EOF> after : ""
>> >>
>> >> Is there something more to this exception? Something like what it
>> >> expected?
>> >>
>> >> --
>> >> karl
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> >> For additional commands, e-mail: java-user-help@lucene.apache.org
>> >>
>> >>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>
> 


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


Re: search for phrase with specail chars?

Posted by ruchi thakur <ru...@gmail.com>.
i am using StopAnalyszer.
Yes something like "innere Organe bezeichnet" works exactly fine

„ character should not be a probelm, as if i remove this character, i still
get the error

I get this error tiil the point i have Organe\" in my query. Guess it is the
double quote inside a phrase, which is causing the issue. But i dont
understand why because i am escaping it, before i send it to lucene
Regards,

On 3/12/07, karl wettin <ka...@gmail.com> wrote:
>
>
> 12 mar 2007 kl. 08.24 skrev ruchi thakur:
>
> > yes that is exactly what i am doing
> > in java String i have something like
> > String aSearchStr = "\"„innere Organe\\\" bezeichnet\"";
> > Query query = parser.parse(aSearchStr);
>
> I'm not sure why you get this exception. Perhaps it has something to
> do with the „ character.
>
> What analyzer do you use? Does it really store „ and "? What if you
> just query for "innere Organe bezeichnet"?
>
> --
> karl
>
> >
> > 2nd line to parse gives me the Exception. In this case as i
> > understand the
> > search String input that goes to lucene is actually  "„innere Organe\"
> > bezeichnet"
> > Should i send something else..
> > Regards,
> > Ruchika
> > On 3/12/07, karl wettin <ka...@gmail.com> wrote:
> >>
> >>
> >> 12 mar 2007 kl. 07.53 skrev ruchi thakur:
> >>
> >> > no, i just get the folowing
> >> > org.apache.lucene.queryParser.ParseException: Lexical error at
> >> line 1,
> >> > column 30. Encountered: <EOF> after : ""
> >>
> >> The problem is probably that you have a " in your query, and it
> >> expects an end "-token. So it needs to be escaped. Programatically:
> >>
> >> String q = "\"„innere Organe\\\" bezeichnet\"";
> >>
> >> --
> >> karl
> >>
> >> >
> >> > On 3/12/07, karl wettin <ka...@gmail.com> wrote:
> >> >>
> >> >>
> >> >> 12 mar 2007 kl. 07.44 skrev ruchi thakur:
> >> >>
> >> >> > I want to search for phrase     „innere Organe" bezeichnet
> >> >> > am using query q1  =     "„innere Organe\" bezeichnet"
> >> >> >
> >> >> > is there any issue with q1
> >> >> > am getting Exception in retrieveQuery().IndexDirec:Lexical
> >> error at
> >> >> > line 1,
> >> >> > column 30. Encountered: <EOF> after : ""
> >> >>
> >> >> Is there something more to this exception? Something like what it
> >> >> expected?
> >> >>
> >> >> --
> >> >> karl
> >> >>
> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> >> >> For additional commands, e-mail: java-user-help@lucene.apache.org
> >> >>
> >> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> >> For additional commands, e-mail: java-user-help@lucene.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Re: search for phrase with specail chars?

Posted by karl wettin <ka...@gmail.com>.
12 mar 2007 kl. 08.24 skrev ruchi thakur:

> yes that is exactly what i am doing
> in java String i have something like
> String aSearchStr = "\"„innere Organe\\\" bezeichnet\"";
> Query query = parser.parse(aSearchStr);

I'm not sure why you get this exception. Perhaps it has something to  
do with the „ character.

What analyzer do you use? Does it really store „ and "? What if you  
just query for "innere Organe bezeichnet"?

-- 
karl

>
> 2nd line to parse gives me the Exception. In this case as i  
> understand the
> search String input that goes to lucene is actually  "„innere Organe\"
> bezeichnet"
> Should i send something else..
> Regards,
> Ruchika
> On 3/12/07, karl wettin <ka...@gmail.com> wrote:
>>
>>
>> 12 mar 2007 kl. 07.53 skrev ruchi thakur:
>>
>> > no, i just get the folowing
>> > org.apache.lucene.queryParser.ParseException: Lexical error at  
>> line 1,
>> > column 30. Encountered: <EOF> after : ""
>>
>> The problem is probably that you have a " in your query, and it
>> expects an end "-token. So it needs to be escaped. Programatically:
>>
>> String q = "\"„innere Organe\\\" bezeichnet\"";
>>
>> --
>> karl
>>
>> >
>> > On 3/12/07, karl wettin <ka...@gmail.com> wrote:
>> >>
>> >>
>> >> 12 mar 2007 kl. 07.44 skrev ruchi thakur:
>> >>
>> >> > I want to search for phrase     „innere Organe" bezeichnet
>> >> > am using query q1  =     "„innere Organe\" bezeichnet"
>> >> >
>> >> > is there any issue with q1
>> >> > am getting Exception in retrieveQuery().IndexDirec:Lexical  
>> error at
>> >> > line 1,
>> >> > column 30. Encountered: <EOF> after : ""
>> >>
>> >> Is there something more to this exception? Something like what it
>> >> expected?
>> >>
>> >> --
>> >> karl
>> >>  
>> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> >> For additional commands, e-mail: java-user-help@lucene.apache.org
>> >>
>> >>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>


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


Re: search for phrase with specail chars?

Posted by ruchi thakur <ru...@gmail.com>.
yes that is exactly what i am doing
in java String i have something like
String aSearchStr = "\"„innere Organe\\\" bezeichnet\"";
Query query = parser.parse(aSearchStr);

2nd line to parse gives me the Exception. In this case as i understand the
search String input that goes to lucene is actually  "„innere Organe\"
bezeichnet"
Should i send something else..
Regards,
Ruchika
On 3/12/07, karl wettin <ka...@gmail.com> wrote:
>
>
> 12 mar 2007 kl. 07.53 skrev ruchi thakur:
>
> > no, i just get the folowing
> > org.apache.lucene.queryParser.ParseException: Lexical error at line 1,
> > column 30. Encountered: <EOF> after : ""
>
> The problem is probably that you have a " in your query, and it
> expects an end "-token. So it needs to be escaped. Programatically:
>
> String q = "\"„innere Organe\\\" bezeichnet\"";
>
> --
> karl
>
> >
> > On 3/12/07, karl wettin <ka...@gmail.com> wrote:
> >>
> >>
> >> 12 mar 2007 kl. 07.44 skrev ruchi thakur:
> >>
> >> > I want to search for phrase     „innere Organe" bezeichnet
> >> > am using query q1  =     "„innere Organe\" bezeichnet"
> >> >
> >> > is there any issue with q1
> >> > am getting Exception in retrieveQuery().IndexDirec:Lexical error at
> >> > line 1,
> >> > column 30. Encountered: <EOF> after : ""
> >>
> >> Is there something more to this exception? Something like what it
> >> expected?
> >>
> >> --
> >> karl
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> >> For additional commands, e-mail: java-user-help@lucene.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Re: search for phrase with specail chars?

Posted by karl wettin <ka...@gmail.com>.
12 mar 2007 kl. 07.53 skrev ruchi thakur:

> no, i just get the folowing
> org.apache.lucene.queryParser.ParseException: Lexical error at line 1,
> column 30. Encountered: <EOF> after : ""

The problem is probably that you have a " in your query, and it  
expects an end "-token. So it needs to be escaped. Programatically:

String q = "\"„innere Organe\\\" bezeichnet\"";

-- 
karl

>
> On 3/12/07, karl wettin <ka...@gmail.com> wrote:
>>
>>
>> 12 mar 2007 kl. 07.44 skrev ruchi thakur:
>>
>> > I want to search for phrase     „innere Organe" bezeichnet
>> > am using query q1  =     "„innere Organe\" bezeichnet"
>> >
>> > is there any issue with q1
>> > am getting Exception in retrieveQuery().IndexDirec:Lexical error at
>> > line 1,
>> > column 30. Encountered: <EOF> after : ""
>>
>> Is there something more to this exception? Something like what it
>> expected?
>>
>> --
>> karl
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>


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


Re: search for phrase with specail chars?

Posted by ruchi thakur <ru...@gmail.com>.
 no, i just get the folowing
org.apache.lucene.queryParser.ParseException: Lexical error at line 1,
column 30. Encountered: <EOF> after : ""

On 3/12/07, karl wettin <ka...@gmail.com> wrote:
>
>
> 12 mar 2007 kl. 07.44 skrev ruchi thakur:
>
> > I want to search for phrase     „innere Organe" bezeichnet
> > am using query q1  =     "„innere Organe\" bezeichnet"
> >
> > is there any issue with q1
> > am getting Exception in retrieveQuery().IndexDirec:Lexical error at
> > line 1,
> > column 30. Encountered: <EOF> after : ""
>
> Is there something more to this exception? Something like what it
> expected?
>
> --
> karl
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Re: search for phrase with specail chars?

Posted by karl wettin <ka...@gmail.com>.
12 mar 2007 kl. 07.44 skrev ruchi thakur:

> I want to search for phrase     „innere Organe" bezeichnet
> am using query q1  =     "„innere Organe\" bezeichnet"
>
> is there any issue with q1
> am getting Exception in retrieveQuery().IndexDirec:Lexical error at  
> line 1,
> column 30. Encountered: <EOF> after : ""

Is there something more to this exception? Something like what it  
expected?

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


Re: search for phrase with specail chars?

Posted by ruchi thakur <ru...@gmail.com>.
org.apache.lucene.queryParser.ParseException: Lexical error at line 1,
column 30. Encountered: <EOF> after : ""
On 3/12/07, ruchi thakur <ru...@gmail.com> wrote:
>
>
> I want to search for phrase     „innere Organe" bezeichnet
> am using query q1  =     "„innere Organe\" bezeichnet"
>
> is there any issue with q1
> am getting Exception in retrieveQuery().IndexDirec:Lexical error at line
> 1, column 30. Encountered: <EOF> after : ""
>
> Regards,
> Ruchika
>