[Xapian-discuss] searching through different
James Cauwelier
james.cauwelier at gmail.com
Thu Aug 14 14:43:21 BST 2008
<Dr.BYTE <at> web.de> writes:
>
> hey all,
>
> i want build up a user search with xapian and php5. but i don't know how
searching thru different fields.
> result should show all records got "cars or party or friends" in the field
"interessts" AND "pizza or
> spaghetti" in field "food".
>
> any suggestions?
>
> thank you,
> sven
> ____________________________________________________________________
> Ihre Messenger, Communities und E-Mails jetzt in einem Programm!
> WEB.DE MultiMessenger http://www.produkte.web.de/messenger/?did=3071
>
Hi,
I am relatively new with Xapian and also needed this functionality. Here is
what I found out.
There are two things you have to do:
- When adding a posting, choose the right prefix
- When searching, use these prefixes and maybe add the prefixes to your parser.
By default, a prefix Z is used
Other prefixes:
S for title
A for author
X for custom prefixes
if you want a category prefix, use XCATEGORY as prefix
if you want a price prefix, use XPRICE
// adding the posting on indexing
$xapian_document->add_posting (XCATEGORYbooks, $position, $weight);
// searching for it
$parser->add_prefix ('category', 'XCATEGORY');
$query = $parser->parse_query ('category:books');
More information about the Xapian-discuss
mailing list