Hi,

it seems to be necessary to actually call notmuch_threads_get (threads)
to move the thread iterator from a query object, just calling
notmuch_threads_move_to_next (..) is not enough:

```

notmuch_query_t *query;
notmuch_threads_t *threads;
notmuch_thread_t *thread;

query = notmuch_query_create (database, query_string);
threads = notmuch_query_search_threads (query);

int i = 0;

for (;
    notmuch_threads_valid (threads);
    notmuch_threads_move_to_next (threads))
{
   /*
    * with this line commented out the iterator seems to remain in
    * place, and if I below do another loop it will start from the
    * beginning.

   thread = notmuch_threads_get (threads);
   ....
   notmuch_thread_destroy (thread);
   */

   i++;
   if (i > 100) break;
}

for (;
    notmuch_threads_valid (threads);
    notmuch_threads_move_to_next (threads))
{
   /* the thread acquired here will be the first thread in the query.
    * it should be the 101th. */

   thread = notmuch_threads_get (threads);
   ....
   notmuch_thread_destroy (thread);

}


notmuch_query_destroy (query);
```

It is quite slow to skip the threads in this way, might it be faster if
move_to_next works correctly?

Regards, Gaute

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

Reply via email to