Oh~ got it, Thanks

<p.bod...@centrum.cz> 于2018年9月16日周日 下午9:54写道:

> I think we both understand you well :) So once again, to explain it to
> you, please have a look at the aforementioned
> https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/handler/component/ResponseBuilder.java,
> these lines:
>
>     final Boolean segmentTerminatedEarly =
> result.getSegmentTerminatedEarly();
>     if (segmentTerminatedEarly != null) {
>
> rsp.getResponseHeader().add(SolrQueryResponse.RESPONSE_HEADER_SEGMENT_TERMINATED_EARLY_KEY,
> segmentTerminatedEarly);
> }
>
> Got it now? :)
>
> Petr
> ______________________________________________________________
> > Od: "zhenyuan wei" <tins...@gmail.com>
> > Komu: solr-user@lucene.apache.org
> > Datum: 03.09.2018 11:21
> > Předmět: Re: Is that a mistake or bug?
> >
> >Oh ~ I feel embarrassed to  explaining it again, maybe my english not so
> >well~
> >my actually mean is:   IF  QueryResult.segmentTerminatedEarly  is boolean
> >,not Boolean , declared in QueryResult.
> >public class QueryResult{
> >       private boolean partialResults
> >      * private Boolean segmentTerminatedEarly;  ====>  private boolean
> >segmentTerminatedEarly;*
> >       ......
> >}
> >
> >then  in QueryComponent.process() method, like follow :
> >
> >QueryResult result = new QueryResult();
>
> >cmd.setSegmentTerminateEarly(params.getBool(CommonParams.SEGMENT_TERMINATE_EARLY,
> >CommonParams.SEGMENT_TERMINATE_EARLY_DEFAULT));
> >
> >
> >*if (cmd.getSegmentTerminateEarly()) {     // this if block code can be
> >deleted .    result.setSegmentTerminatedEarly(Boolean.FALSE); } *
> >
> >
> >
> >
> >
> >
> >
> ><p.bod...@centrum.cz> 于2018年9月3日周一 下午4:52写道:
> >
> >> 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" <tins...@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 <m...@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 <tins...@gmail.com>
> wrote:
> >> >>
> >> >> > Yeah,got it~. So the QueryResult.segmentTerminatedEarly maybe a
> >> boolean,
> >> >> > instead of Boolean,  is better, right?
> >> >> >
> >> >> > Mikhail Khludnev <m...@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 <tins...@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
> >> >>
> >> >
> >> >
> >>
> >
> >
>

Reply via email to