problem with Whitespace analyzer

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

problem with Whitespace analyzer

saikrishna venkata pendyala
Hi,

I am facing a small problem, some one please help me,

I am using Whitespace analyzer, while both indexing and searching the files.

While indexing the analyzer is recognizing <token>Ajit_(Agarkar)</token>(I
found it using LUKE) as a single token.
But while searching{QueryParser parser = new QueryParser(field, analyzer);},
it is divided into two tokens <token>Ajit_</token>,<token>Agarkar</token>.

"""
Enter query:
Ajit_(Agarkar)
Searching for: Ajit_ Agarkar
0 total matching documents

"""


--Saikrishna.
Reply | Threaded
Open this post in threaded view
|

Re: problem with Whitespace analyzer

Doron Cohen-2
Should be the parenthesis which are part of the query syntax
Try escaping - \(   \)
Also see
http://lucene.apache.org/java/2_3_0/queryparsersyntax.html#Escaping%20Special%20Characters

Doron

On Sun, Feb 10, 2008 at 9:03 AM, saikrishna venkata pendyala <
[hidden email]> wrote:

> Hi,
>
> I am facing a small problem, some one please help me,
>
> I am using Whitespace analyzer, while both indexing and searching the
> files.
>
> While indexing the analyzer is recognizing <token>Ajit_(Agarkar)</token>(I
> found it using LUKE) as a single token.
> But while searching{QueryParser parser = new QueryParser(field,
> analyzer);},
> it is divided into two tokens <token>Ajit_</token>,<token>Agarkar</token>.
>
> """
> Enter query:
> Ajit_(Agarkar)
> Searching for: Ajit_ Agarkar
> 0 total matching documents
>
> """
>
>
> --Saikrishna.
>
Reply | Threaded
Open this post in threaded view
|

Re: problem with Whitespace analyzer

Erik Hatcher
In reply to this post by saikrishna venkata pendyala
QueryParser uses special syntax, which can get in the way, for  
operators and grouping, etc.  Parenthesis are part of that special  
syntax, and need to be backslash escaped for QueryParser to skip  
treating them as grouping operators, for example: Ajit_\(Agarkar\)

        Erik



On Feb 10, 2008, at 2:03 AM, saikrishna venkata pendyala wrote:

> Hi,
>
> I am facing a small problem, some one please help me,
>
> I am using Whitespace analyzer, while both indexing and searching  
> the files.
>
> While indexing the analyzer is recognizing <token>Ajit_(Agarkar)</
> token>(I
> found it using LUKE) as a single token.
> But while searching{QueryParser parser = new QueryParser(field,  
> analyzer);},
> it is divided into two tokens <token>Ajit_</token>,<token>Agarkar</
> token>.
>
> """
> Enter query:
> Ajit_(Agarkar)
> Searching for: Ajit_ Agarkar
> 0 total matching documents
>
> """
>
>
> --Saikrishna.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: problem with Whitespace analyzer

saikrishna venkata pendyala
Hi,
Thanks a lot  Cohen and  Erik. Yes "\)" works, I tried it even before. But I
was wondering why the Whitespace analyzer is breaking the string at "(".
Now it's clear, thnks once again.

--Saikrishna.

On Feb 10, 2008 9:17 PM, Erik Hatcher <[hidden email]> wrote:

> QueryParser uses special syntax, which can get in the way, for
> operators and grouping, etc.  Parenthesis are part of that special
> syntax, and need to be backslash escaped for QueryParser to skip
> treating them as grouping operators, for example: Ajit_\(Agarkar\)
>
>        Erik
>
>
>
> On Feb 10, 2008, at 2:03 AM, saikrishna venkata pendyala wrote:
>
> > Hi,
> >
> > I am facing a small problem, some one please help me,
> >
> > I am using Whitespace analyzer, while both indexing and searching
> > the files.
> >
> > While indexing the analyzer is recognizing <token>Ajit_(Agarkar)</
> > token>(I
> > found it using LUKE) as a single token.
> > But while searching{QueryParser parser = new QueryParser(field,
> > analyzer);},
> > it is divided into two tokens <token>Ajit_</token>,<token>Agarkar</
> > token>.
> >
> > """
> > Enter query:
> > Ajit_(Agarkar)
> > Searching for: Ajit_ Agarkar
> > 0 total matching documents
> >
> > """
> >
> >
> > --Saikrishna.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>