Opened 14 years ago

Closed 9 years ago

#456 closed enhancement (fixed)

Add support for a prefix to control parsing of a value-range specification

Reported by: Carl Worth Owned by: Olly Betts
Priority: normal Milestone: 1.3.1
Component: QueryParser Version:
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Operating System: All

Description (last modified by Olly Betts)

I've been able to use Xapian's existing ValueRangeParser class to support date ranges similar to:

20100101..20100131

but what I'd really like instead is something like:

date:"January 2010"

or:

date:"this month"

Using a prefix like this matches the way the rest of my search strings are constructed, and as can be seen in the examples above, I want to support specifications of a range that don't have anything like the ".." syntax in them.

Obviously, I'll be happy to do my own parsing of strings like "January 2010" and "this month"---I just need a mechanism to hook my custom function to a prefixed chunk of query text.

Olly suggested maybe the interface could be as general as my function just returning a query object. That would be a fairly powerful interface for doing all kinds of interesting things.

Change History (3)

comment:1 by Olly Betts, 14 years ago

Component: OtherQueryParser
Milestone: 1.2.x

Returning a query object would also address the FieldProcessor idea of #128. This could perhaps subsume ValueRangeProcessor too.

This would be an API extension (except for totally subsuming ValueRangeProcessor) so marking for 1.2.x.

comment:2 by Olly Betts, 12 years ago

Description: modified (diff)
Milestone: 1.2.x1.3.x
Status: newassigned

I added a FieldProcessor class in r16807 which is intended to provide this sort of ability. Currently quoted arguments aren't handled though, so it doesn't support the exact cases mentioned here yet.

comment:3 by Olly Betts, 9 years ago

Milestone: 1.3.x1.3.1
Resolution: fixed
Status: assignedclosed

Actually, I was wrong in the previous comment - the changes in r16807 already support quoted arguments - the tests even add a test for date:"this week" producing a date range. So this was addressed in 1.3.1.

Note: See TracTickets for help on using tickets.