: q=reference:"4-1.2"
: 
: the value is a text, but the following is indexed as a number (e.g.:
: 004001002, where "4" becomes "004", and 1 becomes "001", and 2 "002"),

depnding on how you look at it, you could implment this as 
one of two plugins:

1) if you consider this a special form of query syntax, then you should 
implement it as a QParser -- ie: a RefrenceNumberQparser that it could be 
used with any field/fieldType/FieldType, regardless of wether it's 
ultimately backed by a TrieLongField or an IntField, etc...

2) if you consider this to be an special format of the underlying data, 
then you would implement it in the FieldType -- ie: by subclassing 
TrieLongField and calling it RefrenceNumberField and overriding methods 
like readableToIndexed (and optionally: things like indexedToReadable and 
toObject if you'd like to format the resulting data as "4-1.2" when you 
return it to the client)

Practically i think the key decision maker is what sort of behavior you 
want to support if someone asks for something like "refrence:4" ... should 
that be equivilent to "4-0.0" (in which case you could implement this 
easily as a FieldType) or should it be a range query for 
everything in article 4, regardless of section and subsection? (in which 
case i would implement it in a QParser)


-Hoss

Reply via email to