[Xapian-discuss] searching with wildcards for special fields
Websuche :: Felix Antonius Wilhelm Ostmann
ostmann at websuche.de
Tue Nov 15 15:16:54 GMT 2011
One example: We have a field recipient, this contains a simple
emailadresse, but we need a way to search for all possible wildcards in
this field.
Some possible searchcases:
olly*
*@survex.com
*olly*
*olly*.com
*olly*survex*
i implemented that, by spliting the email into every char/sign and added
this with a prefix AND position, after every email, i increment the
position by 100. I also added a special stopper with position between
every emailaddress and at start & end (recipient can be a comma seperate
list).
so for following recipient
me at domain.tld, you at domain.tld
i generate following termlist
PB=1 Pm=2 Pe=3 P@=4 Pd=5 Po=6 Pm=7 Pa=8 Pi=9 Pn=10 P.=11 Pc=12 Po=13
Pm=14 PE=15 PB=116 Py=117 ... PE=131
Now i can build searches with PHRASES and get my examples to work!
Only for wildcards in the middle i currently have the problem, that i
want to build a <part1> PHRASE/100 <part2>, but i cannot get this to
work, but i think this is possible and i am only missing a thing :)
I use "query = xapian.Query(xapian.Query.OP_PHRASE, part1, part2)", how
can i add the /100 to that?
My question: Is there a better way? I love my way, because it was easy
to implement and worked as expected (and for small amount of data all
should be fine).
More information about the Xapian-discuss
mailing list