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

GraphTokenStreamFiniteStrings.FiniteStringsTokenStream does not play well with subsequent TokenFilters

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 8.3
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      GraphTokenStreamFiniteStrings provides a view over multiple paths through a Token graph, which is useful when building queries over multiple length synonyms. This view is exposed as an iterator over simple TokenStreams. However, these TokenStreams do not work correctly when further wrapped in token filters, because they do not use a CharTermAttribute.

      For an example of issues this can cause, see https://github.com/elastic/elasticsearch/issues/43976, where elasticsearch uses a special shingle field to speed up phrase searches. Queries are converted to shingles if they have multiple terms. However, if the query resolves into a graph due to synonyms, then this conversion breaks because the FixedShingleFilter is given a token stream built by GTSFS; terms are set using BytesTermAttribute, but then read using CharTermAttribute, and as these have different backing implementations, FSF ends up emitting null tokens.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                romseygeek Alan Woodward
                Reporter:
                romseygeek Alan Woodward
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h
                  1h