[ 
https://issues.apache.org/jira/browse/LUCENE-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12543915
 ] 

Grant Ingersoll commented on LUCENE-1001:
-----------------------------------------

{quote}
Off the top of my head: the priority queue is used to make sure that the Spans 
are processed by increasing doc numbers and increasing token positions; the 
first and the last Spans determine whether there is a match, and all other 
Spans (in the queue) are "in between".
{quote}
Would it be simpler to just use a SortedSet?  Then we could iterate w/o losing 
the sort, right?  Would this be faster since we wouldn't have to do the heap 
operations?

> Add Payload retrieval to Spans
> ------------------------------
>
>                 Key: LUCENE-1001
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1001
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Search
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>
> It will be nice to have access to payloads when doing SpanQuerys.
> See http://www.gossamer-threads.com/lists/lucene/java-dev/52270 and 
> http://www.gossamer-threads.com/lists/lucene/java-dev/51134
> Current API, added to Spans.java is below.  I will try to post a patch as 
> soon as I can figure out how to make it work for unordered spans (I believe I 
> have all the other cases working).
> {noformat}
>  /**
>    * Returns the payload data for the current span.
>    * This is invalid until [EMAIL PROTECTED] #next()} is called for
>    * the first time.
>    * This method must not be called more than once after each call
>    * of [EMAIL PROTECTED] #next()}. However, payloads are loaded lazily,
>    * so if the payload data for the current position is not needed,
>    * this method may not be called at all for performance reasons.<br>
>    * <br>
>    * <p><font color="#FF0000">
>    * WARNING: The status of the <b>Payloads</b> feature is experimental.
>    * The APIs introduced here might change in the future and will not be
>    * supported anymore in such a case.</font>
>    *
>    * @return a List of byte arrays containing the data of this payload
>    * @throws IOException
>    */
>   // TODO: Remove warning after API has been finalized
>   List/*<byte[]>*/ getPayload() throws IOException;
>   /**
>    * Checks if a payload can be loaded at this position.
>    * <p/>
>    * Payloads can only be loaded once per call to
>    * [EMAIL PROTECTED] #next()}.
>    * <p/>
>    * <p><font color="#FF0000">
>    * WARNING: The status of the <b>Payloads</b> feature is experimental.
>    * The APIs introduced here might change in the future and will not be
>    * supported anymore in such a case.</font>
>    *
>    * @return true if there is a payload available at this position that can 
> be loaded
>    */
>   // TODO: Remove warning after API has been finalized
>   public boolean isPayloadAvailable();
> {noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to