From 00909fc4333b1cefc502dc40afa2c7c06ec7f713 Mon Sep 17 00:00:00 2001 From: arf20 Date: Sun, 7 Dec 2025 20:56:40 +0100 Subject: sorting and filtering working --- index.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'index.h') diff --git a/index.h b/index.h index 187de94..26ac586 100644 --- a/index.h +++ b/index.h @@ -1,7 +1,7 @@ /* arfnet2-search: Fast file indexer and search - Copyright (C) 2023 arf20 (Ángel Ruiz Fernandez) + Copyright (C) 2025 arf20 (Ángel Ruiz Fernandez) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,7 +28,8 @@ typedef enum { LOOKUP_SUBSTR, - LOOKUP_SUBSTR_NOCASE, + LOOKUP_SUBSTR_CASEINSENSITIVE, + LOOKUP_EXACT, LOOKUP_REGEX } lookup_type_t; @@ -40,6 +41,19 @@ typedef struct { typedef struct map_s *index_t; +typedef enum { + SORT_NAME, + SORT_MIME, + SORT_PATH, + SORT_SIZE, + SORT_TIME +} sort_type_t; + +typedef struct { + time_t time_low, time_high; + size_t size_low, size_high; +} filter_t; + typedef struct { const node_data_t **results; size_t size, capacity; @@ -50,6 +64,9 @@ void index_deinit(); index_t index_new(size_t icapacity, const char *root, int examine); results_t *index_lookup(index_t index, lookup_type_t type, const char *query); void index_destroy(index_t index); + +void results_sort(results_t *results, sort_type_t sort_type, int desc); +results_t *results_filter(results_t *results, const filter_t *filter); void results_destroy(results_t *results); #endif /* _INDEX_H */ -- cgit v1.2.3