aboutsummaryrefslogtreecommitdiff
path: root/xapian
diff options
context:
space:
mode:
Diffstat (limited to 'xapian')
-rw-r--r--xapian/xapian.scm36
1 files changed, 36 insertions, 0 deletions
diff --git a/xapian/xapian.scm b/xapian/xapian.scm
index 15690aa..f395162 100644
--- a/xapian/xapian.scm
+++ b/xapian/xapian.scm
@@ -56,6 +56,8 @@
query-filter
prefixed-range-processor
suffixed-range-processor
+ prefixed-date-range-processor
+ suffixed-date-range-processor
field-processor
enquire
enquire-mset
@@ -277,6 +279,40 @@ on both ends of the range—@samp{2kg..12kg}."
(get-flag RP-REPEATED repeated?))
proc))
+(define* (prefixed-date-range-processor slot #:key (prefix "") repeated? prefer-mdy? (epoch-year 1970))
+ "Return a @code{DateRangeProcessor} object that handles date ranges on
+@var{slot}.
+
+@var{prefix} and @var{repeated?} are the same as in
+@code{prefixed-range-processor}.
+
+When @var{prefer-mdy?} is @code{#t}, interpret ambiguous dates as
+month/day/year rather than day/month/year.
+
+@var{epoch-year} is the year to use as the epoch for dates with
+two-digit years."
+ (new-DateRangeProcessor slot
+ prefix
+ (bitwise-ior (get-flag (RP-REPEATED) repeated?)
+ (get-flag (RP-DATE-PREFER-MDY) prefer-mdy?))
+ epoch-year))
+
+(define* (suffixed-date-range-processor slot #:key suffix repeated? prefer-mdy? (epoch-year 1970))
+ "Return a @code{DateRangeProcessor} object that handles date ranges on
+@var{slot}.
+
+@var{suffix} and @var{repeated?} are the same as in
+@code{suffixed-range-processor}.
+
+@var{prefer-mdy?} and @var{epoch-year} are the same as in
+@code{prefixed-date-range-processor}."
+ (new-DateRangeProcessor slot
+ suffix
+ (bitwise-ior (RP-SUFFIX)
+ (get-flag (RP-REPEATED) repeated?)
+ (get-flag (RP-DATE-PREFER-MDY) prefer-mdy?))
+ epoch-year))
+
(define (field-processor proc)
"Return a @code{FieldProcessor} object that calls
@var{proc} to process its field. @var{proc} is a procedure that, given