[Xapian-discuss] How to search documents with certain values
abhinay.mehta at gmail.com
Mon May 24 10:06:17 BST 2010
I was wrong about how I was storing the date in the document value. I am
storing it as the string: YYYYMMDD
I've tested it and can use Xapian::DateValueRangeProcessor by appending the
range string: YYYYMMDD..YYYYMMDD to the user query myself.
Not sure if that's too much of a cow-boy way of doing it.
Will test out the Xapian::Query::OP_VALUE_GE method later today.
Also would anyone know about the performance difference between the two
On 24 May 2010 05:34, Olly Betts <olly at survex.com> wrote:
> On Sat, May 22, 2010 at 07:00:08PM +0100, Abhinay Mehta wrote:
> > I am creating Xapian documents and adding a unix timestamp to each
> > as a value using the doc.add_value method.
> > When I search my Xapian database, I want the option to only search
> > with a timestamp within the last year.
> > Is there a way to search across documents with a value greater than a
> > specified value string? Or is there a better way of doing something like
> > this?
> Filter your query with OP_VALUE_GE:
> In C++, augment your query like so:
> Xapian::Query filter(Xapian::Query::OP_VALUE_GE, threshold_value);
> query = Xapian::Query(Xapian::Query::OP_FILTER, query, filter);
> Note that the ordering uses a string comparison, so you need to pad your
> timestamps to a fixed width, or else encode them suitably (e.g. see
> If you want the user to be able to specify date ranges in the query string,
> see Xapian::DateValueRangeProcessor:
More information about the Xapian-discuss