Paul Dixon
2006-Mar-29 23:13 UTC
[Xapian-discuss] Giving titles extra weights and searching with titles
What's the best technique for giving the terms in, say, a document title more weight than the terms? Do I simply use the third "wdfinc "parameter to Xapian::Document::add_posting to give it more weight? Secondly, if I wanted to make it possible to search just within a title, would I also need to store the same of terms prefixed with, say TITLE: to do that? Paul
James Aylett
2006-Mar-30 11:49 UTC
[Xapian-discuss] Giving titles extra weights and searching with titles
On Wed, Mar 29, 2006 at 11:12:57PM +0100, Paul Dixon wrote:> What's the best technique for giving the terms in, say, a document > title more weight than the terms? Do I simply use the third "wdfinc > "parameter to Xapian::Document::add_posting to give it more weight?That will do it, yes.> Secondly, if I wanted to make it possible to search just within a > title, would I also need to store the same of terms prefixed with, say > TITLE: to do that?I'd be inclined to generate terms prefixed with "S", and then use a prefix map to the QueryParser to map "title:" in a query to "S". qp.add_prefix("title", "S") if you're using it directly, or something like: $setmap{prefix,title,S} in an omegascript template. J -- /--------------------------------------------------------------------------\ James Aylett xapian.org james@tartarus.org uncertaintydivision.org
Olly Betts
2006-Mar-30 14:43 UTC
[Xapian-discuss] Giving titles extra weights and searching with titles
On Wed, Mar 29, 2006 at 11:12:57PM +0100, Paul Dixon wrote:> What's the best technique for giving the terms in, say, a document > title more weight than the terms? Do I simply use the third "wdfinc > "parameter to Xapian::Document::add_posting to give it more weight?Yes.> Secondly, if I wanted to make it possible to search just within a > title, would I also need to store the same of terms prefixed with, say > TITLE: to do that?Yes. The conventional prefix for subject or title is "S" - the advantage of using this is compatibility with other Xapian databases built by other applications. For more information, see termprefixes.txt in the omega documentation: http://svn.xapian.org/*checkout*/trunk/xapian-applications/omega/docs/termprefixes.txt Cheers, Olly