On Fri, 18 Dec 2009 21:21:03 +0000, James Westby <jw+deb...@jameswestby.net> 
wrote:
>   Here's the first part, storing the filesize. I'm using
>   add_value so that we can make it sortable, is that valid
>   for retrieving it as well?

Yes, a value makes sense here and should make the value easy to
retrieve.

>   The only thing I'm not sure about is if it works. Is there
>   a way to inspect a document to see the values that are
>   stored?

I usually use a little tool I wrote called xapian-dump. It currently
exists only in the git history of notmuch. Look at commit:

        22691064666c03c5e76bc787395bfe586929f4cc

or so.

> Doing a search isn't working, so I imagine I made a mistake.

Let's see... (just reviewing here, not testing)..

> +struct FilesizeValueRangeProcessor : public Xapian::ValueRangeProcessor {
> +    FilesizeValueRangeProcessor() {}
> +
> +    Xapian::valueno operator()(std::string &begin, std::string &) {
> +        if (begin.substr(0, 9) != "filesize:")
> +            return Xapian::BAD_VALUENO;
> +        begin.erase(0, 9);
> +        return NOTMUCH_VALUE_FILESIZE;
> +    }
> +};

If the file size is just an integer, then you shouldn't need a custom
ValueRangeProcessor. One of the existing processors in Xapian should
work fine.

Having not ever written a custom processor, I can't say whether the one
above is correct or not.

-Carl

Attachment: pgp7QrUqZ9sn5.pgp
Description: PGP signature

_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to