You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Varun Thacker (JIRA)" <ji...@apache.org> on 2018/07/24 20:17:00 UTC

[jira] [Comment Edited] (SOLR-12587) Reuse Lucene's PriorityQueue for the ExportHandler

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

Varun Thacker edited comment on SOLR-12587 at 7/24/18 8:16 PM:
---------------------------------------------------------------

Here's a version of SortQueue looks functionally the same .
{code:java}
class SortQueue extends PriorityQueue<SortDoc> {

  final private SortDoc proto;

  public SortQueue(int len, SortDoc proto) {
    super(len);
    this.proto = proto;
  }

  protected boolean lessThan(SortDoc t1, SortDoc t2) {
    return t1.lessThan(t2);
  }

  // reset get's called even before we collect the first set of docs so we can initialize
  // heap with proto here
  protected void reset() {
    Object[] heap = getHeapArray();
    for (int i=1; i< heap.length; i++) {
      heap[i] = proto.copy();
    }
    size = maxSize;
  }

}{code}
 


was (Author: varunthacker):
Here's a version of [SortQueue|[http://example.com|https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/handler/export/SortQueue.java]] looks functionally the same .
{code:java}
class SortQueue extends PriorityQueue<SortDoc> {

  final private SortDoc proto;

  public SortQueue(int len, SortDoc proto) {
    super(len);
    this.proto = proto;
  }

  protected boolean lessThan(SortDoc t1, SortDoc t2) {
    return t1.lessThan(t2);
  }

  // reset get's called even before we collect the first set of docs so we can initialize
  // heap with proto here
  protected void reset() {
    Object[] heap = getHeapArray();
    for (int i=1; i< heap.length; i++) {
      heap[i] = proto.copy();
    }
    size = maxSize;
  }

}{code}
 

> Reuse Lucene's PriorityQueue for the ExportHandler
> --------------------------------------------------
>
>                 Key: SOLR-12587
>                 URL: https://issues.apache.org/jira/browse/SOLR-12587
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Varun Thacker
>            Assignee: Varun Thacker
>            Priority: Major
>
> We have a priority queue in Lucene  {{org.apache.lucene.utilPriorityQueue}} . The Export Handler also implements a PriorityQueue {{org.apache.solr.handler.export.PriorityQueue}} . Both are obviously very similar with minor API differences. 
>  
> The aim here is to reuse Lucene's PQ and remove the Solr implementation. 
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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