From dd08d816dca127808b2343005ec8a728b6cb2a2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Fri, 5 Jan 2024 16:44:26 +0100 Subject: support for suggested queries and query redirects --- src/structs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/structs.c') diff --git a/src/structs.c b/src/structs.c index 6deea3e..f23e52f 100644 --- a/src/structs.c +++ b/src/structs.c @@ -84,6 +84,8 @@ struct sc_query { SC_IN_STRUCT_ARRAY(struct sc_result, results); /* yesfree */ char * string; /* yesfree - query string, stripped of any excess characters that should be excluded from indexing */ time_t lookup_time; /* time of last lookup */ + char * suggested; /* yesfree - suggested search query (did you mean) */ + bool redirect; /* true if client is encouraged to be redirected to suggested (showing results for) */ SC_OPT_TYPE opt; /* some options including engines */ }; struct sc_query * sc_query_init () { @@ -95,6 +97,7 @@ struct sc_query * sc_query_init () { q->results[i]->query = q; } q->string = NULL; + q->suggested = NULL; q->opt = SC_OPT_INIT; return q; } @@ -122,8 +125,9 @@ sc_query_free ( #endif ; if (q->cache) - SC_LOG(SC_LOG_DEBUG, q->cache, "sc_query_free: %s", q->string ? q->string : "NULL"); + SC_LOG(SC_LOG_DEBUG, q->cache, "sc_query_free: %s (sugg: %s)", q->string ? q->string : "NULL", q->suggested ? q->suggested : "NULL"); free(q->string); /* if they were not alloced, they are NULL, if they were free'd somewhere else, they are also set to NULL */ + free(q->suggested); for (size_t i = 0; i < q->results_sizeof; i++) sc_result_free(q->results[i]); free(q->results); -- cgit v1.2.3