| database.h | | database.h | |
| /** \file database.h | | /** \file database.h | |
| * \brief API for working with Xapian databases | | * \brief API for working with Xapian databases | |
| */ | | */ | |
| /* Copyright 1999,2000,2001 BrightStation PLC | | /* Copyright 1999,2000,2001 BrightStation PLC | |
| * Copyright 2002 Ananova Ltd | | * Copyright 2002 Ananova Ltd | |
|
| * Copyright 2002,2003,2004,2005,2006,2007,2008,2009 Olly Betts | | * Copyright 2002,2003,2004,2005,2006,2007,2008,2009,2011 Olly Betts | |
| * Copyright 2006,2008 Lemur Consulting Ltd | | * Copyright 2006,2008 Lemur Consulting Ltd | |
| * | | * | |
| * This program is free software; you can redistribute it and/or | | * This program is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU General Public License as | | * modify it under the terms of the GNU General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| | | | |
| skipping to change at line 267 | | skipping to change at line 267 | |
| * @param tname The term whose collection frequency is being | | * @param tname The term whose collection frequency is being | |
| * requested. | | * requested. | |
| */ | | */ | |
| Xapian::termcount get_collection_freq(const std::string & tname) con
st; | | Xapian::termcount get_collection_freq(const std::string & tname) con
st; | |
| | | | |
| /** Return the frequency of a given value slot. | | /** Return the frequency of a given value slot. | |
| * | | * | |
| * This is the number of documents which have a (non-empty) value | | * This is the number of documents which have a (non-empty) value | |
| * stored in the slot. | | * stored in the slot. | |
| * | | * | |
|
| * @param valno The value slot to examine. | | * @param slot The value slot to examine. | |
| * | | * | |
| * @exception UnimplementedError The frequency of the value isn't | | * @exception UnimplementedError The frequency of the value isn't | |
| * available for this database type. | | * available for this database type. | |
| */ | | */ | |
|
| Xapian::doccount get_value_freq(Xapian::valueno valno) const; | | Xapian::doccount get_value_freq(Xapian::valueno slot) const; | |
| | | | |
| /** Get a lower bound on the values stored in the given value slot. | | /** Get a lower bound on the values stored in the given value slot. | |
| * | | * | |
| * If there are no values stored in the given value slot, this will | | * If there are no values stored in the given value slot, this will | |
| * return an empty string. | | * return an empty string. | |
| * | | * | |
| * If the lower bound isn't available for the given database type, | | * If the lower bound isn't available for the given database type, | |
| * this will return the lowest possible bound - the empty string. | | * this will return the lowest possible bound - the empty string. | |
| * | | * | |
|
| * @param valno The value slot to examine. | | * @param slot The value slot to examine. | |
| */ | | */ | |
|
| std::string get_value_lower_bound(Xapian::valueno valno) const; | | std::string get_value_lower_bound(Xapian::valueno slot) const; | |
| | | | |
| /** Get an upper bound on the values stored in the given value slot. | | /** Get an upper bound on the values stored in the given value slot. | |
| * | | * | |
| * If there are no values stored in the given value slot, this will | | * If there are no values stored in the given value slot, this will | |
| * return an empty string. | | * return an empty string. | |
| * | | * | |
|
| * @param valno The value slot to examine. | | * @param slot The value slot to examine. | |
| * | | * | |
| * @exception UnimplementedError The upper bound of the values isn'
t | | * @exception UnimplementedError The upper bound of the values isn'
t | |
| * available for this database type. | | * available for this database type. | |
| */ | | */ | |
|
| std::string get_value_upper_bound(Xapian::valueno valno) const; | | std::string get_value_upper_bound(Xapian::valueno slot) const; | |
| | | | |
| /** Get a lower bound on the length of a document in this DB. | | /** Get a lower bound on the length of a document in this DB. | |
| * | | * | |
| * This bound does not include any zero-length documents. | | * This bound does not include any zero-length documents. | |
| */ | | */ | |
| Xapian::termcount get_doclength_lower_bound() const; | | Xapian::termcount get_doclength_lower_bound() const; | |
| | | | |
| /// Get an upper bound on the length of a document in this DB. | | /// Get an upper bound on the length of a document in this DB. | |
| Xapian::termcount get_doclength_upper_bound() const; | | Xapian::termcount get_doclength_upper_bound() const; | |
| | | | |
| | | | |
| skipping to change at line 338 | | skipping to change at line 338 | |
| * | | * | |
| * This method returns a Xapian::Document object which provides the | | * This method returns a Xapian::Document object which provides the | |
| * information about a document. | | * information about a document. | |
| * | | * | |
| * @param did The document id of the document to retrieve. | | * @param did The document id of the document to retrieve. | |
| * | | * | |
| * @return A Xapian::Document object containing the document d
ata | | * @return A Xapian::Document object containing the document d
ata | |
| * | | * | |
| * @exception Xapian::DocNotFoundError The document specified | | * @exception Xapian::DocNotFoundError The document specified | |
| * could not be found in the database. | | * could not be found in the database. | |
|
| | | * | |
| | | * @exception Xapian::InvalidArgumentError did was 0, which is not | |
| | | * a valid document id. | |
| */ | | */ | |
| Xapian::Document get_document(Xapian::docid did) const; | | Xapian::Document get_document(Xapian::docid did) const; | |
| | | | |
| /** Suggest a spelling correction. | | /** Suggest a spelling correction. | |
| * | | * | |
| * @param word The potentially misspelled word. | | * @param word The potentially misspelled word. | |
| * @param max_edit_distance Only consider words which are at mos
t | | * @param max_edit_distance Only consider words which are at mos
t | |
| * @a max_edit_distance edits from @a word. An edit is a | | * @a max_edit_distance edits from @a word. An edit is a | |
| * character insertion, deletion, or the transposition of two | | * character insertion, deletion, or the transposition of two | |
| * adjacent characters (default is 2). | | * adjacent characters (default is 2). | |
| | | | |
End of changes. 8 change blocks. |
| 7 lines changed or deleted | | 10 lines changed or added | |
|
| keymaker.h | | keymaker.h | |
| | | | |
| skipping to change at line 64 | | skipping to change at line 64 | |
| * | | * | |
| * When used for collapsing, the documents will only be considered equal i
f | | * When used for collapsing, the documents will only be considered equal i
f | |
| * all the values specified match. If none of the specified values are se
t | | * all the values specified match. If none of the specified values are se
t | |
| * then the generated key will be empty, so such documents won't be collap
sed | | * then the generated key will be empty, so such documents won't be collap
sed | |
| * (which is consistent with the behaviour in the "collapse on a value" ca
se). | | * (which is consistent with the behaviour in the "collapse on a value" ca
se). | |
| * If you'd prefer that documents with none of the keys set are collapsed | | * If you'd prefer that documents with none of the keys set are collapsed | |
| * together, then you can set @a reverse for at least one of the values. | | * together, then you can set @a reverse for at least one of the values. | |
| * Other than this, it isn't useful to set @a reverse for collapsing. | | * Other than this, it isn't useful to set @a reverse for collapsing. | |
| */ | | */ | |
| class XAPIAN_VISIBILITY_DEFAULT MultiValueKeyMaker : public KeyMaker { | | class XAPIAN_VISIBILITY_DEFAULT MultiValueKeyMaker : public KeyMaker { | |
|
| std::vector<std::pair<Xapian::valueno, bool> > valnos; | | std::vector<std::pair<Xapian::valueno, bool> > slots; | |
| | | | |
| public: | | public: | |
| MultiValueKeyMaker() { } | | MultiValueKeyMaker() { } | |
| | | | |
| template <class Iterator> | | template <class Iterator> | |
| MultiValueKeyMaker(Iterator begin, Iterator end) { | | MultiValueKeyMaker(Iterator begin, Iterator end) { | |
| while (begin != end) add_value(*begin++); | | while (begin != end) add_value(*begin++); | |
| } | | } | |
| | | | |
| virtual std::string operator()(const Xapian::Document & doc) const; | | virtual std::string operator()(const Xapian::Document & doc) const; | |
| | | | |
|
| void add_value(Xapian::valueno valno, bool reverse = false) { | | void add_value(Xapian::valueno slot, bool reverse = false) { | |
| valnos.push_back(std::make_pair(valno, reverse)); | | slots.push_back(std::make_pair(slot, reverse)); | |
| } | | } | |
| }; | | }; | |
| | | | |
| /** Virtual base class for sorter functor. */ | | /** Virtual base class for sorter functor. */ | |
|
| class XAPIAN_VISIBILITY_DEFAULT XAPIAN_DEPRECATED() Sorter : public KeyMake
r { }; | | class XAPIAN_VISIBILITY_DEFAULT XAPIAN_DEPRECATED_CLASS Sorter : public Key
Maker { }; | |
| | | | |
| /** Sorter subclass which sorts by a several values. | | /** Sorter subclass which sorts by a several values. | |
| * | | * | |
| * Results are ordered by the first value. In the event of a tie, the | | * Results are ordered by the first value. In the event of a tie, the | |
| * second is used. If this is the same for both, the third is used, and | | * second is used. If this is the same for both, the third is used, and | |
| * so on. | | * so on. | |
| * | | * | |
| * @deprecated This class is deprecated - you should migrate to using | | * @deprecated This class is deprecated - you should migrate to using | |
| * MultiValueKeyMaker instead. Note that MultiValueSorter::add() becomes | | * MultiValueKeyMaker instead. Note that MultiValueSorter::add() becomes | |
| * MultiValueKeyMaker::add_value(), but the sense of the direction flag | | * MultiValueKeyMaker::add_value(), but the sense of the direction flag | |
| | | | |
| skipping to change at line 109 | | skipping to change at line 109 | |
| * sorter.add(5, false); | | * sorter.add(5, false); | |
| * | | * | |
| * becomes: | | * becomes: | |
| * | | * | |
| * MultiValueKeyMaker sorter; | | * MultiValueKeyMaker sorter; | |
| * // Primary ordering is forwards on value 4. | | * // Primary ordering is forwards on value 4. | |
| * sorter.add_value(4); | | * sorter.add_value(4); | |
| * // Secondary ordering is reverse on value 5. | | * // Secondary ordering is reverse on value 5. | |
| * sorter.add_value(5, true); | | * sorter.add_value(5, true); | |
| */ | | */ | |
|
| class XAPIAN_VISIBILITY_DEFAULT XAPIAN_DEPRECATED() MultiValueSorter : publ | | class XAPIAN_VISIBILITY_DEFAULT XAPIAN_DEPRECATED_CLASS MultiValueSorter : | |
| ic Sorter { | | public Sorter { | |
| std::vector<std::pair<Xapian::valueno, bool> > valnos; | | std::vector<std::pair<Xapian::valueno, bool> > slots; | |
| | | | |
| public: | | public: | |
| MultiValueSorter() { } | | MultiValueSorter() { } | |
| | | | |
| template <class Iterator> | | template <class Iterator> | |
| MultiValueSorter(Iterator begin, Iterator end) { | | MultiValueSorter(Iterator begin, Iterator end) { | |
| while (begin != end) add(*begin++); | | while (begin != end) add(*begin++); | |
| } | | } | |
| | | | |
| virtual std::string operator()(const Xapian::Document & doc) const; | | virtual std::string operator()(const Xapian::Document & doc) const; | |
| | | | |
|
| void add(Xapian::valueno valno, bool forward = true) { | | void add(Xapian::valueno slot, bool forward = true) { | |
| valnos.push_back(std::make_pair(valno, forward)); | | slots.push_back(std::make_pair(slot, forward)); | |
| } | | } | |
| }; | | }; | |
| | | | |
| } | | } | |
| | | | |
| #endif // XAPIAN_INCLUDED_KEYMAKER_H | | #endif // XAPIAN_INCLUDED_KEYMAKER_H | |
| | | | |
End of changes. 5 change blocks. |
| 9 lines changed or deleted | | 9 lines changed or added | |
|
| query.h | | query.h | |
| | | | |
| skipping to change at line 201 | | skipping to change at line 201 | |
| Xapian::termcount parameter = 0); | | Xapian::termcount parameter = 0); | |
| | | | |
| /** Apply the specified operator to a single Xapian::Query object, w
ith | | /** Apply the specified operator to a single Xapian::Query object, w
ith | |
| * a double parameter. | | * a double parameter. | |
| */ | | */ | |
| Query(Query::op op_, Xapian::Query q, double parameter); | | Query(Query::op op_, Xapian::Query q, double parameter); | |
| | | | |
| /** Construct a value range query on a document value. | | /** Construct a value range query on a document value. | |
| * | | * | |
| * A value range query matches those documents which have a value | | * A value range query matches those documents which have a value | |
|
| * stored in the slot given by @a valno which is in the range | | * stored in the slot given by @a slot which is in the range | |
| * specified by @a begin and @a end (in lexicographical | | * specified by @a begin and @a end (in lexicographical | |
| * order), including the endpoints. | | * order), including the endpoints. | |
| * | | * | |
| * @param op_ The operator to use for the query. Currently, must | | * @param op_ The operator to use for the query. Currently, must | |
| * be OP_VALUE_RANGE. | | * be OP_VALUE_RANGE. | |
|
| * @param valno The slot number to get the value from. | | * @param slot The slot number to get the value from. | |
| * @param begin The start of the range. | | * @param begin The start of the range. | |
| * @param end The end of the range. | | * @param end The end of the range. | |
| */ | | */ | |
|
| Query(Query::op op_, Xapian::valueno valno, | | Query(Query::op op_, Xapian::valueno slot, | |
| const std::string &begin, const std::string &end); | | const std::string &begin, const std::string &end); | |
| | | | |
| /** Construct a value comparison query on a document value. | | /** Construct a value comparison query on a document value. | |
| * | | * | |
| * This query matches those documents which have a value stored in
the | | * This query matches those documents which have a value stored in
the | |
|
| * slot given by @a valno which compares, as specified by the | | * slot given by @a slot which compares, as specified by the | |
| * operator, to @a value. | | * operator, to @a value. | |
| * | | * | |
| * @param op_ The operator to use for the query. Currently, must | | * @param op_ The operator to use for the query. Currently, must | |
| * be OP_VALUE_GE or OP_VALUE_LE. | | * be OP_VALUE_GE or OP_VALUE_LE. | |
|
| * @param valno The slot number to get the value from. | | * @param slot The slot number to get the value from. | |
| * @param value The value to compare. | | * @param value The value to compare. | |
| */ | | */ | |
|
| Query(Query::op op_, Xapian::valueno valno, const std::string &value
); | | Query(Query::op op_, Xapian::valueno slot, const std::string &value)
; | |
| | | | |
| /** Construct an external source query. | | /** Construct an external source query. | |
| * | | * | |
| * An attempt to clone the posting source will be made immediately,
so | | * An attempt to clone the posting source will be made immediately,
so | |
| * if the posting source supports clone(), the source supplied may
be | | * if the posting source supports clone(), the source supplied may
be | |
| * safely deallocated after this call. If the source does not supp
ort | | * safely deallocated after this call. If the source does not supp
ort | |
| * clone(), the caller must ensure that the posting source remains | | * clone(), the caller must ensure that the posting source remains | |
| * valid until the Query is deallocated. | | * valid until the Query is deallocated. | |
| * | | * | |
| * @param external_source The source to use in the query. | | * @param external_source The source to use in the query. | |
| | | | |
| skipping to change at line 448 | | skipping to change at line 448 | |
| void operator=(const Query::Internal & copyme); | | void operator=(const Query::Internal & copyme); | |
| | | | |
| /** A query consisting of a single term. */ | | /** A query consisting of a single term. */ | |
| explicit Internal(const std::string & tname_, Xapian::termcount wqf_
= 1, | | explicit Internal(const std::string & tname_, Xapian::termcount wqf_
= 1, | |
| Xapian::termpos term_pos_ = 0); | | Xapian::termpos term_pos_ = 0); | |
| | | | |
| /** Create internals given only the operator and a parameter. */ | | /** Create internals given only the operator and a parameter. */ | |
| Internal(op_t op_, Xapian::termcount parameter); | | Internal(op_t op_, Xapian::termcount parameter); | |
| | | | |
| /** Construct a range query on a document value. */ | | /** Construct a range query on a document value. */ | |
|
| Internal(op_t op_, Xapian::valueno valno, | | Internal(op_t op_, Xapian::valueno slot, | |
| const std::string &begin, const std::string &end); | | const std::string &begin, const std::string &end); | |
| | | | |
| /** Construct a value greater-than-or-equal query on a document valu
e. | | /** Construct a value greater-than-or-equal query on a document valu
e. | |
| */ | | */ | |
|
| Internal(op_t op_, Xapian::valueno valno, const std::string &value); | | Internal(op_t op_, Xapian::valueno slot, const std::string &value); | |
| | | | |
| /// Construct an external source query. | | /// Construct an external source query. | |
| explicit Internal(Xapian::PostingSource * external_source_, bool own
ed); | | explicit Internal(Xapian::PostingSource * external_source_, bool own
ed); | |
| | | | |
| /** Destructor. */ | | /** Destructor. */ | |
| ~Internal(); | | ~Internal(); | |
| | | | |
| static Xapian::Query::Internal * unserialise(const std::string &s, | | static Xapian::Query::Internal * unserialise(const std::string &s, | |
| const Registry & regist
ry); | | const Registry & regist
ry); | |
| | | | |
| | | | |
End of changes. 8 change blocks. |
| 8 lines changed or deleted | | 8 lines changed or added | |
|
| queryparser.h | | queryparser.h | |
| /** \file queryparser.h | | /** \file queryparser.h | |
| * \brief parsing a user query string to build a Xapian::Query object | | * \brief parsing a user query string to build a Xapian::Query object | |
| */ | | */ | |
|
| /* Copyright (C) 2005,2006,2007,2008,2009,2010 Olly Betts | | /* Copyright (C) 2005,2006,2007,2008,2009,2010,2011 Olly Betts | |
| | | * Copyright (C) 2010 Adam Sjøgren | |
| * | | * | |
| * This program is free software; you can redistribute it and/or | | * This program is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU General Public License as | | * modify it under the terms of the GNU General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| * GNU General Public License for more details. | | * GNU General Public License for more details. | |
| | | | |
| skipping to change at line 113 | | skipping to change at line 114 | |
| protected: | | protected: | |
| Xapian::valueno valno; | | Xapian::valueno valno; | |
| | | | |
| private: | | private: | |
| bool prefix; | | bool prefix; | |
| std::string str; | | std::string str; | |
| | | | |
| public: | | public: | |
| /** Constructor. | | /** Constructor. | |
| * | | * | |
|
| * @param valno_ The value number to return from operator(). | | * @param slot_ The value number to return from operator(). | |
| */ | | */ | |
|
| StringValueRangeProcessor(Xapian::valueno valno_) | | StringValueRangeProcessor(Xapian::valueno slot_) | |
| : valno(valno_), str() { } | | : valno(slot_), str() { } | |
| | | | |
| /** Constructor. | | /** Constructor. | |
| * | | * | |
|
| * @param valno_ The value number to return from operator(). | | * @param slot_ The value number to return from operator(). | |
| * @param str_ A string to look for to recognise values as belongi
ng | | * @param str_ A string to look for to recognise values as belongi
ng | |
| * to this range. | | * to this range. | |
| * @param prefix_ Flag specifying whether to check for str_ as a prefi
x | | * @param prefix_ Flag specifying whether to check for str_ as a prefi
x | |
| * or a suffix. | | * or a suffix. | |
| */ | | */ | |
|
| StringValueRangeProcessor(Xapian::valueno valno_, const std::string &st
r_, | | StringValueRangeProcessor(Xapian::valueno slot_, const std::string &str
_, | |
| bool prefix_ = true) | | bool prefix_ = true) | |
|
| : valno(valno_), prefix(prefix_), str(str_) { } | | : valno(slot_), prefix(prefix_), str(str_) { } | |
| | | | |
| /** Check for a valid range of this type. | | /** Check for a valid range of this type. | |
| * | | * | |
| * If no prefix or suffix is specified, then this always returns the | | * If no prefix or suffix is specified, then this always returns the | |
| * value slot specified at construction time. | | * value slot specified at construction time. | |
| * | | * | |
| * If a prefix or suffix is specified, this is checked for first, and | | * If a prefix or suffix is specified, this is checked for first, and | |
| * it it doesn't match, this method returns Xapian::BAD_VALUENO. | | * it it doesn't match, this method returns Xapian::BAD_VALUENO. | |
| */ | | */ | |
| Xapian::valueno operator()(std::string &, std::string &); | | Xapian::valueno operator()(std::string &, std::string &); | |
| | | | |
| skipping to change at line 152 | | skipping to change at line 153 | |
| * | | * | |
| * Begin and end must be dates in a recognised format. | | * Begin and end must be dates in a recognised format. | |
| */ | | */ | |
| class XAPIAN_VISIBILITY_DEFAULT DateValueRangeProcessor : public StringValu
eRangeProcessor { | | class XAPIAN_VISIBILITY_DEFAULT DateValueRangeProcessor : public StringValu
eRangeProcessor { | |
| bool prefer_mdy; | | bool prefer_mdy; | |
| int epoch_year; | | int epoch_year; | |
| | | | |
| public: | | public: | |
| /** Constructor. | | /** Constructor. | |
| * | | * | |
|
| * @param valno_ The value number to return from operator(). | | * @param slot_ The value number to return from operator(). | |
| * @param prefer_mdy_ Should ambiguous dates be interpreted as | | * @param prefer_mdy_ Should ambiguous dates be interpreted as | |
| * month/day/year rather than day/month/year? | | * month/day/year rather than day/month/year? | |
| * (default: false) | | * (default: false) | |
| * @param epoch_year_ Year to use as the epoch for dates with 2 digit | | * @param epoch_year_ Year to use as the epoch for dates with 2 digit | |
| * years (default: 1970, so 1/1/69 is 2069 while | | * years (default: 1970, so 1/1/69 is 2069 while | |
| * 1/1/70 is 1970). | | * 1/1/70 is 1970). | |
| */ | | */ | |
|
| DateValueRangeProcessor(Xapian::valueno valno_, bool prefer_mdy_ = fals
e, | | DateValueRangeProcessor(Xapian::valueno slot_, bool prefer_mdy_ = false
, | |
| int epoch_year_ = 1970) | | int epoch_year_ = 1970) | |
|
| : StringValueRangeProcessor(valno_), | | : StringValueRangeProcessor(slot_), | |
| prefer_mdy(prefer_mdy_), epoch_year(epoch_year_) { } | | prefer_mdy(prefer_mdy_), epoch_year(epoch_year_) { } | |
| | | | |
| /** Constructor. | | /** Constructor. | |
| * | | * | |
|
| * @param valno_ The value number to return from operator(). | | * @param slot_ The value number to return from operator(). | |
| * | | * | |
| * @param str_ A string to look for to recognise values as belongi
ng | | * @param str_ A string to look for to recognise values as belongi
ng | |
| * to this date range. | | * to this date range. | |
| * | | * | |
| * @param prefix_ Whether to look for the string at the start or end
of | | * @param prefix_ Whether to look for the string at the start or end
of | |
| * the values. If true, the string is a prefix; if | | * the values. If true, the string is a prefix; if | |
| * false, the string is a suffix (default: true). | | * false, the string is a suffix (default: true). | |
| * | | * | |
| * @param prefer_mdy_ Should ambiguous dates be interpreted as | | * @param prefer_mdy_ Should ambiguous dates be interpreted as | |
| * month/day/year rather than day/month/year? | | * month/day/year rather than day/month/year? | |
| | | | |
| skipping to change at line 202 | | skipping to change at line 203 | |
| * strings are required at the start or end of the strings defining th
e | | * strings are required at the start or end of the strings defining th
e | |
| * range. | | * range. | |
| * | | * | |
| * The remainder of both strings defining the endpoints must be valid | | * The remainder of both strings defining the endpoints must be valid | |
| * dates. | | * dates. | |
| * | | * | |
| * For example, if str_ is "created:" and prefix_ is true, and the ran
ge | | * For example, if str_ is "created:" and prefix_ is true, and the ran
ge | |
| * processor has been added to the queryparser, the queryparser will | | * processor has been added to the queryparser, the queryparser will | |
| * accept "created:1/1/2000..31/12/2001". | | * accept "created:1/1/2000..31/12/2001". | |
| */ | | */ | |
|
| DateValueRangeProcessor(Xapian::valueno valno_, const std::string &str_
, | | DateValueRangeProcessor(Xapian::valueno slot_, const std::string &str_, | |
| bool prefix_ = true, | | bool prefix_ = true, | |
| bool prefer_mdy_ = false, int epoch_year_ = 1970
) | | bool prefer_mdy_ = false, int epoch_year_ = 1970
) | |
|
| : StringValueRangeProcessor(valno_, str_, prefix_), | | : StringValueRangeProcessor(slot_, str_, prefix_), | |
| prefer_mdy(prefer_mdy_), epoch_year(epoch_year_) { } | | prefer_mdy(prefer_mdy_), epoch_year(epoch_year_) { } | |
| | | | |
| /** Check for a valid range of this type. | | /** Check for a valid range of this type. | |
| * | | * | |
| * If BEGIN..END is a sensible date range, this method returns the | | * If BEGIN..END is a sensible date range, this method returns the | |
| * value number of range filter on. Otherwise it returns | | * value number of range filter on. Otherwise it returns | |
| * Xapian::BAD_VALUENO. | | * Xapian::BAD_VALUENO. | |
| */ | | */ | |
| Xapian::valueno operator()(std::string &begin, std::string &end); | | Xapian::valueno operator()(std::string &begin, std::string &end); | |
| }; | | }; | |
| | | | |
| skipping to change at line 228 | | skipping to change at line 229 | |
| * | | * | |
| * This class must be used on values which have been encoded using | | * This class must be used on values which have been encoded using | |
| * Xapian::sortable_serialise() which turns numbers into strings which | | * Xapian::sortable_serialise() which turns numbers into strings which | |
| * will sort in the same order as the numbers (the same values can be | | * will sort in the same order as the numbers (the same values can be | |
| * used to implement a numeric sort). | | * used to implement a numeric sort). | |
| */ | | */ | |
| class XAPIAN_VISIBILITY_DEFAULT NumberValueRangeProcessor : public StringVa
lueRangeProcessor { | | class XAPIAN_VISIBILITY_DEFAULT NumberValueRangeProcessor : public StringVa
lueRangeProcessor { | |
| public: | | public: | |
| /** Constructor. | | /** Constructor. | |
| * | | * | |
|
| * @param valno_ The value number to return from operator(). | | * @param slot_ The value number to return from operator(). | |
| */ | | */ | |
|
| NumberValueRangeProcessor(Xapian::valueno valno_) | | NumberValueRangeProcessor(Xapian::valueno slot_) | |
| : StringValueRangeProcessor(valno_) { } | | : StringValueRangeProcessor(slot_) { } | |
| | | | |
| /** Constructor. | | /** Constructor. | |
| * | | * | |
|
| * @param valno_ The value number to return from operator(). | | * @param slot_ The value number to return from operator(). | |
| * | | * | |
| * @param str_ A string to look for to recognise values as belongi
ng | | * @param str_ A string to look for to recognise values as belongi
ng | |
| * to this numeric range. | | * to this numeric range. | |
| * | | * | |
| * @param prefix_ Whether to look for the string at the start or end
of | | * @param prefix_ Whether to look for the string at the start or end
of | |
| * the values. If true, the string is a prefix; if | | * the values. If true, the string is a prefix; if | |
| * false, the string is a suffix (default: true). | | * false, the string is a suffix (default: true). | |
| * | | * | |
| * The string supplied in str_ is used by @a operator() to decide whet
her | | * The string supplied in str_ is used by @a operator() to decide whet
her | |
| * the pair of strings supplied to it constitute a valid range. If | | * the pair of strings supplied to it constitute a valid range. If | |
| | | | |
| skipping to change at line 265 | | skipping to change at line 266 | |
| * The remainder of both strings defining the endpoints must be valid | | * The remainder of both strings defining the endpoints must be valid | |
| * floating point numbers. (FIXME: define format recognised). | | * floating point numbers. (FIXME: define format recognised). | |
| * | | * | |
| * For example, if str_ is "$" and prefix_ is true, and the range | | * For example, if str_ is "$" and prefix_ is true, and the range | |
| * processor has been added to the queryparser, the queryparser will | | * processor has been added to the queryparser, the queryparser will | |
| * accept "$10..50" or "$10..$50", but not "10..50" or "10..$50" as va
lid | | * accept "$10..50" or "$10..$50", but not "10..50" or "10..$50" as va
lid | |
| * ranges. If str_ is "kg" and prefix_ is false, the queryparser will | | * ranges. If str_ is "kg" and prefix_ is false, the queryparser will | |
| * accept "10..50kg" or "10kg..50kg", but not "10..50" or "10kg..50" a
s | | * accept "10..50kg" or "10kg..50kg", but not "10..50" or "10kg..50" a
s | |
| * valid ranges. | | * valid ranges. | |
| */ | | */ | |
|
| NumberValueRangeProcessor(Xapian::valueno valno_, const std::string &st
r_, | | NumberValueRangeProcessor(Xapian::valueno slot_, const std::string &str
_, | |
| bool prefix_ = true) | | bool prefix_ = true) | |
|
| : StringValueRangeProcessor(valno_, str_, prefix_) { } | | : StringValueRangeProcessor(slot_, str_, prefix_) { } | |
| | | | |
| /** Check for a valid range of this type. | | /** Check for a valid range of this type. | |
| * | | * | |
| * If BEGIN..END is a valid numeric value range, and has the | | * If BEGIN..END is a valid numeric value range, and has the | |
| * appropriate prefix or suffix (if specified) required for this | | * appropriate prefix or suffix (if specified) required for this | |
| * NumberValueRangeProcessor, this method returns the value number of | | * NumberValueRangeProcessor, this method returns the value number of | |
| * range filter on, and sets begin and end to the appropriate serialis
ed | | * range filter on, and sets begin and end to the appropriate serialis
ed | |
| * values needed to delimit the range. Otherwise it returns | | * values needed to delimit the range. Otherwise it returns | |
| * Xapian::BAD_VALUENO. | | * Xapian::BAD_VALUENO. | |
| */ | | */ | |
| | | | |
| skipping to change at line 449 | | skipping to change at line 450 | |
| | | | |
| /** Specify the database being searched. | | /** Specify the database being searched. | |
| * | | * | |
| * The database is used for wildcard expansion (FLAG_WILDCARD and | | * The database is used for wildcard expansion (FLAG_WILDCARD and | |
| * FLAG_PARTIAL), spelling correction (FLAG_SPELLING_CORRECTION), and | | * FLAG_PARTIAL), spelling correction (FLAG_SPELLING_CORRECTION), and | |
| * synonyms (FLAG_SYNONYM, FLAG_AUTO_SYNONYMS, and | | * synonyms (FLAG_SYNONYM, FLAG_AUTO_SYNONYMS, and | |
| * FLAG_AUTO_MULTIWORD_SYNONYMS). | | * FLAG_AUTO_MULTIWORD_SYNONYMS). | |
| */ | | */ | |
| void set_database(const Database &db); | | void set_database(const Database &db); | |
| | | | |
|
| | | /** Specify the maximum expansion of a wildcard term. | |
| | | * | |
| | | * Note: you must also set FLAG_WILDCARD for wildcard expansion to hap | |
| | | pen. | |
| | | * | |
| | | * @param limit The maximum number of terms each wildcard in the que | |
| | | ry | |
| | | * can expand to, or 0 for no limit (which is the defau | |
| | | lt). | |
| | | */ | |
| | | void set_max_wildcard_expansion(Xapian::termcount limit); | |
| | | | |
| /** Parse a query. | | /** Parse a query. | |
| * | | * | |
| * @param query_string A free-text query as entered by a user | | * @param query_string A free-text query as entered by a user | |
| * @param flags Zero or more Query::feature_flag specifying | | * @param flags Zero or more Query::feature_flag specifying | |
| * what features the QueryParser should support. Combine | | * what features the QueryParser should support. Combine | |
| * multiple values with bitwise-or (|) (default FLAG_DEFAULT). | | * multiple values with bitwise-or (|) (default FLAG_DEFAULT). | |
| * @param default_prefix The default term prefix to use (default none)
. | | * @param default_prefix The default term prefix to use (default none)
. | |
| * For example, you can pass "A" when parsing an "Author" field
. | | * For example, you can pass "A" when parsing an "Author" field
. | |
| * | | * | |
| * @exception If the query string can't be parsed, then | | * @exception If the query string can't be parsed, then | |
| | | | |
| skipping to change at line 571 | | skipping to change at line 581 | |
| * @param exclusive If true, each document can have at most one value
of | | * @param exclusive If true, each document can have at most one value
of | |
| * the field, so Xapian should combine multiple values | | * the field, so Xapian should combine multiple values | |
| * with OP_OR. If false, each document can have multi
ple | | * with OP_OR. If false, each document can have multi
ple | |
| * values of the field, so Xapian combine them with | | * values of the field, so Xapian combine them with | |
| * OP_AND, as we would with filters with different | | * OP_AND, as we would with filters with different | |
| * prefixes. [default: true] | | * prefixes. [default: true] | |
| */ | | */ | |
| void add_boolean_prefix(const std::string &field, const std::string &pr
efix, | | void add_boolean_prefix(const std::string &field, const std::string &pr
efix, | |
| bool exclusive); | | bool exclusive); | |
| | | | |
|
| /* FIXME:1.1.3: Merge two versions into one with optional parameter | | /* FIXME:1.3: Merge two versions into one with optional parameter | |
| * "exclusive", default true. */ | | * "exclusive", default true. */ | |
| void add_boolean_prefix(const std::string &field, const std::string &pr
efix); | | void add_boolean_prefix(const std::string &field, const std::string &pr
efix); | |
| | | | |
| /// Iterate over terms omitted from the query as stopwords. | | /// Iterate over terms omitted from the query as stopwords. | |
| TermIterator stoplist_begin() const; | | TermIterator stoplist_begin() const; | |
| TermIterator stoplist_end() const { | | TermIterator stoplist_end() const { | |
| return TermIterator(NULL); | | return TermIterator(NULL); | |
| } | | } | |
| | | | |
| /// Iterate over unstemmed forms of the given (stemmed) term used in th
e query. | | /// Iterate over unstemmed forms of the given (stemmed) term used in th
e query. | |
| | | | |
End of changes. 19 change blocks. |
| 20 lines changed or deleted | | 33 lines changed or added | |
|