Ticket #203: multweight.patch

File multweight.patch, 22.9 KB (added by Richard Boulton, 17 years ago)

Patch implementing new OP_MULT_WEIGHT query operator

  • xapian-core/matcher/multweightpostlist.cc

     
     1/** @file multweightpostlist.cc
     2 * @brief Return documents from a subquery with weights multiplied by a double.
     3 */
     4/* Copyright 2007 Lemur Consulting Ltd
     5 *
     6 * This program is free software; you can redistribute it and/or modify
     7 * it under the terms of the GNU General Public License as published by
     8 * the Free Software Foundation; either version 2 of the License, or
     9 * (at your option) any later version.
     10 *
     11 * This program is distributed in the hope that it will be useful,
     12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14 * GNU General Public License for more details.
     15 *
     16 * You should have received a copy of the GNU General Public License
     17 * along with this program; if not, write to the Free Software
     18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
     19 */
     20
     21#include <config.h>
     22
     23#include "omassert.h"
     24#include "multweightpostlist.h"
     25
     26// Include branchpostlist for utility functions "next_handling_prune" and
     27// "skip_to_handling_prune"
     28#include "branchpostlist.h"
     29
     30Xapian::doccount
     31MultWeightPostList::get_termfreq_min() const
     32{
     33    return source->get_termfreq_min();
     34}
     35
     36Xapian::doccount
     37MultWeightPostList::get_termfreq_est() const
     38{
     39    return source->get_termfreq_est();
     40}
     41
     42Xapian::doccount
     43MultWeightPostList::get_termfreq_max() const
     44{
     45    return source->get_termfreq_max();
     46}
     47
     48Xapian::weight
     49MultWeightPostList::get_maxweight() const
     50{
     51    return source->get_maxweight() * multiplier;
     52}
     53
     54Xapian::docid
     55MultWeightPostList::get_docid() const
     56{
     57    return source->get_docid();
     58}
     59
     60Xapian::weight
     61MultWeightPostList::get_weight() const
     62{
     63    return source->get_weight() * multiplier;
     64}
     65
     66Xapian::doclength
     67MultWeightPostList::get_doclength() const
     68{
     69    return source->get_doclength();
     70}
     71
     72Xapian::weight
     73MultWeightPostList::recalc_maxweight()
     74{
     75    return source->recalc_maxweight() * multiplier;
     76}
     77
     78PositionList *
     79MultWeightPostList::read_position_list()
     80{
     81    return source->read_position_list();
     82}
     83
     84PositionList *
     85MultWeightPostList::open_position_list() const
     86{
     87    return source->open_position_list();
     88}
     89
     90PostList *
     91MultWeightPostList::next(Xapian::weight w_min)
     92{
     93    AssertNe(multiplier, 0);
     94    next_handling_prune(source, w_min / multiplier, matcher);
     95    return NULL;
     96}
     97
     98PostList *
     99MultWeightPostList::skip_to(Xapian::docid did, Xapian::weight w_min)
     100{
     101    AssertNe(multiplier, 0);
     102    skip_to_handling_prune(source, did, w_min / multiplier, matcher);
     103    return NULL;
     104}
     105
     106bool
     107MultWeightPostList::at_end() const
     108{
     109    return source->at_end();
     110}
     111
     112string
     113MultWeightPostList::get_description() const
     114{
     115    string desc = "MultWeightPostList(";
     116    desc += source->get_description();
     117    desc += " * ";
     118    desc += om_tostring(multiplier);
     119    desc += ")";
     120    return desc;
     121}
  • xapian-core/matcher/multweightpostlist.h

    Property changes on: xapian-core/matcher/multweightpostlist.cc
    ___________________________________________________________________
    Name: svn:eol-style
       + native
    
     
     1/** @file multweightpostlist.h
     2 * @brief Return documents from a subquery with weights multiplied by a double.
     3 */
     4/* Copyright 2007 Lemur Consulting Ltd
     5 *
     6 * This program is free software; you can redistribute it and/or modify
     7 * it under the terms of the GNU General Public License as published by
     8 * the Free Software Foundation; either version 2 of the License, or
     9 * (at your option) any later version.
     10 *
     11 * This program is distributed in the hope that it will be useful,
     12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14 * GNU General Public License for more details.
     15 *
     16 * You should have received a copy of the GNU General Public License
     17 * along with this program; if not, write to the Free Software
     18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
     19 */
     20
     21#ifndef XAPIAN_INCLUDED_MULTWEIGHTPOSTLIST_H
     22#define XAPIAN_INCLUDED_MULTWEIGHTPOSTLIST_H
     23
     24#include "database.h"
     25#include "postlist.h"
     26
     27class MultiMatch;
     28
     29class MultWeightPostList : public PostList {
     30    /** The sub-postlist. */
     31    PostList *source;
     32
     33    /** The multiplier to apply to the weights. */
     34    double multiplier;
     35
     36    /** The object which is using this postlist to perform
     37     *  a match.  This object needs to be notified when the
     38     *  tree changes such that the maximum weights need to be
     39     *  recalculated.
     40     */
     41    MultiMatch *matcher;
     42
     43    /// Disallow copying.
     44    MultWeightPostList(const MultWeightPostList &);
     45
     46    /// Disallow assignment.
     47    void operator=(const MultWeightPostList &);
     48
     49  public:
     50    MultWeightPostList(PostList *source_, double multiplier_,
     51                       MultiMatch *matcher_)
     52        : source(source_), multiplier(multiplier_), matcher(matcher_) {}
     53    ~MultWeightPostList() { delete source; }
     54
     55    Xapian::doccount get_termfreq_min() const;
     56    Xapian::doccount get_termfreq_est() const;
     57    Xapian::doccount get_termfreq_max() const;
     58    Xapian::weight get_maxweight() const;
     59    Xapian::docid get_docid() const;
     60    Xapian::weight get_weight() const;
     61    Xapian::doclength get_doclength() const;
     62    Xapian::weight recalc_maxweight();
     63    PositionList * read_position_list();
     64    PositionList * open_position_list() const;
     65    PostList * next(Xapian::weight w_min);
     66    PostList * skip_to(Xapian::docid did, Xapian::weight w_min);
     67    bool at_end() const;
     68    string get_description() const;
     69};
     70
     71#endif /* XAPIAN_INCLUDED_MULTWEIGHTPOSTLIST_H */
  • xapian-core/matcher/Makefile.mk

    Property changes on: xapian-core/matcher/multweightpostlist.h
    ___________________________________________________________________
    Name: svn:eol-style
       + native
    
     
    1111        matcher/mergepostlist.h\
    1212        matcher/msetcmp.h\
    1313        matcher/msetpostlist.h\
     14        matcher/multweightpostlist.h\
    1415        matcher/orpostlist.h\
    1516        matcher/phrasepostlist.h\
    1617        matcher/remotesubmatch.h\
     
    4445        matcher/msetcmp.cc\
    4546        matcher/msetpostlist.cc\
    4647        matcher/multimatch.cc\
     48        matcher/multweightpostlist.cc\
    4749        matcher/orpostlist.cc\
    4850        matcher/phrasepostlist.cc\
    4951        matcher/rset.cc\
  • xapian-core/matcher/localmatch.cc

     
    33 * Copyright 1999,2000,2001 BrightStation PLC
    44 * Copyright 2002 Ananova Ltd
    55 * Copyright 2002,2003,2004,2005,2006,2007 Olly Betts
     6 * Copyright 2007 Lemur Consulting Ltd
    67 *
    78 * This program is free software; you can redistribute it and/or
    89 * modify it under the terms of the GNU General Public License as
     
    3839#include "mergepostlist.h"
    3940#include "extraweightpostlist.h"
    4041#include "valuerangepostlist.h"
     42#include "multweightpostlist.h"
    4143
    4244#include "omqueryinternal.h"
    4345
    4446#include <algorithm>
    4547#include "autoptr.h"
    4648#include <queue>
     49#include <cfloat>
    4750
    4851/////////////////////////////////////////////
    4952// Comparison operators which we will need //
     
    476479        case Xapian::Query::OP_VALUE_RANGE:
    477480            RETURN(new ValueRangePostList(db, Xapian::valueno(query->parameter),
    478481                                          query->tname, query->str_parameter));
     482        case Xapian::Query::OP_MULT_WEIGHT:
     483            Assert(query->subqs.size() == 1);
     484            if (is_bool || query->dbl_parameter < DBL_EPSILON) {
     485                // Return as a boolean query.
     486                RETURN(postlist_from_query(query->subqs[0], matcher, true));
     487            } else {
     488                RETURN(new MultWeightPostList(postlist_from_query(query->subqs[0], matcher, is_bool),
     489                                              query->dbl_parameter, matcher));
     490            }
    479491    }
    480492    Assert(false);
    481493    RETURN(NULL);
  • xapian-core/tests/harness/testsuite.h

     
    246246        "Expected `"STRINGIZE(a)"' and `"STRINGIZE(b)"' to be (nearly) equal:" \
    247247        " were " << setprecision(DBL_DIG) << (a) << " and " << (b) << ")" << setprecision(6))
    248248
     249/// Test two doubles for non-near-equality.
     250#define TEST_NOT_EQUAL_DOUBLE(a, b) TEST_AND_EXPLAIN(!TEST_EQUAL_DOUBLE_((a), (b)), \
     251        "Expected `"STRINGIZE(a)"' and `"STRINGIZE(b)"' not to be (nearly) equal:" \
     252        " were " << setprecision(DBL_DIG) << (a) << " and " << (b) << ")" << setprecision(6))
     253
    249254/// Test for non-equality of two things.
    250255#define TEST_NOT_EQUAL(a, b) TEST_AND_EXPLAIN(((a) != (b)), \
    251256        "Expected `"STRINGIZE(a)"' and `"STRINGIZE(b)"' not to be equal:" \
  • xapian-core/tests/harness/testsuite.cc

     
    673673bool
    674674TEST_EQUAL_DOUBLE_(double a, double b)
    675675{
     676    if (a == b) return true;
    676677    return (ceil(log10(max(fabs(a), fabs(b)))) - log10(fabs(a - b)) > DBL_DIG);
    677678}
  • xapian-core/tests/api_anydb.cc

     
    18091809    return true;
    18101810}
    18111811
     1812// Feature test for Query::OP_MULT_WEIGHT.
     1813static bool test_multweight1() {
     1814    Xapian::Database db(get_database("apitest_phrase"));
     1815    Xapian::Enquire enq(db);
     1816    Xapian::QueryParser qp;
     1817
     1818    static const char * queries[] = {
     1819        "pad",
     1820        "milk fridge",
     1821        "leave milk on fridge",
     1822        "ordered milk operator",
     1823        "ordered phrase operator",
     1824        "leave \"milk on fridge\"",
     1825        "notpresent",
     1826        "leave \"milk notpresent\"",
     1827        NULL
     1828    };
     1829    static double multipliers[] = {
     1830        -1000000, -2.5, -1, -0.5, 0, 0.5, 1, 2.5, 1000000,
     1831        0, 0
     1832    };
     1833
     1834    for (const char **qstr = queries; *qstr; ++qstr) {
     1835        Xapian::Query query1 = qp.parse_query(*qstr);
     1836        tout << "query1: " << query1.get_description() << endl;
     1837        for (double *multp = multipliers; multp[0] != multp[1]; ++multp) {
     1838            double mult = *multp;
     1839            Xapian::Query query2(Xapian::Query::OP_MULT_WEIGHT, query1, mult);
     1840            tout << "query2: " << query2.get_description() << endl;
     1841
     1842            enq.set_query(query1);
     1843            Xapian::MSet mset1 = enq.get_mset(0, 20);
     1844            enq.set_query(query2);
     1845            Xapian::MSet mset2 = enq.get_mset(0, 20);
     1846
     1847            TEST_EQUAL(mset1.size(), mset2.size());
     1848
     1849            Xapian::MSetIterator i1, i2;
     1850            if (mult > 0) {
     1851                for (i1 = mset1.begin(), i2 = mset2.begin();
     1852                     i1 != mset1.end() && i2 != mset2.end(); ++i1, ++i2) {
     1853                    TEST_EQUAL_DOUBLE(i1.get_weight() * mult, i2.get_weight());
     1854                    TEST_EQUAL(*i1, *i2);
     1855                }
     1856            } else {
     1857                // Weights in mset2 are 0; so it should be sorted by docid.
     1858                vector<Xapian::docid> ids1;
     1859                vector<Xapian::docid> ids2;
     1860                for (i1 = mset1.begin(), i2 = mset2.begin();
     1861                     i1 != mset1.end() && i2 != mset2.end(); ++i1, ++i2) {
     1862                    TEST_NOT_EQUAL_DOUBLE(i1.get_weight(), 0);
     1863                    TEST_EQUAL_DOUBLE(i2.get_weight(), 0);
     1864                    ids1.push_back(*i1);
     1865                    ids2.push_back(*i2);
     1866                }
     1867                sort(ids1.begin(), ids1.end());
     1868                TEST_EQUAL(ids1, ids2);
     1869            }
     1870        }
     1871    }
     1872    return true;
     1873}
     1874
    18121875// #######################################################################
    18131876// # End of test cases: now we list the tests to run.
    18141877
     
    18751938    {"allpostlist1",       test_allpostlist1},
    18761939    {"emptyterm1",         test_emptyterm1},
    18771940    {"valuerange1",        test_valuerange1},
     1941    {"multweight1",        test_multweight1},
    18781942    {0, 0}
    18791943};
  • xapian-core/include/xapian/query.h

     
    44/* Copyright 1999,2000,2001 BrightStation PLC
    55 * Copyright 2002 Ananova Ltd
    66 * Copyright 2003,2004,2005,2006,2007 Olly Betts
    7  * Copyright 2006 Lemur Consulting Ltd
     7 * Copyright 2006,2007 Lemur Consulting Ltd
    88 *
    99 * This program is free software; you can redistribute it and/or
    1010 * modify it under the terms of the GNU General Public License as
     
    9999            /** Select an elite set from the subqueries, and perform
    100100             *  a query with these combined as an OR query.
    101101             */
    102             OP_ELITE_SET = 10
     102            OP_ELITE_SET = 10,
     103
     104            /** Multiply the weight of a subquery by a multiplier.  Only
     105             * positive multiplers are supported - negative multipliers will be
     106             * clipped to 0. */
     107            OP_MULT_WEIGHT
    103108        } op;
    104109
    105110        /** Copy constructor. */
     
    154159        /** Apply the specified operator to a single Xapian::Query object. */
    155160        Query(Query::op op_, Xapian::Query q);
    156161
     162        /** Apply the specified operator to a single Xapian::Query object, with a parameter. */
     163        Query(Query::op op_, Xapian::Query q, double parameter);
     164
    157165        /** Construct a value range query on a document value.
    158166         *
    159167         *  A value range query matches those documents which have a value
     
    281289        /// Within query frequency of this term - leaf node only
    282290        Xapian::termcount wqf;
    283291
     292        /// Used to store a multiplier for subquery weights.
     293        double dbl_parameter;
     294
    284295        /** swap the contents of this with another Xapian::Query::Internal,
    285296         *  in a way which is guaranteed not to throw.  This is
    286297         *  used with the assignment operator to make it exception
     
    360371         */
    361372        void add_subquery(const Query::Internal * subq);
    362373
     374        void set_dbl_parameter(double dbl_parameter_) {
     375            dbl_parameter = dbl_parameter_;
     376        }
     377
    363378        /** Finish off the construction.
    364379         */
    365380        Query::Internal * end_construction();
  • xapian-core/api/omqueryinternal.cc

     
    33 * Copyright 1999,2000,2001 BrightStation PLC
    44 * Copyright 2002 Ananova Ltd
    55 * Copyright 2002,2003,2004,2005,2006,2007 Olly Betts
    6  * Copyright 2006 Lemur Consulting Ltd
     6 * Copyright 2006,2007 Lemur Consulting Ltd
    77 *
    88 * This program is free software; you can redistribute it and/or
    99 * modify it under the terms of the GNU General Public License as
     
    2828#include "omqueryinternal.h"
    2929#include "utils.h"
    3030#include "serialise.h"
     31#include "serialise-double.h"
    3132
    3233#include <xapian/error.h>
    3334#include <xapian/enquire.h>
     
    4041#include <algorithm>
    4142#include <math.h>
    4243#include <limits.h>
     44#include <cfloat>
    4345
    4446using namespace std;
    4547
     
    5860        case Xapian::Query::OP_ELITE_SET:
    5961        case Xapian::Query::OP_VALUE_RANGE:
    6062            return 0;
     63        case Xapian::Query::OP_MULT_WEIGHT:
     64            return 1;
    6165        case Xapian::Query::OP_FILTER:
    6266        case Xapian::Query::OP_AND_MAYBE:
    6367        case Xapian::Query::OP_AND_NOT:
     
    7579        case Xapian::Query::Internal::OP_LEAF:
    7680        case Xapian::Query::OP_VALUE_RANGE:
    7781            return 0;
     82        case Xapian::Query::OP_MULT_WEIGHT:
     83            return 1;
    7884        case Xapian::Query::OP_FILTER:
    7985        case Xapian::Query::OP_AND_MAYBE:
    8086        case Xapian::Query::OP_AND_NOT:
     
    177183                result += str_parameter;
    178184                result += om_tostring(parameter);
    179185                break;
     186            case Xapian::Query::OP_MULT_WEIGHT:
     187                result += ".";
     188                result += serialise_double(dbl_parameter);
     189                break;
    180190        }
    181191    }
    182192    return result;
     
    202212        case Xapian::Query::OP_PHRASE:          name = "PHRASE"; break;
    203213        case Xapian::Query::OP_ELITE_SET:       name = "ELITE_SET"; break;
    204214        case Xapian::Query::OP_VALUE_RANGE:     name = "VALUE_RANGE"; break;
     215        case Xapian::Query::OP_MULT_WEIGHT:     name = "MULT_WEIGHT"; break;
    205216    }
    206217    return name;
    207218}
     
    248259        if (!description.empty()) description += opstr;
    249260        description += (**i).get_description();
    250261    }
     262
     263    if (op == Xapian::Query::OP_MULT_WEIGHT) {
     264        description += " * ";
     265        description += om_tostring(dbl_parameter);
     266    }
     267
    251268    return "(" + description + ")";
    252269}
    253270
     
    451468                    return new Xapian::Query::Internal(Xapian::Query::OP_VALUE_RANGE, valno,
    452469                                                       start, stop);
    453470                }
     471                case '.': {
     472                    AutoPtr<Xapian::Query::Internal> result(
     473                        qint_from_vector(Xapian::Query::OP_MULT_WEIGHT, subqs));
     474                    result->set_dbl_parameter(unserialise_double(&p, end));
     475                    return result.release();
     476                }
    454477                default:
    455478                    DEBUGLINE(UNKNOWN, "Can't parse remainder `" << p - 1 << "'");
    456479                    throw Xapian::InvalidArgumentError("Invalid query string");
     
    498521    std::swap(str_parameter, other.str_parameter);
    499522    std::swap(term_pos, other.term_pos);
    500523    std::swap(wqf, other.wqf);
     524    std::swap(dbl_parameter, other.dbl_parameter);
    501525}
    502526
    503527Xapian::Query::Internal::Internal(const Xapian::Query::Internal &copyme)
     
    508532          tname(copyme.tname),
    509533          str_parameter(copyme.str_parameter),
    510534          term_pos(copyme.term_pos),
    511           wqf(copyme.wqf)
     535          wqf(copyme.wqf),
     536          dbl_parameter(copyme.dbl_parameter)
    512537{
    513538    for (subquery_list::const_iterator i = copyme.subqs.begin();
    514539         i != copyme.subqs.end();
     
    672697            // match anything.
    673698            if (tname > str_parameter) return 0;
    674699            return this;
     700        case OP_MULT_WEIGHT:
     701            if (fabs(dbl_parameter - 1.0) > DBL_EPSILON) return this;
     702            // If the multiplier is 1, this node doesn't actually do anything,
     703            // so we leave it to be removed.
     704            break;
    675705        case OP_PHRASE: case OP_NEAR:
    676706            // Default to the number of subqueries.
    677707            if (!parameter) parameter = subqs.size();
  • xapian-core/api/omquery.cc

     
    33 * Copyright 1999,2000,2001 BrightStation PLC
    44 * Copyright 2001,2002 Ananova Ltd
    55 * Copyright 2003,2004,2005,2006,2007 Olly Betts
    6  * Copyright 2006 Lemur Consulting Ltd
     6 * Copyright 2006,2007 Lemur Consulting Ltd
    77 *
    88 * This program is free software; you can redistribute it and/or
    99 * modify it under the terms of the GNU General Public License as
     
    132132    }
    133133}
    134134
     135Query::Query(Query::op op_, Xapian::Query q, double parameter)
     136{
     137    DEBUGAPICALL(void, "Xapian::Query::Query",
     138                 op_ << ", " << q << ", " << parameter);
     139    try {
     140        start_construction(op_, 0);
     141        internal->set_dbl_parameter(parameter);
     142        add_subquery(q);
     143        end_construction();
     144    } catch (...) {
     145        abort_construction();
     146        throw;
     147    }
     148}
     149
    135150Query::Query(Query::op op_, Xapian::valueno valno,
    136151             const string &begin, const string &end)
    137152    : internal(new Query::Internal(op_, valno, begin, end))
  • xapian-bindings/python/pythontest.py

     
    817817    del dbr
    818818    shutil.rmtree(dbpath)
    819819
     820def test_mult_weight():
     821    """Test query OP_MULT_WEIGHT feature.
     822
     823    """
     824    db = setup_database()
     825    for mult in (-2.5, -1, 0, 1, 2.5):
     826        context("checking queries with OP_MULT_WEIGHT with a multipler of %r" %
     827                mult)
     828        query1 = xapian.Query("it")
     829        query2 = xapian.Query(xapian.Query.OP_MULT_WEIGHT, query1, mult)
     830
     831        enquire = xapian.Enquire(db)
     832        enquire.set_query(query1)
     833        mset1 = enquire.get_mset(0, 10)
     834        enquire.set_query(query2)
     835        mset2 = enquire.get_mset(0, 10)
     836        if mult <= 0:
     837            expected = [(0, item.docid) for item in mset1]
     838            expected.sort()
     839        else:
     840            expected = [(item.weight * mult, item.docid) for item in mset1]
     841        expect([(item.weight, item.docid) for item in mset2], expected)
     842
     843
     844def test_weight_normalise():
     845    """Test normalising of query weights using the OP_MULT_WEIGHT feature.
     846
     847    This test first runs a search (asking for no results) to get the maximum
     848    possible weight for a query, and then checks that the results of
     849    MSet.get_max_possible() match this.
     850
     851    This tests that the get_max_possible() value is correct (though it isn't
     852    guaranteed to be at a tight bound), and that the mult-weight query can
     853    compensate correctly.
     854
     855    """
     856    db = setup_database()
     857    for query in (
     858                  "it",
     859                  "was",
     860                  "it was",
     861                  "it was four",
     862                  "it was four five",
     863                  "\"was it warm\" four notpresent",
     864                  "notpresent",
     865    ):
     866        context("checking query %r using OP_MULT_WEIGHT to normalise the weights" % query)
     867        qp = xapian.QueryParser()
     868        query1 = qp.parse_query(query)
     869        enquire = xapian.Enquire(db)
     870        enquire.set_query(query1)
     871        mset1 = enquire.get_mset(0, 0)
     872
     873        # Check the max_attained value is 0 - this gives us some reassurance
     874        # that the match didn't actually do the work of calculating any
     875        # results.
     876        expect(mset1.get_max_attained(), 0)
     877
     878        max_possible = mset1.get_max_possible()
     879        mult = 1.0 / max_possible
     880        query2 = xapian.Query(xapian.Query.OP_MULT_WEIGHT, query1, mult)
     881
     882        enquire = xapian.Enquire(db)
     883        enquire.set_query(query2)
     884        mset2 = enquire.get_mset(0, 10)
     885        # max_possible should be 1 (excluding rounding errors) for mset2
     886        expect(int(mset2.get_max_possible() * 1000000.0 + 0.5), 1000000)
     887        for item in mset2:
     888            expect(item.weight > 0, True)
     889            expect(item.weight <= 1, True)
     890
     891
    820892# The legacy sequence API is only supported for Python >= 2.3 so don't try
    821893# testing it for Python 2.2.
    822894vinfo = sys.version_info   
  • xapian-bindings/xapian.i

     
    77 * Copyright 2001,2002 Ananova Ltd
    88 * Copyright 2002,2003,2005 James Aylett
    99 * Copyright 2002,2003,2004,2005,2006,2007 Olly Betts
     10 * Copyright 2007 Lemur Consulting Ltd
    1011 *
    1112 * This program is free software; you can redistribute it and/or
    1213 * modify it under the terms of the GNU General Public License as
     
    839840            OP_NEAR,
    840841            OP_PHRASE,
    841842            OP_VALUE_RANGE,
    842             OP_ELITE_SET = 10
     843            OP_ELITE_SET = 10,
     844            OP_MULT_WEIGHT
    843845        };
    844846        // FIXME wrap optional arguments in PHP?
    845847        Query(const string &tname, termcount wqf = 1, termpos term_pos = 0);
     
    868870        /** Apply the specified operator to a single Xapian::Query object. */
    869871        Query(Query::op op_, Xapian::Query q);
    870872
     873        /** Apply the specified operator to a single Xapian::Query object, with a parameter. */
     874        Query(Query::op op_, Xapian::Query q, double parameter);
     875
    871876        /** Constructs a new empty query object */
    872877        Query();
    873878