On 1/21/07, Erik Hatcher <[EMAIL PROTECTED]> wrote:
On Jan 20, 2007, at 9:23 PM, Chris Hostetter wrote: > : > In the back of my mind, I've been thinking about *how* to support > : > multiple query syntaxes. > : > trying to add new parameters everywhere specifying the type > doesn't > : > seem like a great idea (way too many places). > > : Good point. Yeah, it does make sense for the query type to be part > : of the query string itself. There are lots of places that a > : QueryParser expression can currently be used (&q=, &fq= with > standard > : requests, and other places with dismax). > > are you guys concerned that people will want to use different > sytnaxes for > different places where a query is expressed, ie: use the stock > syntax in > one "fq", the xml syntax in a "q", and the surround syntax in a second > "fq" ?Yes, I think different syntaxes in different places would be useful. For example, a user enters a full-text search query that is suitable to use with Solr's QueryParser, and then the user facets a bit. The facet "queries" really aren't queries at all, but rather terms that don't need to be parsed. Building up a string to be parsed like "# {params[:field]}:#{params[:value]}" is tricky because of escaping syntax (like colons). So fq wouldn't need to be parsed at all, except to pull the field name out to build a TermQuery straightforwardly.
fq params are often queries too (think price ranges, etc). For syntax, what about <!term>myfield:my unescaped value all as a singe term Or <!term field='myfield'>my unescaped value all as a singe term Of course, while that prefix looks decent in bare text, adding it to an XML config file would look ugly since < would need escaping. Another syntax option... something like !term:myfield:my unescaped value all as a singe term #term: %term: @term: (basically, find a prefix that would be unlikely to appear as an actual term or wildcard in lucene queryparser syntax) -Yonik
