[Xapian-discuss] set_cutoff <percent_cutoff> [<weight_cutoff>]
Kevin Duraj
kevin.softdev at gmail.com
Sat May 5 03:14:39 BST 2007
Yes I reload old version xapian-core 0.9.9 but I did tried new version
xapian-core 0.9.10 and it behaves the same.
Here is part of my test Perl script ...
#----------------------------------------------------------------------------------------------#
$DATABASE_DIR = "/home/xapian/index
my $db = Search::Xapian::Database->new($DATABASE_DIR);
$qp = Search::Xapian::QueryParser->new();
$qp->set_default_op('Search::Xapian::QueryParser::OP_AND');
$enq = $db->enquire($qp->parse_query($terms,
FLAG_BOOLEAN|FLAG_LOVEHATE|FLAG_PHRASE|FLAG_BOOLEAN_ANY_CASE));
$enq->set_cutoff($cut1, $cut2);
if(param('w') eq '0') {
$enq->set_weighting_scheme(Search::Xapian::BM25Weight->new(0,0,0,0,0)); }
else {
$enq->set_weighting_scheme(Search::Xapian::BM25Weight->new(1,0,0,0,0)); }
if(param('c') eq 'sort1') {
$enq->set_sort_by_value_then_relevance($sort_key,$ascending); }
elsif(param('c') eq 'sort2') {
$enq->set_sort_by_relevance_then_value($sort_key,$ascending); }
foreach (@array)
{
$grand_total = $grand_total + $db->get_termfreq($_);
print " ". $_ . ":" . $db->get_termfreq($_) . ", ";
}
print "<BR>About <b>$grand_total</b> $type found matching current search
criteria.</font>";
$end = new Benchmark; # end timer
$diff = timediff($end, $start); # calculate difference
print "<BR><font face=Verdana size=2>Search time:", timestr($diff,
'auto'), " seconds</font>";
my @matches = $enq->matches($FIRST, $MAX);
....
#----------------------------------------------------------------------------------------------#
I will try again Monday, have nice weekend. :-)
Thanks,
Kevin Duraj
On 5/4/07, Olly Betts <olly at survex.com> wrote:
>
> On Fri, May 04, 2007 at 06:43:52PM -0700, Kevin Duraj wrote:
> > I tested xapian-core 0.9.9 and xapian-core 0.9.10 they both ignore
> > set_cutoff method for the following scenarios ...
>
> Can you try with SVN HEAD? As I said before, the relevant code there
> has changed since 0.9.10.
>
> > Scenario 1.) NOT WORKING (set_cutoff method)
> > set_cutoff(95, 0)
> > set_weighting_scheme(Search::Xapian::BM25Weight->new(0,0,0,0,0));
> > enq->set_sort_by_relevance_then_value(1,1)
>
> You didn't show your script, but I just tried adding the equivalent
> lines to examples/quest.cc and this case seems to work for me with SVN
> HEAD.
>
> Cheers,
> Olly
>
--
Kevin Duraj
http://myhealthcare.com
More information about the Xapian-discuss
mailing list