hi all, i am looking for synonym-using in xapian. using the api-documentation i tried to add synonyms as follow: $db = new XapianWritableDatabase($db_path, Xapian::DB_CREATE_OR_OPEN); $db->add_synonym('pizza', 'fastfood'); after this, i am indexing searchable data with prefixes: $indexer->index_text('pizza', 1, 'XFOOD'); my query seems as follow: "food:(pizza)" but it doesn't map pizza to fastfood. i think it should be result in "food:(pizza OR fastfood)" any suggestions? regards, sven _____________________________________________________________________ Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! http://smartsurfer.web.de/?mc=100071&distributionid=000000000066
On Tue, Oct 21, 2008 at 02:31:32PM +0200, Dr.BYTE at web.de wrote:> but it doesn't map pizza to fastfood. i think it should be result in > "food:(pizza OR fastfood)"Have you added FLAG_AUTO_SYNOYNMS to the QueryParser? <http://xapian.org/docs/synonyms> J -- /--------------------------------------------------------------------------\ James Aylett xapian.org james at tartarus.org uncertaintydivision.org
> > but it doesn't map pizza to fastfood. i think it should be result in > > "food:(pizza OR fastfood)" > > Have you added FLAG_AUTO_SYNOYNMS to the QueryParser?sry, i forget to mention i did add it. following flags are added, maybe another flag cause problems with synonyms? XapianQueryParser::FLAG_BOOLEAN | XapianQueryParser::FLAG_PHRASE | XapianQueryParser::FLAG_LOVEHATE | XapianQueryParser::FLAG_WILDCARD | XapianQueryParser::FLAG_AUTO_SYNONYMS regards, sven ________________________________________________________________________ Schon geh?rt? Bei WEB.DE gibt' s viele kostenlose Spiele: http://games.entertainment.web.de/de/entertainment/games/free/index.html
> > And you set the database beforehand? > > Hang on, sorry, I'm being an idiot. You're trying to do this with > prefixed terms, right? Synonyms work at the term level, so I think > you're going to have to do more work here. (Someone will correct me if > I'm wrong...)yes you are right i am using prefixed terms. ahh okay this should be the problem. thanks a lot :) regards, sven _____________________________________________________________________ Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! http://smartsurfer.web.de/?mc=100071&distributionid=000000000066
On Tue, Oct 21, 2008 at 02:31:32PM +0200, Dr.BYTE at web.de wrote:> $db = new XapianWritableDatabase($db_path, Xapian::DB_CREATE_OR_OPEN); > $db->add_synonym('pizza', 'fastfood'); > > after this, i am indexing searchable data with prefixes: > > $indexer->index_text('pizza', 1, 'XFOOD');The synonyms are of terms, so you want: $db->add_synonym('XFOODpizza', 'XFOODfastfood'); Cheers, Olly