Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-1001

Add Payload retrieval to Spans

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 2.4
    • core/search
    • None
    • Patch Available

    Description

      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).

       /**
         * Returns the payload data for the current span.
         * This is invalid until {@link #next()} is called for
         * the first time.
         * This method must not be called more than once after each call
         * of {@link #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
         * {@link #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();
      

      Attachments

        1. LUCENE-1001.patch
          56 kB
          Mark Miller
        2. LUCENE-1001.patch
          58 kB
          Grant Ingersoll
        3. LUCENE-1001.patch
          55 kB
          Mark Miller
        4. LUCENE-1001.patch
          55 kB
          Mark Miller
        5. LUCENE-1001.patch
          46 kB
          Mark Miller
        6. LUCENE-1001.patch
          43 kB
          Mark Miller
        7. LUCENE-1001.patch
          44 kB
          Grant Ingersoll
        8. LUCENE-1001.patch
          43 kB
          Grant Ingersoll
        9. LUCENE-1001-fix.patch
          7 kB
          Mark Miller

        Issue Links

          Activity

            People

              gsingers Grant Ingersoll
              gsingers Grant Ingersoll
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: