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/16 11:38:40 UTC

character like &,+,.. getting ignored in search

Hi all,
I am using StopAnalzer for indexing and searching. Am searching for phrases.


q1 -> "a b"
this query gives me all documents conatining a b , but also gives
documents conatining a & b

again q2 -> "a & b"
this query q2 gives documents conatining a & b, but also gives
documents conatining a b

How can i resolve this. I only want a b for query q1
and i only want a & b for query q2

If any ideas, please help.

Regards,
Ruchi

Re: character like &,+,.. getting ignored in search

Posted by ruchi thakur <ru...@gmail.com>.
Thanks Eric. I will try out the suggestions. I am using StopAnalyzer.
Regards,
Ruchi


On 3/16/07, Erick Erickson <er...@gmail.com> wrote:
>
> What analyzers are you using at index and search time? I suspect
> that the '&' is being removed both at index and search. So, you've
> only indexed the tokens 'a' and 'b' and by the time you get out
> of the query parser, you're only searching for terms 'a' 'b'.
>
> Did you bother using query.toString() to examine the parsed results?
> Did you try using Luke to see what was in your index?
> Did you try using Luke to see how the queries parsed under
> various analyzers? I suspect you'd get your answers much
> faster if you tried this first.
>
> Erick
>
> On 3/16/07, ruchi thakur <ru...@gmail.com> wrote:
> >
> > Hi all,
> > I am using StopAnalzer for indexing and searching. Am searching for
> > phrases.
> >
> >
> > q1 -> "a b"
> > this query gives me all documents conatining a b , but also gives
> > documents conatining a & b
> >
> > again q2 -> "a & b"
> > this query q2 gives documents conatining a & b, but also gives
> > documents conatining a b
> >
> > How can i resolve this. I only want a b for query q1
> > and i only want a & b for query q2
> >
> > If any ideas, please help.
> >
> > Regards,
> > Ruchi
> >
>

Re: character like &,+,.. getting ignored in search

Posted by Erick Erickson <er...@gmail.com>.
What analyzers are you using at index and search time? I suspect
that the '&' is being removed both at index and search. So, you've
only indexed the tokens 'a' and 'b' and by the time you get out
of the query parser, you're only searching for terms 'a' 'b'.

Did you bother using query.toString() to examine the parsed results?
Did you try using Luke to see what was in your index?
Did you try using Luke to see how the queries parsed under
various analyzers? I suspect you'd get your answers much
faster if you tried this first.

Erick

On 3/16/07, ruchi thakur <ru...@gmail.com> wrote:
>
> Hi all,
> I am using StopAnalzer for indexing and searching. Am searching for
> phrases.
>
>
> q1 -> "a b"
> this query gives me all documents conatining a b , but also gives
> documents conatining a & b
>
> again q2 -> "a & b"
> this query q2 gives documents conatining a & b, but also gives
> documents conatining a b
>
> How can i resolve this. I only want a b for query q1
> and i only want a & b for query q2
>
> If any ideas, please help.
>
> Regards,
> Ruchi
>