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 Chamnap Chhorn <ch...@gmail.com> on 2010/04/21 09:29:04 UTC

partial word searching

Hi everyone,


I'm quite new to solr 1.4. I have a requirement to be able to search partial
words ("sun hot" => "Sunway Hotel") and to search full word("sunway hotel"
=> "Sunway Hotel"). Currently, I could be able to search only full word.
Anyone has any suggestions?

-- 
Chhorn Chamnap
http://chamnapchhorn.blogspot.com/

Re: partial word searching

Posted by Alejandro Marqués Rodríguez <am...@paradigmatecnologico.com>.
Hi,

You can use wildcards but I suppose it would only work with one word (though
maybe if you use tokenization you could use something like "field:sun* AND
field:hot*")

You could also use N-grams to achieve partial searchs. For example, if you
use 3-grams for "hotel" you'll index "hot", "ote" and "tel", so you could
find "hotel" searching for any of those three strings.

There's a N-gram filter you could apply though I don't know how it works
when retrieving N-grams from a more than one word expression:
<filter class="solr.NGramFilterFactory" minGramSize="3" maxGramSize="15"/>

Again I suppose if you use a tokenizer first you could get the next 3-grams
"hot" "ote" "tel" "sun" unw" "nwa" "way" and therefore searching for
"field:sun AND field:hot" will retrieve the "sunway hotel" document.

Regards



2010/4/21 Chamnap Chhorn <ch...@gmail.com>

> Hi everyone,
>
>
> I'm quite new to solr 1.4. I have a requirement to be able to search
> partial
> words ("sun hot" => "Sunway Hotel") and to search full word("sunway hotel"
> => "Sunway Hotel"). Currently, I could be able to search only full word.
> Anyone has any suggestions?
>
> --
> Chhorn Chamnap
> http://chamnapchhorn.blogspot.com/
>



-- 
Alejandro Marqués Rodríguez

Paradigma Tecnológico
http://www.paradigmatecnologico.com
Avenida de Europa, 26. Ática 5. 3ª Planta
28224 Pozuelo de Alarcón
Tel.: 91 352 59 42

Re: partial word searching

Posted by Ahmet Arslan <io...@yahoo.com>.
> I'm quite new to solr 1.4. I have a requirement to be able
> to search partial
> words ("sun hot" => "Sunway Hotel") and to search full
> word("sunway hotel"
> => "Sunway Hotel"). Currently, I could be able to search
> only full word.
> Anyone has any suggestions?


Looks like a PrefixQuery. sun* hot* will retrieve documents containing Sunway Hotel. 

http://lucene.apache.org/java/2_9_1/queryparsersyntax.html#Wildcard+Searches