diff options
| author | arf20 <aruizfernandez05@gmail.com> | 2025-12-07 20:56:40 +0100 |
|---|---|---|
| committer | arf20 <aruizfernandez05@gmail.com> | 2025-12-07 20:56:40 +0100 |
| commit | 00909fc4333b1cefc502dc40afa2c7c06ec7f713 (patch) | |
| tree | 55cc73743966780e0cd51867b5451db14734e784 /index.h | |
| parent | 9fc16dba71c6deb26bf09ec5198a8a6d7c4dbb74 (diff) | |
| download | arfnet2-search-00909fc4333b1cefc502dc40afa2c7c06ec7f713.tar.gz arfnet2-search-00909fc4333b1cefc502dc40afa2c7c06ec7f713.zip | |
sorting and filtering working
Diffstat (limited to 'index.h')
| -rw-r--r-- | index.h | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -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 */ |
