lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yonik Seeley <yo...@lucidimagination.com>
Subject Re: nested querries, and LocalParams syntax
Date Wed, 26 May 2010 15:33:55 GMT
Have you seen
http://wiki.apache.org/solr/LocalParams

It may answer some of the questions, such as stating that "backslash
escaping works within quoted strings".

I'd encourage you to try things out with the example server and adding
debugQuery=true to your requests... it's the easiest way to figure out
what's going on.

defType is just the default type in the event that the main query
doesn't have local params that specifically say what the type of the
query is.

As far as overriding, it's on a per QueryParserPlugin basis, but most
do use localParams to override gobal request parameters.

-Yonik
http://www.lucidimagination.com



On Wed, May 26, 2010 at 11:09 AM, Jonathan Rochkind <rochkind@jhu.edu> wrote:
> So I'm trying to wrap my head around nested querries. Also that thing that
> isn't a nested query, but is similar, which I think is called "LocalParams
> syntax",  like:
>
> &q={!dismax qf=$something}cat dog
>
> (All my examples are not URL-encoded for clarity, of course they'd have to
> be before sending to solr).
>
> I've been referring to both:
> http://wiki.apache.org/solr/SolrQuerySyntax
> http://www.lucidimagination.com/blog/2009/03/31/nested-queries-in-solr/
>
> Let's start with that not-nested query example.   Can you in fact use it as
> above, to force dismax handling of the 'q' even if the qt or request handler
> default is something else?  The documentation is confusing: "In standard
> Solr search handlers, the default type of the main query only may be
> specified via the defType parameter. The default type of all other query
> parameters will remain "lucene
> <http://wiki.apache.org/solr/SolrQuerySyntax#lucene>"."
>
> I _think_ it's trying to say that I _can_, even in a standard search
> handler, force dismax with {!dismax}, I just can't change the type of
> _other_ query parameters -- rather than saying that I _can't_ use {!dismax}
> to force dismax type of 'q' in a "standard search handler".  Yes?



> Next, when we get to dismax---can I embed parameter value literals in there,
> and how?
>
> q={!dismax qf="field^2 field2^4"} some query
>
> With quotes like that? What if a parameter value literal itself has a quote
> mark in it, is there a way to escape it? (Say, can I embed an fq in there
> whose value itself needs quotes?)
>
> Will parameters supplied in LocalParams like that always "override"
> something supplied in a straight query parameter?
>
> &qf=somefield&q={!dismax qf=otherfield} cat dog    => I'll get "otherfield"
> and not "somefield" ?
>
> Can you use the LocalParams _without_ a !defType, to just supply parameters
> but take the default defType for the request handler?    &q={qf=somefield}
> cat dog
>
> And now we move into the nested querries -- for the simplest case nested
> query, is it in fact identical to using LocalParams without a nested query?
>
> &q={!dismax qf=something} cat dog
>
> ===?
>
> &q=_query_:"{!dismax qf=somefield} cat dog"
>
> Are those equivelent?  In nested querries like that, the issue of quote
> escaping becomes even more confusing, can I put a literal in there, and...
> how?
>
> &q=_query_:"{!dismax qf="somefield^1 otherfield^2"}"   ==> obviously won't
> work, the quotes are interfering with each other.
>
> Phew, that's a lot of questions, but probably just a start, heh. I'm trying
> to wrap my head around the complete possibilities of LocalParams and nested
> querries, to figure out if I can use them to do the kind of complicated
> thing I'm trying to do.
> I guess I could try to test all these things out and figure out the answer,
> and probably will proceed to do that if nobody else has any other advice,
> but I figured it didn't hurt to ask, and some of these things will be hard
> to guess on my own (like the quote escaping issue).  If I figure some stuff
> out, is there any good community place (wiki somewhere?) for me to document
> this stuff for others?
>
> Thanks for any advice,
>
> Jonathan
>
>

Mime
View raw message