On Jan 21, 2007, at 11:12 PM, Yonik Seeley wrote:
On 1/21/07, Erik Hatcher <[EMAIL PROTECTED]> wrote:
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).

Oh, I realize that quite well :)

However, for basic faceted browsing, fq parameters are generally just plain terms and any type of meta-QueryParser syntax in the terms could get in the way when QueryParser is being used.

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

This second option allows for parameters to be passed to the parser, which is a nice point of extensibility.

Of course, while that prefix looks decent in bare text, adding it to
an XML config file would look ugly since < would need escaping.

No biggie there. It's not often that it'd be in a config file. And there is already escaping ugliness for the ping and warmup queries in solrconfig.xml.

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)

I like the <!term field='myfield'>.... syntax above best of the ones you've mentioned because of the ability to provide parameters cleanly.

        Erik

Reply via email to