[Xapian-discuss] searching on individual fields
james cauwelier
james.cauwelier at gmail.com
Fri Jun 20 14:22:32 BST 2008
Hi all,
I am using xapian to search a products database of a website (currently 382
000 products). I am able to build an index and query it. I was also able
to index separate fields, but I can't find how to combine different parsed
query strings in PHP:
// construct query
$fields = array ('title', 'publisher', 'category', 'subcategory',
'subsubcategory');
$query = array();
foreach ($fields as $field_name) {
$parser = new XapianQueryParser ();
$parser->set_stemmer ($stemmer);
$parser->set_database ($database);
$parser->set_stemming_strategy (XapianQueryParser::STEM_ALL, null,
'X'.strtoupper($field_name));
$query[] = '('.$parser->parse_query ($form[$field_name], null,
'X'.strtoupper($field_name)).')';
}
$query = implode (' AND ', $query);
I have different fields which have each a label, for example XTITLE for the
field 'title'. I use $parser->set_stemming_strategy() to use the correct
labels for these fields, but I seem to make a mistake with the second
argument for this function. How do I set this FLAG in PHP? Can I set
multiple? Do I have to set a flag? Can I set all flags?
I looked at the API, but I don't seem to find the answer.
Can somebody help me with this?
Thanks,
James Cauwelier
More information about the Xapian-discuss
mailing list