Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: modules/highlighter
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      I have a problem when using n-gram and highlighter. I thought it had been solved in LUCENE-627...

      Actually, I found this problem when I was using CJKTokenizer on Solr, though, here is lucene program to reproduce it using NGramTokenizer(min=2,max=2) instead of CJKTokenizer:

      public class TestNGramHighlighter {
      
        public static void main(String[] args) throws Exception {
          Analyzer analyzer = new NGramAnalyzer();
          final String TEXT = "Lucene can make index. Then Lucene can search.";
          final String QUERY = "can";
          QueryParser parser = new QueryParser("f",analyzer);
          Query query = parser.parse(QUERY);
          QueryScorer scorer = new QueryScorer(query,"f");
          Highlighter h = new Highlighter( scorer );
          System.out.println( h.getBestFragment(analyzer, "f", TEXT) );
        }
      
        static class NGramAnalyzer extends Analyzer {
          public TokenStream tokenStream(String field, Reader input) {
            return new NGramTokenizer(input,2,2);
          }
        }
      }
      

      expected output is:
      Lucene <B>can</B> make index. Then Lucene <B>can</B> search.

      but the actual output is:
      Lucene <B>can make index. Then Lucene can</B> search.

      1. LUCENE-1489.patch
        3 kB
        David Bowen
      2. lucene1489.patch
        3 kB
        David Bowen

        Activity

        Koji Sekiguchi created issue -
        David Bowen made changes -
        Field Original Value New Value
        Attachment lucene1489.patch [ 12421091 ]
        David Bowen made changes -
        Attachment LUCENE-1489.patch [ 12427643 ]
        Mark Thomas made changes -
        Workflow jira [ 12448335 ] Default workflow, editable Closed status [ 12562487 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12562487 ] jira [ 12584773 ]
        Koji Sekiguchi made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Won't Fix [ 2 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Koji Sekiguchi
          • Votes:
            3 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development