lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <p.bod...@centrum.cz>
Subject Re: Is that a mistake or bug?
Date Mon, 03 Sep 2018 08:52:44 GMT
Hi, really nope :) Because as MK writes below, result.segmentTerminatedEarly is used as a 3-state
variable.

The only line that could be improved, is probably replacing "Boolean.FALSE" by simply "false",
but that is really a minor thing...

Regards

PB
______________________________________________________________
> Od: "zhenyuan wei" <tinswzy@gmail.com>
> Komu: solr-user@lucene.apache.org
> Datum: 03.09.2018 10:24
> Předmět: Re: Is that a mistake or bug?
>
>I mean, use terminatedEarly as basic boolean type, then  no need to explicitly
>assign it as Boolean.FALSE,  because basic boolean's default value is false.
>
>Mikhail Khludnev <mkhl@apache.org> 于2018年9月3日周一 下午4:13写道:
>
>> Nope. In this case, it will respond terminatedEarly=false even if noone
>> request it.
>>
>> On Mon, Sep 3, 2018 at 9:09 AM zhenyuan wei <tinswzy@gmail.com> wrote:
>>
>> > Yeah,got it~. So the QueryResult.segmentTerminatedEarly maybe a boolean,
>> > instead of Boolean,  is better, right?
>> >
>> > Mikhail Khludnev <mkhl@apache.org> 于2018年9月3日周一 下午1:36写道:
>> >
>> > > It's neither, it's on purpose. By default
>> result.segmentTerminatedEarly
>> > is
>> > > null, hence it doesn't appear in result output. see
>> > > ResponseBuilder.setResult(QueryResult).
>> > > So, if cmd requests early termination, it sets false by default,
>> enabling
>> > > "false" output even it won't be the case. And later it might be flipped
>> > to
>> > > true.
>> > >
>> > >
>> > > On Mon, Sep 3, 2018 at 5:57 AM zhenyuan wei <tinswzy@gmail.com> wrote:
>> > >
>> > > > Hi all,
>> > > >     I saw the code like following:
>> > > >
>> > > > QueryResult result = new QueryResult();
>> > > >
>> > > >
>> > > >
>> > >
>> >
>> cmd.setSegmentTerminateEarly(params.getBool(CommonParams.SEGMENT_TERMINATE_EARLY,
>> > > > CommonParams.SEGMENT_TERMINATE_EARLY_DEFAULT));
>> > > > if (cmd.getSegmentTerminateEarly()) {
>> > > >   result.setSegmentTerminatedEarly(Boolean.FALSE);
>> > > > }
>> > > >
>> > > > It says if request's param segmentTerminateEarly=true, which means
>> > search
>> > > > maybe terminated early within a segment,  then set
>> > > > result.setSegmentTerminatedEarly as false , this code is of a little
>> > > > confusion
>> > > > .
>> > > >
>> > >
>> > >
>> > > --
>> > > Sincerely yours
>> > > Mikhail Khludnev
>> > >
>> >
>>
>>
>> --
>> Sincerely yours
>> Mikhail Khludnev
>>
>
>

Mime
View raw message