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

getPositionIncrementGap(String fieldname, int currentPos)

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • 2.4
    • None
    • core/search
    • None
    • New, Patch Available

    Description

      This issue is to cover the changes required to do a search across multiple fields with the same name in a fashion similar to a many-to-one database. Below is my post on java-dev on the topic, which details the changes we need:

      (sniped to only second idea ... see LUCENE-1494 for background and first idea)

      2) It gets slightly more complicated in the case of variable-length terms. For example, imagine if we had an 'address' field ('123 Smith St') which will result in (1 to n) tokens; slop 0 in a SpanNearQuery won't work here, of course. One thing we've toyed with is the idea of using getPositionIncrementGap – if we knew that 'address' would be, at most, 20 tokens, we might use a position increment gap of 100, and make the slop factor 50; this works fine for the simple case (yay!), but with a great many addresses-per-user starts to get more complicated, as the gap counts from the last term (so the position sequence for a single value field might be 0, 100, 200, but for the address field it might be 0, 1, 2, 3, 103, 104, 105, 106, 206, 207... so it's going to get out of sync). The simplest option here seems to be changing (or supplementing)
      public int getPositionIncrementGap(String fieldname)
      to
      public int getPositionIncrementGap(String fieldname, int currentPos)
      so that we can override that to round up to the nearest 100 (or whatever) based on currentPos. The default implementation could just delegate to getPositionIncrementGap().

      Attachments

        1. LUCENE-1626-positionincrement.patch
          6 kB
          Chris M. Hostetter

        Issue Links

          Activity

            People

              Unassigned Unassigned
              pcowan Paul Cowan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: