[Xapian-discuss] searching through different "fields"?
Dr.BYTE at web.de
Dr.BYTE at web.de
Thu Aug 14 16:59:17 BST 2008
Sorry for reply out of the list.
I believe to know what you mean. I tried to index content prefixed using the Termgenerator
$gen = new XapianTermGenerator();
//...other options
$gen->index_text('pizza spaghetti', 1, 'X1');
After this, it should be indexed as you suggest:
X1pizza
X1spaghetti
Searching related users by query:
$query_parser->add_prefix('user_food', 'X1');
$query = new XapianQuery($query_parser->parse_query('user_food:(spaghetti OR pizza)'));
results in:
Parsed query is: Xapian::Query((X1spaghetti:(pos=1) OR X1pizza:(pos=2)))
This seems nice for me, but displays no results :(
> Please keep replies on-list so that others can help you, and benefit
> from the replies.
>
> On Thu, Aug 14, 2008 at 03:42:38PM +0200, Sven Kummer wrote:
>
> > i tried out to add terms:
> > $doc->add_term('X1spaghetti pizza');
> > $doc->add_term('X2cars party friends');
>
> You're adding two terms there where you actually want to add
> five. Ignoring stemming, you want:
>
> X1spaghetti
> X1pizza
> X2cars
> X2party
> X2friends
>
> Possibly the easiest way of generating terms is to use the
> TermGenerator. The introductory docs are a little difficult to read as
> they are mostly documenting the changes from previous versions, but
> the API docs should help.
>
> > $query_parser->add_prefix('user_food', 'X1');
> > $query_parser->add_prefix('user_interessts', 'X2');
> >
> > $query_parser->parse_query('user_interessts:(party OR friends)');
> >
> > but i get no results. query description writes:
> >
> > Parsed query is: Xapian::Query((ZX1spaghetti:(pos=1) OR
> ZX1pizza:(pos=2)))
>
> Well, it won't be that, it'll be (ZX2party:(pos=1) OR
> ZX2friends:(pos=2)) or something very similar. If you construct terms
> as above, you'll be fine.
>
> J
>
> --
> /-------------------------------------------------------------------------
> -\
> James Aylett xapian.org
> james at tartarus.org uncertaintydivision.org
>
> _______________________________________________
> Xapian-discuss mailing list
> Xapian-discuss at lists.xapian.org
> http://lists.xapian.org/mailman/listinfo/xapian-discuss
_______________________________________________________________________
EINE FÜR ALLE: die kostenlose WEB.DE-Plattform für Freunde und Deine
Homepage mit eigenem Namen. Jetzt starten! http://unddu.de/?kid=kid@mf2
More information about the Xapian-discuss
mailing list