You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Ryan Josal <rj...@gmail.com> on 2015/12/10 21:55:02 UTC

JSON "fields" vs defaults

I didn't see a Jira open in this, so I wanted to see if it's expected. If
you pass "fields":[...] in a SOLR JSON API request, it does not override
what's the default in the handler config.  I had fl=* as a default, so I
saw "fields" have no effect, while "params":{"fl":...} worked as expected.
After stepping through the debugger I noticed it was just appending
"fields" at the end of everything else (including after solr config
appends, if it makes a difference).

If this is not expected I will create a Jira and maybe have time to provide
a patch.

Ryan

Re: JSON "fields" vs defaults

Posted by Ryan Josal <rj...@gmail.com>.
To respond to your last question Yonik, the "fl" in the query params
behaves the same as the "fl" in the JSON params block, so no bug there.
There is a difference though, between those and the top level "fields"
param, as Jack pointed out it appends to the defaults instead of overriding
them like "fl" does.  To me it seems natural for fields to behave like fl,
and I also agree that "filter" overriding defaults is a more questionable
use case.  But it's good to bring up to consider for consistency with fq.

On Tuesday, December 15, 2015, Jack Krupansky <ja...@gmail.com>
wrote:

> In a normal query multiple fl parameters are additive, but they
> collectively override whatever fl parameter(s) may have been specified in
> "defaults", right? I mean, that's why Solr has "appends" in addition to
> "defaults", right"?
>
> Ah, but I see in the JSON Request API doc that it says "Multi-valued
> elements like fields and filter are appended", seeming to imply that the
> "defaults" section will be treated as if it were "appends", it would seem,
> at least for how "fields" is treated.
>
> See:
> https://cwiki.apache.org/confluence/display/solr/JSON+Request+API
>
> Filter seems to make sense for this auto-appends mode, but fields/fl don't
> seem to benefit from appending rather than treating the defaults section in
> the traditional manner, I think.
>
> -- Jack Krupansky
>
> On Tue, Dec 15, 2015 at 9:06 PM, Yonik Seeley <yseeley@gmail.com
> <javascript:_e(%7B%7D,'cvml','yseeley@gmail.com');>> wrote:
>
>> Multiple "fl" parameters are additive, so it would make sense that
>> "fields" is also (for fl and field in the same request).  If that's
>> true for "fl" as a default and "fl" as a query param, then it seems
>> like that should be true for the other variants.
>>
>> If "fl" as a query param and "fl" in a JSON params block don't act the
>> same, that should probably be a bug?
>>
>> -Yonik
>>
>>
>> On Tue, Dec 15, 2015 at 7:55 PM, Jack Krupansky
>> <jack.krupansky@gmail.com
>> <javascript:_e(%7B%7D,'cvml','jack.krupansky@gmail.com');>> wrote:
>> > Yonik? The doc is weak in this area. In fact, I see a comment on it from
>> > Cassandra directed to you to verify the JSON to parameter mapping. It
>> would
>> > be nice to have a clear statement of the semantics for JSON "fields"
>> > parameter and how it may or may not interact with the Solr fl parameter.
>> >
>> > -- Jack Krupansky
>> >
>> > On Thu, Dec 10, 2015 at 3:55 PM, Ryan Josal <rjosal@gmail.com
>> <javascript:_e(%7B%7D,'cvml','rjosal@gmail.com');>> wrote:
>> >>
>> >> I didn't see a Jira open in this, so I wanted to see if it's expected.
>> If
>> >> you pass "fields":[...] in a SOLR JSON API request, it does not
>> override
>> >> what's the default in the handler config.  I had fl=* as a default, so
>> I saw
>> >> "fields" have no effect, while "params":{"fl":...} worked as expected.
>> >> After stepping through the debugger I noticed it was just appending
>> "fields"
>> >> at the end of everything else (including after solr config appends, if
>> it
>> >> makes a difference).
>> >>
>> >> If this is not expected I will create a Jira and maybe have time to
>> >> provide a patch.
>> >>
>> >> Ryan
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
>> <javascript:_e(%7B%7D,'cvml','dev-unsubscribe@lucene.apache.org');>
>> For additional commands, e-mail: dev-help@lucene.apache.org
>> <javascript:_e(%7B%7D,'cvml','dev-help@lucene.apache.org');>
>>
>>
>

Re: JSON "fields" vs defaults

Posted by Jack Krupansky <ja...@gmail.com>.
In a normal query multiple fl parameters are additive, but they
collectively override whatever fl parameter(s) may have been specified in
"defaults", right? I mean, that's why Solr has "appends" in addition to
"defaults", right"?

Ah, but I see in the JSON Request API doc that it says "Multi-valued
elements like fields and filter are appended", seeming to imply that the
"defaults" section will be treated as if it were "appends", it would seem,
at least for how "fields" is treated.

See:
https://cwiki.apache.org/confluence/display/solr/JSON+Request+API

Filter seems to make sense for this auto-appends mode, but fields/fl don't
seem to benefit from appending rather than treating the defaults section in
the traditional manner, I think.

-- Jack Krupansky

On Tue, Dec 15, 2015 at 9:06 PM, Yonik Seeley <ys...@gmail.com> wrote:

> Multiple "fl" parameters are additive, so it would make sense that
> "fields" is also (for fl and field in the same request).  If that's
> true for "fl" as a default and "fl" as a query param, then it seems
> like that should be true for the other variants.
>
> If "fl" as a query param and "fl" in a JSON params block don't act the
> same, that should probably be a bug?
>
> -Yonik
>
>
> On Tue, Dec 15, 2015 at 7:55 PM, Jack Krupansky
> <ja...@gmail.com> wrote:
> > Yonik? The doc is weak in this area. In fact, I see a comment on it from
> > Cassandra directed to you to verify the JSON to parameter mapping. It
> would
> > be nice to have a clear statement of the semantics for JSON "fields"
> > parameter and how it may or may not interact with the Solr fl parameter.
> >
> > -- Jack Krupansky
> >
> > On Thu, Dec 10, 2015 at 3:55 PM, Ryan Josal <rj...@gmail.com> wrote:
> >>
> >> I didn't see a Jira open in this, so I wanted to see if it's expected.
> If
> >> you pass "fields":[...] in a SOLR JSON API request, it does not override
> >> what's the default in the handler config.  I had fl=* as a default, so
> I saw
> >> "fields" have no effect, while "params":{"fl":...} worked as expected.
> >> After stepping through the debugger I noticed it was just appending
> "fields"
> >> at the end of everything else (including after solr config appends, if
> it
> >> makes a difference).
> >>
> >> If this is not expected I will create a Jira and maybe have time to
> >> provide a patch.
> >>
> >> Ryan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>
>

Re: JSON "fields" vs defaults

Posted by Yonik Seeley <ys...@gmail.com>.
Multiple "fl" parameters are additive, so it would make sense that
"fields" is also (for fl and field in the same request).  If that's
true for "fl" as a default and "fl" as a query param, then it seems
like that should be true for the other variants.

If "fl" as a query param and "fl" in a JSON params block don't act the
same, that should probably be a bug?

-Yonik


On Tue, Dec 15, 2015 at 7:55 PM, Jack Krupansky
<ja...@gmail.com> wrote:
> Yonik? The doc is weak in this area. In fact, I see a comment on it from
> Cassandra directed to you to verify the JSON to parameter mapping. It would
> be nice to have a clear statement of the semantics for JSON "fields"
> parameter and how it may or may not interact with the Solr fl parameter.
>
> -- Jack Krupansky
>
> On Thu, Dec 10, 2015 at 3:55 PM, Ryan Josal <rj...@gmail.com> wrote:
>>
>> I didn't see a Jira open in this, so I wanted to see if it's expected. If
>> you pass "fields":[...] in a SOLR JSON API request, it does not override
>> what's the default in the handler config.  I had fl=* as a default, so I saw
>> "fields" have no effect, while "params":{"fl":...} worked as expected.
>> After stepping through the debugger I noticed it was just appending "fields"
>> at the end of everything else (including after solr config appends, if it
>> makes a difference).
>>
>> If this is not expected I will create a Jira and maybe have time to
>> provide a patch.
>>
>> Ryan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Re: JSON "fields" vs defaults

Posted by Jack Krupansky <ja...@gmail.com>.
Yonik? The doc is weak in this area. In fact, I see a comment on it from
Cassandra directed to you to verify the JSON to parameter mapping. It would
be nice to have a clear statement of the semantics for JSON "fields"
parameter and how it may or may not interact with the Solr fl parameter.

-- Jack Krupansky

On Thu, Dec 10, 2015 at 3:55 PM, Ryan Josal <rj...@gmail.com> wrote:

> I didn't see a Jira open in this, so I wanted to see if it's expected. If
> you pass "fields":[...] in a SOLR JSON API request, it does not override
> what's the default in the handler config.  I had fl=* as a default, so I
> saw "fields" have no effect, while "params":{"fl":...} worked as expected.
> After stepping through the debugger I noticed it was just appending
> "fields" at the end of everything else (including after solr config
> appends, if it makes a difference).
>
> If this is not expected I will create a Jira and maybe have time to
> provide a patch.
>
> Ryan
>