[ 
https://issues.apache.org/jira/browse/SOLR-5730?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15117104#comment-15117104
 ] 

Christine Poerschke commented on SOLR-5730:
-------------------------------------------

Have chosen
{code}
+      if (segmentTerminatedEarly != null) {
+        final Object existingSegmentTerminatedEarly = 
rb.rsp.getResponseHeader().get(SolrQueryResponse.RESPONSE_HEADER_SEGMENT_TERMINATED_EARLY_KEY);
+        if(existingSegmentTerminatedEarly == null) {
+          
rb.rsp.getResponseHeader().add(SolrQueryResponse.RESPONSE_HEADER_SEGMENT_TERMINATED_EARLY_KEY,
 segmentTerminatedEarly);
+        } else if (!Boolean.TRUE.equals(existingSegmentTerminatedEarly) && 
Boolean.TRUE.equals(segmentTerminatedEarly)) {
+          
rb.rsp.getResponseHeader().remove(SolrQueryResponse.RESPONSE_HEADER_SEGMENT_TERMINATED_EARLY_KEY);
+          
rb.rsp.getResponseHeader().add(SolrQueryResponse.RESPONSE_HEADER_SEGMENT_TERMINATED_EARLY_KEY,
 segmentTerminatedEarly);
+        }
+      }
{code}
as implementation for the {{existing OR new}} to avoid unnecessary 
remove-and-then-add-back if {{existing}} is already TRUE.

> make Lucene's SortingMergePolicy and EarlyTerminatingSortingCollector 
> configurable in Solr
> ------------------------------------------------------------------------------------------
>
>                 Key: SOLR-5730
>                 URL: https://issues.apache.org/jira/browse/SOLR-5730
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Christine Poerschke
>            Assignee: Christine Poerschke
>            Priority: Minor
>         Attachments: SOLR-5730-part1of2.patch, SOLR-5730-part1of2.patch, 
> SOLR-5730-part2of2.patch, SOLR-5730-part2of2.patch
>
>
> *Example configuration (solrconfig.xml):*
> {noformat}
> <sortMerges enable="true">
>   <str name="sort">timestamp desc</str>
> </sortMerges>
> {noformat}
> *Example use (EarlyTerminatingSortingCollector):*
> {noformat}
> &sort=timestamp+desc&segmentTerminateEarly=true
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to