trouble searching with unix timestamps

classic Classic list List threaded Threaded
5 messages Options
Matthew Lear Matthew Lear
Reply | Threaded
Open this post in threaded view
|

trouble searching with unix timestamps

Hi. I've noticed that I'm unable to notmuch search using date with unix timestamps (ie number of seconds since Jan 1st 1970 UTC). I get a xapian error. The notmuch man pages state that searching using 'date:<initial-timestamp>..<final-timestamp>' where "each timestamp is a number representing the number of seconds since 1970-01-01 00:00:00 UTC" is supported, so I'm wondering what's wrong with my installation.

* notmuch config get built_with.field_processor
true
* xapian-config - xapian-core 1.4.4
* notmuch 0.26+8~ga727e7d

Here's an example:

# date +%s
1517238733

# date -d @1517238733
Mon Jan 29 15:12:13 GMT 2018

# date -d @1517152333
Sun Jan 28 15:12:13 GMT 2018


# notmuch search date:1517152333..1517238733
notmuch search: A Xapian exception occurred
A Xapian exception occurred parsing query: Didn't understand date specification '1517152333..1517238733'
Query string was: date:1517152333..1517238733

Yet I can do:

# notmuch search date:yesterday..today
or
# notmuch search date:1/28/2018..1/29/2018
or
# notmuch search date:20180128..20180129

..and all show 216 results.

Any thoughts as to why Xapian doesn't like this type of query? Is it just me? :-)

Thanks,
--  Matt

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Jani Nikula Jani Nikula
Reply | Threaded
Open this post in threaded view
|

Re: trouble searching with unix timestamps

On Mon, 29 Jan 2018, Matthew Lear <[hidden email]> wrote:
> Hi. I've noticed that I'm unable to notmuch search using date with unix
> timestamps (ie number of seconds since Jan 1st 1970 UTC). I get a xapian
> error. The notmuch man pages state that searching using
> 'date:<initial-timestamp>..<final-timestamp>'
> where "each timestamp is a number representing the number of seconds since
> 1970-01-01 00:00:00 UTC" is supported, so I'm wondering what's wrong with
> my installation.

The man page could use some clarification.

The <initial-timestamp>..<final-timestamp> syntax predates the date:
prefix, and needs to be given as-is:

$ notmuch search 1517152333..1517238733

Alternatively, you can use @<timestamp> in date: queries, although this
seems to be completely undocumented:

$ notmuch search date:@1517152333..@1517238733

HTH,
Jani.
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Matthew Lear Matthew Lear
Reply | Threaded
Open this post in threaded view
|

Re: trouble searching with unix timestamps

Wonderful! Thanks Jani.

> Alternatively, you can use @<timestamp> in date: queries, although this
> seems to be completely undocumented:

I guess this relates to similar syntax requirements of date -d in that a unix timestamp is required to be preceded by an @

# date -d 1517152333
date: invalid date ‘1517152333’
# date -d @1517152333
Sun Jan 28 15:12:13 GMT 2018

On Mon, Jan 29, 2018 at 4:03 PM, Jani Nikula <[hidden email]> wrote:
On Mon, 29 Jan 2018, Matthew Lear <[hidden email]> wrote:
> Hi. I've noticed that I'm unable to notmuch search using date with unix
> timestamps (ie number of seconds since Jan 1st 1970 UTC). I get a xapian
> error. The notmuch man pages state that searching using
> 'date:<initial-timestamp>..<final-timestamp>'
> where "each timestamp is a number representing the number of seconds since
> 1970-01-01 00:00:00 UTC" is supported, so I'm wondering what's wrong with
> my installation.

The man page could use some clarification.

The <initial-timestamp>..<final-timestamp> syntax predates the date:
prefix, and needs to be given as-is:

$ notmuch search 1517152333..1517238733

Alternatively, you can use @<timestamp> in date: queries, although this
seems to be completely undocumented:

$ notmuch search date:@1517152333..@1517238733

HTH,
Jani.


_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Daniel Kahn Gillmor Daniel Kahn Gillmor
Reply | Threaded
Open this post in threaded view
|

Re: trouble searching with unix timestamps

On Mon 2018-01-29 16:13:38 +0000, Matthew Lear wrote:
> [ Jani wrote: ]
>> Alternatively, you can use @<timestamp> in date: queries, although this
>> seems to be completely undocumented:
>
> I guess this relates to similar syntax requirements of date -d in that a
> unix timestamp is required to be preceded by an @

agreed, it seems in line with that.

Matthew, since you've been reading the docs there most recently, maybe
you'd be up for sending a patch to make sure this feature is findable in
the documentation?

    --dkg
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Matthew Lear Matthew Lear
Reply | Threaded
Open this post in threaded view
|

Re: trouble searching with unix timestamps

Sure thing. Just done it now.

On Wed, Jan 31, 2018 at 3:04 AM, Daniel Kahn Gillmor <[hidden email]> wrote:
On Mon 2018-01-29 16:13:38 +0000, Matthew Lear wrote:
> [ Jani wrote: ]
>> Alternatively, you can use @<timestamp> in date: queries, although this
>> seems to be completely undocumented:
>
> I guess this relates to similar syntax requirements of date -d in that a
> unix timestamp is required to be preceded by an @

agreed, it seems in line with that.

Matthew, since you've been reading the docs there most recently, maybe
you'd be up for sending a patch to make sure this feature is findable in
the documentation?

    --dkg


_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch