Re: [notmuch] [PATCHv2] Preserve folder information when indexing

2010-02-03 Thread Sebastian Spaeth
On Tue, 2 Feb 2010 23:25:18 +0100, Michal Sojka sojk...@fel.cvut.cz wrote:
 I want it to work the same way as you expected. It seems it would be 
 necessary 
 to modify notmuch_database_remove_message() so that it changes folder term if 
 it detects rename.

On a tangetial issue: It would help if notmuch were able to set an
(optional) flag when detecting a rename. Similar on how it should set
new on new messages, a moved tag or whatever would make parsing with
3rd party apps much nicer.

E.g. my folder-to-tag syncer could then just look for moved mails and my
MailDirflag-to-notmuchtag syncer could then limit its search also to
moved mails, which would be much more efficient.

What do people think?
Basically what I want is:

notmuch.conf:
tag-for-new=inbox unread notspamchecked whatnothere
tag-for-moved=moved

Does this make sense?

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


Re: [notmuch] [PATCHv2] Preserve folder information when indexing

2010-02-02 Thread Jameson Rollins
On Tue,  2 Feb 2010 16:01:08 +0100, Michal Sojka sojk...@fel.cvut.cz wrote:
 Stores the folder (directory name) of the message in the database as a
 term with folder prefix.
 
 This patch was originally sent by Andreas Klöckner. The differences
 from the original patch are:
 - Folder name is taken from strings generated during travesal. It no
   longer uses glib nor it allocates additional memory to determine the
   base name. The same approach as in
   id:87fx8bygi7@linux.vnet.ibm.com was used.
 - Removed unrelated change which was submitted separately as
   id:1264691584-8290-2-git-send-email-sojk...@fel.cvut.cz
 - Changed the comment describing database schema.
 
 TODO (see the previous Carl's email):
 - Support hierarchical folders

Hey, Michal.  Thank you very much for this patch!  This is right on with
what I mentioned as high-priority improvements.

I just gave it a try, though, and it seemed to be behaving a little
strangely.  I currently have two subdirectories, inbox and sent.
However, new mail to either directory was showing up under the search:

notmuch search folder:inbox

and nothing was showing up under the search:

notmuch search folder:sent

I wonder if there's a problem with the logic it uses to determine the
folder naming?  Do you think you could look into this?  I would really
like to push to have a patch like this applied upstream soon.

jamie.


pgpKbQazQwZuL.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [notmuch] [PATCHv2] Preserve folder information when indexing

2010-02-02 Thread Jameson Rollins
On Tue, 02 Feb 2010 11:20:02 -0500, Jameson Rollins 
jroll...@finestructure.net wrote:
 I just gave it a try, though, and it seemed to be behaving a little
 strangely.  I currently have two subdirectories, inbox and sent.
 However, new mail to either directory was showing up under the search:
 
 notmuch search folder:inbox
 
 and nothing was showing up under the search:
 
 notmuch search folder:sent
 
 I wonder if there's a problem with the logic it uses to determine the
 folder naming?  Do you think you could look into this?  I would really
 like to push to have a patch like this applied upstream soon.

I think I was wrong about this.  It looks like I'm seeing a different
issue that may not be related.  As a test I was sending mail to myself,
which meant that it was showing up in both inbox *and* sent, and it
looks like in the face of an email in duplicate directories, the inbox
was winning.  Mail sent to not me is showing up under folder:sent just
fine.  So I think this is working!

jamie.


pgppBV7PlhTM4.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [notmuch] [PATCHv2] Preserve folder information when indexing

2010-02-02 Thread Arvid Picciani
On Tue,  2 Feb 2010 16:01:08 +0100, Michal Sojkasojk...@fel.cvut.cz 
wrote:



Stores the folder (directory name) of the message in the database as a
term with folder prefix.


unfortunately it doesnt do anything here :/
i rebuilt the entire index, but no folder: field is added.
can anyone who got it working tell me their directory layout?
mine would be something like:

/media/mail/mail
├── cur
│   ├── 1265050537.H891745P1231.samir.ibcsolutions.de:2,S
│   ├── 1265050572.H419259P1443.samir.ibcsolutions.de:2,S
│   ├── 1265050598.H121639P1634.samir.ibcsolutions.de:2,S
│   ├── 1265050617.H309805P1774.samir.ibcsolutions.de:2,S
│   ├── 1265050625.H818906P1838.samir.ibcsolutions.de:2,S
│   ├── 1265050955.H593083P2020.samir.ibcsolutions.de:2,S

[...]
├── .list.bla
[...]
├── .list.foo
[...]
├── .list.unknown
│   ├── cur
│   │   └── 1265050581.H226772P1509.samir.ibcsolutions.de:2,
│   ├── dovecot.index.cache
│   ├── dovecot.index.log
│   ├── dovecot-uidlist
│   ├── new
│   └── tmp
├── new
├── .notmuch
│   └── xapian
│   ├── flintlock
│   ├── iamchert
│   ├── position.baseA
│   ├── position.baseB
│   ├── position.DB
│   ├── postlist.baseA
│   ├── postlist.baseB
│   ├── postlist.DB
│   ├── record.baseA
│   ├── record.baseB
│   ├── record.DB
│   ├── termlist.baseA
│   ├── termlist.baseB
│   └── termlist.DB
├── .Sent
│   ├── cur
│   │   ├── 1262650675.00.mbox:2,S
│   │   ├── 1262650675.01.mbox:2,S
│   │   ├── 1262650675.02.mbox:2,S

[...]
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [notmuch] [PATCHv2] Preserve folder information when indexing

2010-02-02 Thread Jameson Rollins
On Tue, 02 Feb 2010 18:48:25 +0100, Arvid Picciani a...@exys.org wrote:
 On Tue,  2 Feb 2010 16:01:08 +0100, Michal Sojkasojk...@fel.cvut.cz 
 wrote:
 unfortunately it doesnt do anything here :/
 i rebuilt the entire index, but no folder: field is added.
 can anyone who got it working tell me their directory layout?
 mine would be something like:

What search terms are you using?  You shouldn't consider the cur/new/tmp
maildir subdirectories in the folder naming.  Those are fundamental
parts of maildirs.  You would want to look at the maildir name itself.

I'm starting to think that maybe the folder: field is not the right way
to do this, though.  What if a message moves?  Only new mails are having
this field modified, so if messages are moved that field is not
modified, and since it's being added as part of the message (like
subject:) it's not modifiable.  It also can't be added down the line
to messages that don't already have it.  I'm going back to my original
suggestion, which was that the configuration should state tag that
should be added for messages in certain folders.

jamie.


pgpmyu5FS5VtE.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [notmuch] [PATCHv2] Preserve folder information when indexing

2010-02-02 Thread Arvid Picciani

It's all the dots fault.   it works just fine with folders not beginning
with .

On Tue, 02 Feb 2010 13:22:29 -0500, Jameson Rollins 
jroll...@finestructure.net wrote:
 I'm going back to my original
 suggestion, which was that the configuration should state tag that
 should be added for messages in certain folders.

well that would be almost what i want. My folders are autogenerated by a
generic list filter, and i'd be to lazy to check regulary for new
folders.
But tags are the proper solution here imo.
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [notmuch] [PATCHv2] Preserve folder information when indexing

2010-02-02 Thread Michal Sojka
On Tuesday 02 February 2010 18:48:25 Arvid Picciani wrote:
 On Tue,  2 Feb 2010 16:01:08 +0100, Michal Sojkasojk...@fel.cvut.cz
 
 wrote:
  Stores the folder (directory name) of the message in the database as a
  term with folder prefix.

Hi,

I've just made several experiments. I tested both Maildir layout (your case)
and non-Maildir layout and both layouts work correctly.

Then I tried to create notmuch database without this patch and then add new 
mails
and run notmuch new with the patch. It seems that in that case no folder terms
are added to the database. 

Probably DATABASE_VERSION should be increased by this patch, but I do not want
to do it until it is clear that this patch will be merged. Otherwise, there 
might be collision with other patches.
 
 unfortunately it doesnt do anything here :/
 i rebuilt the entire index, but no folder: field is added.

How did you rebuild it? I deleted the .notmuch directory and run notmuch new.

 can anyone who got it working tell me their directory layout?
 mine would be something like:

If the above didn't help, try to apply this patch. If you see your folder names
during notmuch new, it should work.

Michal

 8 --
diff --git a/lib/database.cc b/lib/database.cc
index ba2aa16..a22e226 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -1436,6 +1436,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
date = notmuch_message_file_get_header (message_file, date);
_notmuch_message_set_date (message, date);
 
+   printf(folder=%s\n, folder_name);
if (folder_name != NULL)
_notmuch_message_gen_terms (message, folder, folder_name);
 

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


Re: [notmuch] [PATCHv2] Preserve folder information when indexing

2010-02-02 Thread Michal Sojka
On Tuesday 02 February 2010 22:31:38 micah anderson wrote:
 On Tue, 02 Feb 2010 13:22:29 -0500, Jameson Rollins 
jroll...@finestructure.net wrote:
  I'm starting to think that maybe the folder: field is not the right way
  to do this, though.  What if a message moves?
 
 The easiest way to answer this question is to try it. I did that, and
 things didn't work as expected. I expected that once the message was
 moved to a different folder, and 'notmuch new' was run, then the folder
 search result would move with the message move.

I want it to work the same way as you expected. It seems it would be necessary 
to modify notmuch_database_remove_message() so that it changes folder term if 
it detects rename.

I guess it should be possible. If tags can be modified then folder terms can 
be modified as well.

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


Re: [notmuch] [PATCHv2] Preserve folder information when indexing

2010-02-02 Thread Jameson Rollins
On Tue, 2 Feb 2010 23:25:18 +0100, Michal Sojka sojk...@fel.cvut.cz wrote:
 On Tuesday 02 February 2010 22:31:38 micah anderson wrote:
  The easiest way to answer this question is to try it. I did that, and
  things didn't work as expected. I expected that once the message was
  moved to a different folder, and 'notmuch new' was run, then the folder
  search result would move with the message move.
 
 I want it to work the same way as you expected. It seems it would be 
 necessary 
 to modify notmuch_database_remove_message() so that it changes folder term if 
 it detects rename.

Hey, Michal.  I agree that this is a necessary improvement.  It would
also be nice if messages that don't currently have the field have it
added, whether or not they're in the database to begin with.  This is
important for getting the field on messages that are already in the
database.

jamie.


pgp7LqiIcYs9p.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [notmuch] [PATCHv2] Preserve folder information when indexing

2010-02-02 Thread Sebastian Spaeth
 /media/mail/mail
 ├── cur
 │   ├── 1265050537.H891745P1231.samir.ibcsolutions.de:2,S
 │   ├── 1265050572.H419259P1443.samir.ibcsolutions.de:2,S
 │   ├── 1265050598.H121639P1634.samir.ibcsolutions.de:2,S
 │   ├── 1265050617.H309805P1774.samir.ibcsolutions.de:2,S
 │   ├── 1265050625.H818906P1838.samir.ibcsolutions.de:2,S
 │   ├── 1265050955.H593083P2020.samir.ibcsolutions.de:2,S

A related question, currently notmuch seems to store the full absolute
path to mails, but I remeber seeing some documentation saying that it's
either absolute or relative to the xapian db dir. Is that correct, or is
it reasonable to assume absolute directories (as e.g. notmuchsync
currently does).

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