search for part of the word

Showing 1-2 of 2 messages
search for part of the word Vitaliy 3/5/10 7:45 AM
How can I configure whoosh so it can search for part of the word?

f.e. I have document with word "chicken" in it

And I want to be able to find it with such queries:
 - "chick"
 - "ick"
 - "cken"

Re: [Whoosh] search for part of the word Matt Chaput 3/5/10 10:35 AM

Check out the Wildcard query object.

 >>> q1 = query.Wildcard("fieldname", u"chick*")
 >>> q2 = query.Wildcard("fieldname", u"*ick*")
 >>> q3 = query.Wildcard("fieldname", u"*cken")

The default query parser (whoosh.qparser.QueryParser) will produce
Wildcard objects when the user enters words containing '*' and/or '?'.

 >>> qp = qparser.QueryParser("fieldname", schema=myschema)
 >>> q = qp.parse("*ick*")

Note that queries that match the middle or end of a word will be slower
than queries that match the start of a word.