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.
Also, I think many applications using Solr would do well to parse
their own query strings and had it to Solr pre-digested, perhaps
using the XMLQueryParser, yet using a simplified facet query syntax
as above.
putting a prefix on every query string to identify the syntax seems
cumbersome ... put i guess it wouldn't be too bad if it was done as an
"override" for a single q.syntax option thta influenced all "query
strings" type params that didn't start with the special markup.
Yeah, a default would be necessary to keep things clean for the cases
where the syntax can be assumed to be the same for all, though maybe
the default choice of syntax would be parameter-specific also, so q
could be QueryParser, and fq could be, say, a new SimpleTermFacetParser.
Erik