unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* problem with folder: search in python bindings
@ 2011-03-15 18:30 Jameson Rollins
  2011-03-16  9:25 ` Sebastian Spaeth
  0 siblings, 1 reply; 11+ messages in thread
From: Jameson Rollins @ 2011-03-15 18:30 UTC (permalink / raw)
  To: Notmuch Mail


[-- Attachment #1.1: Type: text/plain, Size: 1365 bytes --]

Hey, folks.  I'm seeing something peculiar with the python bindings.
It seems that I am not able to get any results when doing "folder:"
searches with the python bindings.  I'm using a version of notmuch that
includes the folder index patch.

Attached is a script that demonstrates the problem.  It generates a test
repository, then does a couple of searches over it.  When running the
script, I get the following output:

0$ ./python-folder-search-test
Found 2 total files (that's not much mail).
Note: Ignoring non-mail file: /home/jrollins/tmp/tmp.1dMO5vnweJ/config
Processed 2 total files in almost no time.
Added 1 new message to the database.
== notmuch search '*':
thread:0000000000000001  Yest. 23:26 [1/1] Jameson Rollins; python documentation (inbox signed unread)
== notmuch search 'folder:sent':
thread:0000000000000001  Yest. 23:26 [1/1] Jameson Rollins; python documentation (inbox signed unread)
== python search '*':
Jameson Rollins <jrollins@finestructure.net> (2011-03-14) (inbox signed unread) (-1) replies
== python search 'folder:sent':
0$ 

You can see that cli notmuch returns search results when searching for
"folder:sent".  The python bindings, on the other hand, return nothing.

Anyone have any idea what could be going on here?  I'm not familiar with
how the python bindings work, unfortunately.

jamie.


[-- Attachment #1.2: script to test python folder: search --]
[-- Type: application/octet-stream, Size: 742 bytes --]

#!/bin/bash

dir=$(mktemp -d)
trap "rm -rf $dir" EXIT

mkdir "$dir"/sent

notmuch search --output=files to:notmuch from:jrollins \
    | head -1 \
    | xargs -I'{}' cp '{}' "$dir"/sent/

export NOTMUCH_CONFIG="$dir"/config

cat <<EOF >"$NOTMUCH_CONFIG"
[database]
path=$dir
EOF

notmuch new

echo "== notmuch search '*':"
notmuch search '*'

echo "== notmuch search 'folder:sent':"
notmuch search 'folder:sent'

echo "== python search '*':"
python -c "import notmuch
db = notmuch.Database()
q = notmuch.Query(db, '*')
for msg in q.search_messages():
    print msg
"

echo "== python search 'folder:sent':"
python -c "import notmuch
db = notmuch.Database()
q = notmuch.Query(db, 'folder:sent')
for msg in q.search_messages():
    print msg
"

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-03-22 16:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-15 18:30 problem with folder: search in python bindings Jameson Rollins
2011-03-16  9:25 ` Sebastian Spaeth
2011-03-17 16:19   ` Jameson Rollins
2011-03-21 15:29     ` Sebastian Spaeth
2011-03-21 16:32       ` Jameson Rollins
2011-03-21 16:45         ` Jesse Rosenthal
2011-03-21 17:34           ` Jameson Rollins
2011-03-21 17:42             ` Jesse Rosenthal
2011-03-21 18:01               ` Jameson Rollins
2011-03-22  9:35                 ` Sebastian Spaeth
2011-03-22 16:32                   ` Jameson Rollins

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).