Re: [PATCH v2 03/11] notmuch-search: add filesize based sort order

2017-06-09 Thread David Bremner
Ioan-Adrian Ratiu  writes:

> With this it now becomes possible to order the search results by
> filesize using the --sort=biggest-first/smallest-first args.

You should mention that you are also changing the library API, as well
as adding new search options to notmuch-show  and notmuch-search.
>
> diff --git a/lib/notmuch.h b/lib/notmuch.h
> index f90458ce..b7bf3526 100644
> --- a/lib/notmuch.h
> +++ b/lib/notmuch.h
> @@ -743,6 +743,14 @@ typedef enum {
>   */
>  NOTMUCH_SORT_MESSAGE_ID,
>  /**
> + * Smallest first.
> + */
> +NOTMUCH_SORT_SMALLEST_FIRST,
> +/**
> + * Biggest first
> + */
> +NOTMUCH_SORT_BIGGEST_FIRST,
> +/**
>   * Do not sort.
>   */

At the moment the ABI is unstable on master, but that will change with
the next release.  Depending on when this is merged, it may need to bump
the library version. I think just bumping LIBNOTMUCH_MINOR should be ok.


> +++ b/lib/query.cc
> @@ -330,6 +330,12 @@ _notmuch_query_search_documents (notmuch_query_t *query,
>   case NOTMUCH_SORT_MESSAGE_ID:
>   enquire.set_sort_by_value (NOTMUCH_VALUE_MESSAGE_ID, FALSE);
>   break;
> + case NOTMUCH_SORT_SMALLEST_FIRST:
> + enquire.set_sort_by_value (NOTMUCH_VALUE_FILESIZE, FALSE);
> + break;
> + case NOTMUCH_SORT_BIGGEST_FIRST:
> + enquire.set_sort_by_value (NOTMUCH_VALUE_FILESIZE, TRUE);
> + break;
>   case NOTMUCH_SORT_UNSORTED:
>   break;
>   }
> diff --git a/notmuch-search.c b/notmuch-search.c
> index 019e14ee..65ecfaab 100644
> --- a/notmuch-search.c
> +++ b/notmuch-search.c
> @@ -778,6 +778,8 @@ static const notmuch_opt_desc_t common_options[] = {
>  { NOTMUCH_OPT_KEYWORD, &search_context.sort, "sort", 's',
>(notmuch_keyword_t []){ { "oldest-first", NOTMUCH_SORT_OLDEST_FIRST },
> { "newest-first", NOTMUCH_SORT_NEWEST_FIRST },
> +   { "smallest-first", NOTMUCH_SORT_SMALLEST_FIRST },
> +   { "biggest-first", NOTMUCH_SORT_BIGGEST_FIRST },
> { 0, 0 } } },
>  { NOTMUCH_OPT_KEYWORD, &search_context.format_sel, "format", 'f',
>(notmuch_keyword_t []){ { "json", NOTMUCH_FORMAT_JSON },

These new options should be documented, and tested.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v2 03/11] notmuch-search: add filesize based sort order

2017-05-22 Thread Ioan-Adrian Ratiu
On Fri, 19 May 2017, Tomi Ollila  wrote:
> On Fri, May 19 2017, Ioan-Adrian Ratiu wrote:
>
>> With this it now becomes possible to order the search results by
>> filesize using the --sort=biggest-first/smallest-first args.
>
> Quick drive-by comment (for now): In many places elsewhere we're talking
> about 'large' files (e.g. LARGEFILE_SOURCE...) so should we use that
> terminology here too (?) instead of 'big*'

Sure. I'll update to use 'large' in v3, but I'll wait a little longer to
get more feedback on v2 before sending it because it's a small change.

Ionel

>
> Tomi
>
>
>>
>> Signed-off-by: Ioan-Adrian Ratiu 
>> ---
>>  lib/notmuch.h| 8 
>>  lib/query.cc | 6 ++
>>  notmuch-search.c | 2 ++
>>  3 files changed, 16 insertions(+)
>>
>> diff --git a/lib/notmuch.h b/lib/notmuch.h
>> index f90458ce..b7bf3526 100644
>> --- a/lib/notmuch.h
>> +++ b/lib/notmuch.h
>> @@ -743,6 +743,14 @@ typedef enum {
>>   */
>>  NOTMUCH_SORT_MESSAGE_ID,
>>  /**
>> + * Smallest first.
>> + */
>> +NOTMUCH_SORT_SMALLEST_FIRST,
>> +/**
>> + * Biggest first
>> + */
>> +NOTMUCH_SORT_BIGGEST_FIRST,
>> +/**
>>   * Do not sort.
>>   */
>>  NOTMUCH_SORT_UNSORTED
>> diff --git a/lib/query.cc b/lib/query.cc
>> index 9c6ecc8d..72b725e3 100644
>> --- a/lib/query.cc
>> +++ b/lib/query.cc
>> @@ -330,6 +330,12 @@ _notmuch_query_search_documents (notmuch_query_t *query,
>>  case NOTMUCH_SORT_MESSAGE_ID:
>>  enquire.set_sort_by_value (NOTMUCH_VALUE_MESSAGE_ID, FALSE);
>>  break;
>> +case NOTMUCH_SORT_SMALLEST_FIRST:
>> +enquire.set_sort_by_value (NOTMUCH_VALUE_FILESIZE, FALSE);
>> +break;
>> +case NOTMUCH_SORT_BIGGEST_FIRST:
>> +enquire.set_sort_by_value (NOTMUCH_VALUE_FILESIZE, TRUE);
>> +break;
>>  case NOTMUCH_SORT_UNSORTED:
>>  break;
>>  }
>> diff --git a/notmuch-search.c b/notmuch-search.c
>> index 019e14ee..65ecfaab 100644
>> --- a/notmuch-search.c
>> +++ b/notmuch-search.c
>> @@ -778,6 +778,8 @@ static const notmuch_opt_desc_t common_options[] = {
>>  { NOTMUCH_OPT_KEYWORD, &search_context.sort, "sort", 's',
>>(notmuch_keyword_t []){ { "oldest-first", NOTMUCH_SORT_OLDEST_FIRST },
>>{ "newest-first", NOTMUCH_SORT_NEWEST_FIRST },
>> +  { "smallest-first", NOTMUCH_SORT_SMALLEST_FIRST },
>> +  { "biggest-first", NOTMUCH_SORT_BIGGEST_FIRST },
>>{ 0, 0 } } },
>>  { NOTMUCH_OPT_KEYWORD, &search_context.format_sel, "format", 'f',
>>(notmuch_keyword_t []){ { "json", NOTMUCH_FORMAT_JSON },
>> -- 
>> 2.13.0
>>
>> ___
>> notmuch mailing list
>> notmuch@notmuchmail.org
>> https://notmuchmail.org/mailman/listinfo/notmuch
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v2 03/11] notmuch-search: add filesize based sort order

2017-05-19 Thread Tomi Ollila
On Fri, May 19 2017, Ioan-Adrian Ratiu wrote:

> With this it now becomes possible to order the search results by
> filesize using the --sort=biggest-first/smallest-first args.

Quick drive-by comment (for now): In many places elsewhere we're talking
about 'large' files (e.g. LARGEFILE_SOURCE...) so should we use that
terminology here too (?) instead of 'big*'

Tomi


>
> Signed-off-by: Ioan-Adrian Ratiu 
> ---
>  lib/notmuch.h| 8 
>  lib/query.cc | 6 ++
>  notmuch-search.c | 2 ++
>  3 files changed, 16 insertions(+)
>
> diff --git a/lib/notmuch.h b/lib/notmuch.h
> index f90458ce..b7bf3526 100644
> --- a/lib/notmuch.h
> +++ b/lib/notmuch.h
> @@ -743,6 +743,14 @@ typedef enum {
>   */
>  NOTMUCH_SORT_MESSAGE_ID,
>  /**
> + * Smallest first.
> + */
> +NOTMUCH_SORT_SMALLEST_FIRST,
> +/**
> + * Biggest first
> + */
> +NOTMUCH_SORT_BIGGEST_FIRST,
> +/**
>   * Do not sort.
>   */
>  NOTMUCH_SORT_UNSORTED
> diff --git a/lib/query.cc b/lib/query.cc
> index 9c6ecc8d..72b725e3 100644
> --- a/lib/query.cc
> +++ b/lib/query.cc
> @@ -330,6 +330,12 @@ _notmuch_query_search_documents (notmuch_query_t *query,
>   case NOTMUCH_SORT_MESSAGE_ID:
>   enquire.set_sort_by_value (NOTMUCH_VALUE_MESSAGE_ID, FALSE);
>   break;
> + case NOTMUCH_SORT_SMALLEST_FIRST:
> + enquire.set_sort_by_value (NOTMUCH_VALUE_FILESIZE, FALSE);
> + break;
> + case NOTMUCH_SORT_BIGGEST_FIRST:
> + enquire.set_sort_by_value (NOTMUCH_VALUE_FILESIZE, TRUE);
> + break;
>   case NOTMUCH_SORT_UNSORTED:
>   break;
>   }
> diff --git a/notmuch-search.c b/notmuch-search.c
> index 019e14ee..65ecfaab 100644
> --- a/notmuch-search.c
> +++ b/notmuch-search.c
> @@ -778,6 +778,8 @@ static const notmuch_opt_desc_t common_options[] = {
>  { NOTMUCH_OPT_KEYWORD, &search_context.sort, "sort", 's',
>(notmuch_keyword_t []){ { "oldest-first", NOTMUCH_SORT_OLDEST_FIRST },
> { "newest-first", NOTMUCH_SORT_NEWEST_FIRST },
> +   { "smallest-first", NOTMUCH_SORT_SMALLEST_FIRST },
> +   { "biggest-first", NOTMUCH_SORT_BIGGEST_FIRST },
> { 0, 0 } } },
>  { NOTMUCH_OPT_KEYWORD, &search_context.format_sel, "format", 'f',
>(notmuch_keyword_t []){ { "json", NOTMUCH_FORMAT_JSON },
> -- 
> 2.13.0
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch