Lucene - Core
  1. Lucene - Core
  2. LUCENE-5133

AnalyzingInfixSuggester should return structured highlighted results instead of single String per result

    Details

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

      Description

      Today it renders to an HTML string (<b>..</b> for hits) in protected
      methods that one can override to change the highlighting, but this is
      hard/inefficient to use for search servers that want to e.g. return
      JSON representation of the highlighted result.

      This is the same issue as LUCENE-4906 (PostingsHighlighter) but for
      AnalyzingInfixSuggester's highlights instead.

      1. LUCENE-5133.patch
        14 kB
        Michael McCandless
      2. LUCENE-5133.patch
        17 kB
        Michael McCandless
      3. LUCENE-5133.patch
        17 kB
        Michael McCandless

        Activity

        Hide
        Michael McCandless added a comment -

        Patch, adding another field to LookupResult, holding an array of
        LookupHighlightFragment instances that the caller can concatenate
        back together to make the highlighted string.

        Show
        Michael McCandless added a comment - Patch, adding another field to LookupResult, holding an array of LookupHighlightFragment instances that the caller can concatenate back together to make the highlighted string.
        Hide
        Shai Erera added a comment -

        Patch looks good. A couple of comments on addWholeMatch:

        • The javadocs seem wrong - say that the match is appended to a StringBuilder.
        • The parameter analyzed is not used by the method. If it should be there (for extending classes?), perhaps document what it means?
        Show
        Shai Erera added a comment - Patch looks good. A couple of comments on addWholeMatch: The javadocs seem wrong - say that the match is appended to a StringBuilder. The parameter analyzed is not used by the method. If it should be there (for extending classes?), perhaps document what it means?
        Hide
        Michael McCandless added a comment -

        Thanks Shai, new patch attached.

        Show
        Michael McCandless added a comment - Thanks Shai, new patch attached.
        Hide
        Shai Erera added a comment -

        Looks good.

        Show
        Shai Erera added a comment - Looks good.
        Hide
        Robert Muir added a comment -

        Why not use Object like the patch on LUCENE-4906 and try to get some consistency:
        I can easily see this becoming hell because different expert users want different things.

        It might work for your particular case to have String text + boolean, but other people might want to know crazy things like:

        • score for the passage
        • which multi-valued field instance they hit
        • position or something of the passage within the doc

        In general I also think its really bad to add additional classes that users must learn (the previous api here is "string", which everyone already knows).

        anyway i dont care too much for this class, but I'd hate for us to make this mistake over on LUCENE-4906. I feel like the other highlighters already introduce way too many new classes (besides already known simple ones like IndexSearcher,TopDocs,String, etc) and it makes them difficult to use.

        Show
        Robert Muir added a comment - Why not use Object like the patch on LUCENE-4906 and try to get some consistency: I can easily see this becoming hell because different expert users want different things. It might work for your particular case to have String text + boolean, but other people might want to know crazy things like: score for the passage which multi-valued field instance they hit position or something of the passage within the doc In general I also think its really bad to add additional classes that users must learn (the previous api here is "string", which everyone already knows). anyway i dont care too much for this class, but I'd hate for us to make this mistake over on LUCENE-4906 . I feel like the other highlighters already introduce way too many new classes (besides already known simple ones like IndexSearcher,TopDocs,String, etc) and it makes them difficult to use.
        Hide
        Michael McCandless added a comment -

        OK I'll try to cutover to Object instead.

        Show
        Michael McCandless added a comment - OK I'll try to cutover to Object instead.
        Hide
        Michael McCandless added a comment -

        New patch, cutover to Object.

        It's more work for the [very expert] user since they need to re-implement the entire highlight method ... but I think that's acceptable.

        Show
        Michael McCandless added a comment - New patch, cutover to Object. It's more work for the [very expert] user since they need to re-implement the entire highlight method ... but I think that's acceptable.
        Hide
        Michael McCandless added a comment -

        I think the last patch is ready ... I'll commit soon.

        Show
        Michael McCandless added a comment - I think the last patch is ready ... I'll commit soon.
        Hide
        ASF subversion and git services added a comment -

        Commit 1522666 from Michael McCandless in branch 'dev/branches/branch_4x'
        [ https://svn.apache.org/r1522666 ]

        LUCENE-5133: allow highlight to Object for AnalyzingInfixSuggester for advanced use cases

        Show
        ASF subversion and git services added a comment - Commit 1522666 from Michael McCandless in branch 'dev/branches/branch_4x' [ https://svn.apache.org/r1522666 ] LUCENE-5133 : allow highlight to Object for AnalyzingInfixSuggester for advanced use cases
        Hide
        ASF subversion and git services added a comment -

        Commit 1522667 from Michael McCandless in branch 'dev/trunk'
        [ https://svn.apache.org/r1522667 ]

        LUCENE-5133: allow highlight to Object for AnalyzingInfixSuggester for advanced use cases

        Show
        ASF subversion and git services added a comment - Commit 1522667 from Michael McCandless in branch 'dev/trunk' [ https://svn.apache.org/r1522667 ] LUCENE-5133 : allow highlight to Object for AnalyzingInfixSuggester for advanced use cases

          People

          • Assignee:
            Michael McCandless
            Reporter:
            Michael McCandless
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development