: For example, lets say my unmodified query is : "http://localhost:8994/solr/select?q=xxx:[* TO 3] AND yyy:[3 TO : *]&defType=myQParser" and (JUST for the sake of argument) lets say I want to : rewrite it as "http://localhost:8994/solr/select?q=aaa:[1 TO 2] AND bbb:[3 : TO 10]&defType=myQParser". : : I think I can do it by extending QParserPlugin, and overriding the : createParser method (see my code snippet below). The qstr parameter : apparently contains the parts I want to examine and/or modify. : : now to my questions: : 1. is that the correct location to do this sort of manipulation?
yes, you'd definitely need a custom QParserPlugin, but you have a lot of options in what that plugin should do... : 2. is there an existing method for parsing out the fields and their : parameters? i.e. to break a qstr of "xxx:[* TO 3] AND yyy:[3 TO *]" into an : array something like x[0][0] = "xxx", x[0][1]="* TO 3", x[1][0] = "yyy", : x[1][1]="3 TO *". Or possibly even finer granularity than that. I could : write it myself but its much nicer not to have to (especially since the : queries could be very complex). if you wnat to reuse the existing Lucene syntax (and based on your example here it seems like you do) then your best bet is probably to have your QParser create a subclass of the Lucen QueryParser where you override each of the get methods to inspect the "field" argument, change it as you see fit, and then delegate to the superclass to build the actual query object. that's the closest thing to what you describe. -Hoss