[KinoSearch] Syntax for RangeQuery parsed by QueryParser

Darian Anthony Patrick darian at criticode.com
Tue Apr 28 08:19:31 PDT 2009



Marvin Humphrey wrote:
> On Mon, Apr 27, 2009 at 09:20:33AM -0400, Darian Anthony Patrick wrote:
>> This is a question pertaining to trunk/0.20_06:  are there plans to
>> support parsing of ranges by QueryParser and turning them into RangeQueries?
> 
> If we were to provide support for such syntax, it would not be through the
> core QueryParser, but instead a KSx extension or sample code.  
> 

Okay, that makes sense.  Do you have any ideas about how such syntax
should appear in a query string?  I've been considering:

975 < field1: < 999

or

field1:<999 AND field1:>975

or

field1<999 AND field1>975

Both of these seem kind of awkward, but I think the last is easiest to
parse, and doesn't conflict with term queries.  However, all are
ignoring inclusivity/exclusivity.  Thoughts?

> My inclination would be to build alternative parsers based on
> Parse::RecDescent as laid out in
> KinoSearch::Docs::Cookbook::CustomQueryParser, put them in the sample
> directory, and mention their presence in the QueryParser docs.  
> 

For now, that's what I'll do.  Thanks Marvin.

Also, I think there's an error in the version of that document currently
published on rectangular.com.  In sub _tokenize() in the elsif
condition, the regex

s/^"([^"]*)(?:"|$)//

does not collect the quotation marks into $1, causing the first if
conditional in sub parse() to fail.

-- 
Darian Anthony Patrick, Criticode LLC
Office:     (215) 789-9956
Facsimile:  (866) 789-2992
Email/XMPP: darian at criticode.com
Web:        http://criticode.com
=================================================
BCF1 E7AD 15AD 8A99 F613 AF5F 2A9C C45C F580 E087
=================================================
* Signed and encrypted communications preferred.



More information about the kinosearch mailing list