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

An IndexReader with run-time support for synonyms

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 2.1
    • None
    • core/index
    • None
    • New

    Description

      These classes provide support for enabling the use of synonyms for terms in an existing index.

      While Analyzers can be used at Query-parse time or Index-time to inject synonyms these are not always satisfactory means of providing support for synonyms:

      • Index-time injection of synonyms is less flexible because changing the lists of synonyms requires an index rebuild.
      • Query-parse-time injection is awkward because special support is required in the parser/query logic to recognise and cater for the tokens that appear in the same position. Additionally, any statistical analysis of the index content via TermEnum/TermDocs etc does not consider the synonyms unless specific code is added.

      What is perhaps more useful is a transparent wrapper for the IndexReader that provides a synonym-ized view of the index without requiring specialised support in the calling code. All of the TermEnum/TermDocs interfaces remain the same but behind the scenes synonyms are being considered/applied silently.

      The classes supplied here provide this "virtual" view of the index and all queries or other code that examines this index using the special reader benefit from this view without requiring specialized code. A Junit test illustrates this code in action.

      Attachments

        1. Synonym.java
          2 kB
          Mark Harwood
        2. SynonymIndexReader.java
          13 kB
          Mark Harwood
        3. SynonymSet.java
          2 kB
          Mark Harwood
        4. TestSynonymIndexReader.java
          3 kB
          Mark Harwood

        Activity

          People

            mharwood Mark Harwood
            mharwood Mark Harwood
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: