diff options
author | Arun Isaac | 2024-05-07 23:29:58 +0100 |
---|---|---|
committer | Arun Isaac | 2024-05-07 23:48:24 +0100 |
commit | 551f6bea36c0f3f4f44667998f29ebdd0c3bb1bf (patch) | |
tree | 9ba10ec6d42b7242d02abd8262db111817f3c887 | |
parent | 99cc1a52fd7f5efdede86e3d5f2df5c7ec57a0d5 (diff) | |
download | guile-xapian-551f6bea36c0f3f4f44667998f29ebdd0c3bb1bf.tar.gz guile-xapian-551f6bea36c0f3f4f44667998f29ebdd0c3bb1bf.tar.lz guile-xapian-551f6bea36c0f3f4f44667998f29ebdd0c3bb1bf.zip |
xapian: Support common query parser flags.
* xapian/xapian.scm (parse-query): Add boolean?, phrases?, love-hate?,
any-case-boolean?, wildcard? flags.
-rw-r--r-- | xapian/xapian.scm | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/xapian/xapian.scm b/xapian/xapian.scm index 6ab879c..d219c30 100644 --- a/xapian/xapian.scm +++ b/xapian/xapian.scm @@ -166,7 +166,18 @@ generated." (define increase-termpos! TermGenerator-increase-termpos) -(define* (parse-query querystring #:key stemmer stemming-strategy (prefixes '()) (boolean-prefixes '()) (range-processors '())) +(define* (parse-query querystring + #:key + stemmer + stemming-strategy + (prefixes '()) + (boolean-prefixes '()) + (range-processors '()) + (boolean? #t) + (phrases? #t) + (love-hate? #t) + any-case-boolean? + wildcard?) (let ((queryparser (new-QueryParser))) (QueryParser-set-stemmer queryparser stemmer) (when stemming-strategy @@ -181,7 +192,13 @@ generated." boolean-prefixes) (for-each (cut QueryParser-add-rangeprocessor queryparser <>) range-processors) - (let ((query (QueryParser-parse-query queryparser querystring))) + (let ((query (QueryParser-parse-query queryparser + querystring + (bitwise-ior (get-flag QueryParser-FLAG-BOOLEAN boolean?) + (get-flag QueryParser-FLAG-PHRASE phrases?) + (get-flag QueryParser-FLAG-LOVEHATE love-hate?) + (get-flag QueryParser-FLAG-BOOLEAN-ANY-CASE any-case-boolean?) + (get-flag QueryParser-FLAG-WILDCARD wildcard?))))) (delete-QueryParser queryparser) query))) |