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 Jochen Hebbrecht <jo...@gmail.com> on 2012/07/03 17:59:12 UTC

QueryParser, double quotes and wilcard inside the double quotes

Hi all,

Imagine you have the following books which are indexed using Lucene

book1 -> title: "foo bar test"
book2 -> title: "foo barrr test"
book3 -> title: "foo bar bar"

I want to find book1 and book2 using the following query "foo * test". But
if I pass this string to the QueryParser, the QueryParser seems to be
searching for a literal '*' character.
Any idea's how to fix this?

Thanks!
Jochen

Re: QueryParser, double quotes and wilcard inside the double quotes

Posted by Israel Tsadok <it...@gmail.com>.
s/weird/word/
Sorry, autocorrect.
On Jul 5, 2012 4:01 PM, "Israel Tsadok" <it...@gmail.com> wrote:

> A hacky trick I used was put a stop weird instead of the asterisk. If you
> search for "foo a test" and use an analyzer that includes a stop filter
> (like StandardAnalyzer does), it will match docs 1 and 2.
>
> On Jul 4, 2012 10:13 AM, "Jochen Hebbrecht" <jo...@gmail.com>
> wrote:
> >
> > Thanks Ian, I'll give it a try!
> >
> > 2012/7/3 Ian Lea <ia...@gmail.com>
> >
> > > You can use the QueryParser proximity feature e.g. "foo test"~n where
> > > n is the max distance you want them to be apart.  Or look at the
> > > SpanQuery stuff e.g. SpanNearQuery.
> > >
> > >
> > > --
> > > Ian.
> > >
> > >
> > > On Tue, Jul 3, 2012 at 4:59 PM, Jochen Hebbrecht
> > > <jo...@gmail.com> wrote:
> > > > Hi all,
> > > >
> > > > Imagine you have the following books which are indexed using Lucene
> > > >
> > > > book1 -> title: "foo bar test"
> > > > book2 -> title: "foo barrr test"
> > > > book3 -> title: "foo bar bar"
> > > >
> > > > I want to find book1 and book2 using the following query "foo *
> test".
> > > But
> > > > if I pass this string to the QueryParser, the QueryParser seems to be
> > > > searching for a literal '*' character.
> > > > Any idea's how to fix this?
> > > >
> > > > Thanks!
> > > > Jochen
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > > For additional commands, e-mail: java-user-help@lucene.apache.org
> > >
> > >
>

Re: QueryParser, double quotes and wilcard inside the double quotes

Posted by Israel Tsadok <it...@gmail.com>.
A hacky trick I used was put a stop weird instead of the asterisk. If you
search for "foo a test" and use an analyzer that includes a stop filter
(like StandardAnalyzer does), it will match docs 1 and 2.

On Jul 4, 2012 10:13 AM, "Jochen Hebbrecht" <jo...@gmail.com>
wrote:
>
> Thanks Ian, I'll give it a try!
>
> 2012/7/3 Ian Lea <ia...@gmail.com>
>
> > You can use the QueryParser proximity feature e.g. "foo test"~n where
> > n is the max distance you want them to be apart.  Or look at the
> > SpanQuery stuff e.g. SpanNearQuery.
> >
> >
> > --
> > Ian.
> >
> >
> > On Tue, Jul 3, 2012 at 4:59 PM, Jochen Hebbrecht
> > <jo...@gmail.com> wrote:
> > > Hi all,
> > >
> > > Imagine you have the following books which are indexed using Lucene
> > >
> > > book1 -> title: "foo bar test"
> > > book2 -> title: "foo barrr test"
> > > book3 -> title: "foo bar bar"
> > >
> > > I want to find book1 and book2 using the following query "foo * test".
> > But
> > > if I pass this string to the QueryParser, the QueryParser seems to be
> > > searching for a literal '*' character.
> > > Any idea's how to fix this?
> > >
> > > Thanks!
> > > Jochen
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> >

Re: QueryParser, double quotes and wilcard inside the double quotes

Posted by Jochen Hebbrecht <jo...@gmail.com>.
Thanks Ian, I'll give it a try!

2012/7/3 Ian Lea <ia...@gmail.com>

> You can use the QueryParser proximity feature e.g. "foo test"~n where
> n is the max distance you want them to be apart.  Or look at the
> SpanQuery stuff e.g. SpanNearQuery.
>
>
> --
> Ian.
>
>
> On Tue, Jul 3, 2012 at 4:59 PM, Jochen Hebbrecht
> <jo...@gmail.com> wrote:
> > Hi all,
> >
> > Imagine you have the following books which are indexed using Lucene
> >
> > book1 -> title: "foo bar test"
> > book2 -> title: "foo barrr test"
> > book3 -> title: "foo bar bar"
> >
> > I want to find book1 and book2 using the following query "foo * test".
> But
> > if I pass this string to the QueryParser, the QueryParser seems to be
> > searching for a literal '*' character.
> > Any idea's how to fix this?
> >
> > Thanks!
> > Jochen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Re: QueryParser, double quotes and wilcard inside the double quotes

Posted by Ian Lea <ia...@gmail.com>.
You can use the QueryParser proximity feature e.g. "foo test"~n where
n is the max distance you want them to be apart.  Or look at the
SpanQuery stuff e.g. SpanNearQuery.


--
Ian.


On Tue, Jul 3, 2012 at 4:59 PM, Jochen Hebbrecht
<jo...@gmail.com> wrote:
> Hi all,
>
> Imagine you have the following books which are indexed using Lucene
>
> book1 -> title: "foo bar test"
> book2 -> title: "foo barrr test"
> book3 -> title: "foo bar bar"
>
> I want to find book1 and book2 using the following query "foo * test". But
> if I pass this string to the QueryParser, the QueryParser seems to be
> searching for a literal '*' character.
> Any idea's how to fix this?
>
> Thanks!
> Jochen

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