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

Fix analyzer bugs documented in TestRandomChains

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Patch Available
    • Major
    • Resolution: Unresolved
    • None
    • None
    • modules/analysis
    • None
    • New

    Description

      TestRandomChains.java found a lot of bugs, some of which are hard to fix. So we blacklisted certain analysis components from the test.

      But we really need to fix these, some of these bugs are bad, and they impact users with e.g. highlighting (SOLR-4137 and so on):

        // TODO: fix those and remove
        private static final Set<Class<?>> brokenComponents = Collections.newSetFromMap(new IdentityHashMap<Class<?>,Boolean>());
        static {
          // TODO: can we promote some of these to be only
          // offsets offenders?
          Collections.<Class<?>>addAll(brokenComponents,
            // TODO: fix basetokenstreamtestcase not to trip because this one has no CharTermAtt
            EmptyTokenizer.class,
            // doesn't actual reset itself!
            CachingTokenFilter.class,
            // doesn't consume whole stream!
            LimitTokenCountFilter.class,
            // Not broken: we forcefully add this, so we shouldn't
            // also randomly pick it:
            ValidatingTokenFilter.class,
            // NOTE: these by themselves won't cause any 'basic assertions' to fail.
            // but see https://issues.apache.org/jira/browse/LUCENE-3920, if any 
            // tokenfilter that combines words (e.g. shingles) comes after them,
            // this will create bogus offsets because their 'offsets go backwards',
            // causing shingle or whatever to make a single token with a 
            // startOffset thats > its endOffset
            // (see LUCENE-3738 for a list of other offenders here)
            // broken!
            NGramTokenizer.class,
            // broken!
            NGramTokenFilter.class,
            // broken!
            EdgeNGramTokenizer.class,
            // broken!
            EdgeNGramTokenFilter.class,
            // broken!
            WordDelimiterFilter.class,
            // broken!
            TrimFilter.class
          );
        }
      
        // TODO: also fix these and remove (maybe):
        // Classes that don't produce consistent graph offsets:
        private static final Set<Class<?>> brokenOffsetsComponents = Collections.newSetFromMap(new IdentityHashMap<Class<?>,Boolean>());
        static {
          Collections.<Class<?>>addAll(brokenOffsetsComponents,
            ReversePathHierarchyTokenizer.class,
            PathHierarchyTokenizer.class,
            HyphenationCompoundWordTokenFilter.class,
            DictionaryCompoundWordTokenFilter.class,
            // TODO: corrumpts graphs (offset consistency check):
            PositionFilter.class,
            // TODO: it seems to mess up offsets!?
            WikipediaTokenizer.class,
            // TODO: doesn't handle graph inputs
            ThaiWordFilter.class,
            // TODO: doesn't handle graph inputs
            CJKBigramFilter.class,
            // TODO: doesn't handle graph inputs (or even look at positionIncrement)
            HyphenatedWordsFilter.class,
            // LUCENE-4065: only if you pass 'false' to enablePositionIncrements!
            TypeTokenFilter.class,
            // TODO: doesn't handle graph inputs
            CommonGramsQueryFilter.class
          );
        }
      

      Attachments

        1. LUCENE-4641_tests.patch
          35 kB
          Robert Muir

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rcmuir Robert Muir
              Votes:
              3 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated: