mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
lib/query: Drop the first and max_messages arguments from search_messages.
These only existed to support the chunky-searching hack, but that was recently dropped anyway.
This commit is contained in:
parent
ba3554b804
commit
94eb9aacd4
6 changed files with 9 additions and 22 deletions
|
@ -361,14 +361,6 @@ notmuch_query_search_threads (notmuch_query_t *query);
|
||||||
* messages object is owned by the query and as such, will only be
|
* messages object is owned by the query and as such, will only be
|
||||||
* valid until notmuch_query_destroy.
|
* valid until notmuch_query_destroy.
|
||||||
*
|
*
|
||||||
* The 'first' and 'max_messages' arguments can be used to obtain
|
|
||||||
* partial results from the search. For example, to get results 10 at
|
|
||||||
* a time, pass 'max_messages' as 10 and for 'first' pass the values
|
|
||||||
* 0, 10, 20, etc. As a special case, a value of -1 for 'max_messages'
|
|
||||||
* indicates that no limiting is to be performed. So a search with
|
|
||||||
* 'first' == 0 and 'max_messages' == -1 will return the complete
|
|
||||||
* results of the search.
|
|
||||||
*
|
|
||||||
* Typical usage might be:
|
* Typical usage might be:
|
||||||
*
|
*
|
||||||
* notmuch_query_t *query;
|
* notmuch_query_t *query;
|
||||||
|
@ -401,8 +393,7 @@ notmuch_query_search_threads (notmuch_query_t *query);
|
||||||
* reason to call it if the query is about to be destroyed).
|
* reason to call it if the query is about to be destroyed).
|
||||||
*/
|
*/
|
||||||
notmuch_messages_t *
|
notmuch_messages_t *
|
||||||
notmuch_query_search_messages (notmuch_query_t *query,
|
notmuch_query_search_messages (notmuch_query_t *query);
|
||||||
int first, int max_messages);
|
|
||||||
|
|
||||||
/* Destroy a notmuch_query_t along with any associated resources.
|
/* Destroy a notmuch_query_t along with any associated resources.
|
||||||
*
|
*
|
||||||
|
|
10
lib/query.cc
10
lib/query.cc
|
@ -76,9 +76,7 @@ notmuch_query_set_sort (notmuch_query_t *query, notmuch_sort_t sort)
|
||||||
}
|
}
|
||||||
|
|
||||||
notmuch_messages_t *
|
notmuch_messages_t *
|
||||||
notmuch_query_search_messages (notmuch_query_t *query,
|
notmuch_query_search_messages (notmuch_query_t *query)
|
||||||
int first,
|
|
||||||
int max_messages)
|
|
||||||
{
|
{
|
||||||
notmuch_database_t *notmuch = query->notmuch;
|
notmuch_database_t *notmuch = query->notmuch;
|
||||||
const char *query_string = query->query_string;
|
const char *query_string = query->query_string;
|
||||||
|
@ -130,9 +128,7 @@ notmuch_query_search_messages (notmuch_query_t *query,
|
||||||
|
|
||||||
enquire.set_query (final_query);
|
enquire.set_query (final_query);
|
||||||
|
|
||||||
if (max_messages == -1)
|
mset = enquire.get_mset (0, notmuch->xapian_db->get_doccount ());
|
||||||
max_messages = notmuch->xapian_db->get_doccount ();
|
|
||||||
mset = enquire.get_mset (first, max_messages);
|
|
||||||
|
|
||||||
for (i = mset.begin (); i != mset.end (); i++) {
|
for (i = mset.begin (); i != mset.end (); i++) {
|
||||||
notmuch_message_t *message;
|
notmuch_message_t *message;
|
||||||
|
@ -186,7 +182,7 @@ notmuch_query_search_threads (notmuch_query_t *query)
|
||||||
threads->threads = g_hash_table_new_full (g_str_hash, g_str_equal,
|
threads->threads = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||||
free, NULL);
|
free, NULL);
|
||||||
|
|
||||||
threads->messages = notmuch_query_search_messages (query, 0, -1);
|
threads->messages = notmuch_query_search_messages (query);
|
||||||
|
|
||||||
threads->thread_id = NULL;
|
threads->thread_id = NULL;
|
||||||
|
|
||||||
|
|
|
@ -260,7 +260,7 @@ _notmuch_thread_create (void *ctx,
|
||||||
|
|
||||||
notmuch_query_set_sort (thread_id_query, NOTMUCH_SORT_OLDEST_FIRST);
|
notmuch_query_set_sort (thread_id_query, NOTMUCH_SORT_OLDEST_FIRST);
|
||||||
|
|
||||||
for (messages = notmuch_query_search_messages (thread_id_query, 0, -1);
|
for (messages = notmuch_query_search_messages (thread_id_query);
|
||||||
notmuch_messages_has_more (messages);
|
notmuch_messages_has_more (messages);
|
||||||
notmuch_messages_advance (messages))
|
notmuch_messages_advance (messages))
|
||||||
{
|
{
|
||||||
|
@ -271,7 +271,7 @@ _notmuch_thread_create (void *ctx,
|
||||||
|
|
||||||
notmuch_query_destroy (thread_id_query);
|
notmuch_query_destroy (thread_id_query);
|
||||||
|
|
||||||
for (messages = notmuch_query_search_messages (matched_query, 0, -1);
|
for (messages = notmuch_query_search_messages (matched_query);
|
||||||
notmuch_messages_has_more (messages);
|
notmuch_messages_has_more (messages);
|
||||||
notmuch_messages_advance (messages))
|
notmuch_messages_advance (messages))
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,7 +58,7 @@ notmuch_dump_command (unused (void *ctx), int argc, char *argv[])
|
||||||
output = stdout;
|
output = stdout;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (messages = notmuch_query_search_messages (query, 0, -1);
|
for (messages = notmuch_query_search_messages (query);
|
||||||
notmuch_messages_has_more (messages);
|
notmuch_messages_has_more (messages);
|
||||||
notmuch_messages_advance (messages))
|
notmuch_messages_advance (messages))
|
||||||
{
|
{
|
||||||
|
|
|
@ -234,7 +234,7 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (messages = notmuch_query_search_messages (query, 0, -1);
|
for (messages = notmuch_query_search_messages (query);
|
||||||
notmuch_messages_has_more (messages);
|
notmuch_messages_has_more (messages);
|
||||||
notmuch_messages_advance (messages))
|
notmuch_messages_advance (messages))
|
||||||
{
|
{
|
||||||
|
|
|
@ -105,7 +105,7 @@ notmuch_tag_command (void *ctx, unused (int argc), unused (char *argv[]))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (messages = notmuch_query_search_messages (query, 0, -1);
|
for (messages = notmuch_query_search_messages (query);
|
||||||
notmuch_messages_has_more (messages) && !interrupted;
|
notmuch_messages_has_more (messages) && !interrupted;
|
||||||
notmuch_messages_advance (messages))
|
notmuch_messages_advance (messages))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue