You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "Rode González (libnova)" <ro...@libnova.es> on 2011/09/26 19:17:32 UTC

how to implemente a query like " like '%pattern%' "

Hi all.

how can we do a query similar to 'like' ?


if I have this phrase like a single token in the index: "This phrase has various words" (using KeywordTokenizerFactory)
and i like a exact match of:  "phrase has various" or "various words" form instance... 
 
How can i do this??

Thanks a lot.

Rode.


-----
No se encontraron virus en este mensaje.
Comprobado por AVG - www.avg.com
Versión: 10.0.1410 / Base de datos de virus: 1520/3920 - Fecha de publicación: 09/26/11



RE: how to implemente a query like " like '%pattern%' "

Posted by "Rode González (libnova)" <ro...@libnova.es>.
Hola Tomás.

it seems that yes, using q = "word1 word2" over a tokenized field, it seems to
work. I will do some additional testing.

thanks a lot,

rode.


> -----Mensaje original-----
> De: Tomás Fernández Löbbe [mailto:tomasflobbe@gmail.com]
> Enviado el: lunes, 26 de septiembre de 2011 22:12
> Para: solr-user@lucene.apache.org
> Asunto: Re: how to implemente a query like " like '%pattern%' "
> 
> If you need those kinds of searches then you should probably not be using
> the KeywordTokenizerFactory, is there any reason why you can't switch to a
> WhitespaceTokenizer for example? then you could use a simple phrase query
> for your search case. if you need everything as a Token, you could use a
> copyfield and duplicate the field and have them both.
> 
> Are those acceptable options for you?
> 
> Tomás
> 
> 2011/9/26 Rode González (libnova) <ro...@libnova.es>
> 
> > Hi all.
> >
> > how can we do a query similar to 'like' ?
> >
> >
> > if I have this phrase like a single token in the index: "This phrase has
> > various words" (using KeywordTokenizerFactory)
> > and i like a exact match of:  "phrase has various" or "various words"
> form
> > instance...
> >
> > How can i do this??
> >
> > Thanks a lot.
> >
> > Rode.
> >
> >
> > -----
> > No se encontraron virus en este mensaje.
> > Comprobado por AVG - www.avg.com
> > Versión: 10.0.1410 / Base de datos de virus: 1520/3920 - Fecha de
> > publicación: 09/26/11
> >
> >
> >
> 
> -----
> No se encontraron virus en este mensaje.
> Comprobado por AVG - www.avg.com
> Versión: 10.0.1410 / Base de datos de virus: 1520/3920 - Fecha de
> publicación: 09/26/11

-----
No se encontraron virus en este mensaje.
Comprobado por AVG - www.avg.com
Versión: 10.0.1410 / Base de datos de virus: 1520/3921 - Fecha de publicación:
09/26/11



Re: how to implemente a query like " like '%pattern%' "

Posted by Tomás Fernández Löbbe <to...@gmail.com>.
If you need those kinds of searches then you should probably not be using
the KeywordTokenizerFactory, is there any reason why you can't switch to a
WhitespaceTokenizer for example? then you could use a simple phrase query
for your search case. if you need everything as a Token, you could use a
copyfield and duplicate the field and have them both.

Are those acceptable options for you?

Tomás

2011/9/26 Rode González (libnova) <ro...@libnova.es>

> Hi all.
>
> how can we do a query similar to 'like' ?
>
>
> if I have this phrase like a single token in the index: "This phrase has
> various words" (using KeywordTokenizerFactory)
> and i like a exact match of:  "phrase has various" or "various words" form
> instance...
>
> How can i do this??
>
> Thanks a lot.
>
> Rode.
>
>
> -----
> No se encontraron virus en este mensaje.
> Comprobado por AVG - www.avg.com
> Versión: 10.0.1410 / Base de datos de virus: 1520/3920 - Fecha de
> publicación: 09/26/11
>
>
>

Re: how to implemente a query like " like '%pattern%' "

Posted by Chris Hostetter <ho...@fucit.org>.
: References:
:     <CA...@mail.gmail.com>
: In-Reply-To:
:     <CA...@mail.gmail.com>
: Subject: how to implemente a query like " like '%pattern%' "

https://people.apache.org/~hossman/#threadhijack
Thread Hijacking on Mailing Lists

When starting a new discussion on a mailing list, please do not reply to 
an existing message, instead start a fresh email.  Even if you change the 
subject line of your email, other mail headers still track which thread 
you replied to and your question is "hidden" in that thread and gets less 
attention.   It makes following discussions in the mailing list archives 
particularly difficult.



-Hoss