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

UnifiedHighlighter should allow extension for custom query types

    Details

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

      Description

      In our use case, we have custom query types (both SpanQuery and non-SpanQuery) which are not provided by Lucene. UnifiedHighlighter needs extension points to handle some custom query types in order for highlighting to be accurate. This issue represents adding two extension point methods to support custom query types.

      1. LUCENE-7544.patch
        23 kB
        David Smiley

        Issue Links

          Activity

          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user michaelbraun opened a pull request:

          https://github.com/apache/lucene-solr/pull/111

          LUCENE-7544 - add UnifiedHighlighter extension points for custom queries

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/michaelbraun/lucene-solr lucene-7544

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/lucene-solr/pull/111.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #111


          commit 871c6d24bca90e32a3c5dc3de54dd48d6229ffc7
          Author: Michael Braun <mbraun38@bloomberg.net>
          Date: 2016-11-07T20:36:41Z

          LUCENE-7544 - add UnifiedHighlighter extension points for custom queries


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user michaelbraun opened a pull request: https://github.com/apache/lucene-solr/pull/111 LUCENE-7544 - add UnifiedHighlighter extension points for custom queries You can merge this pull request into a Git repository by running: $ git pull https://github.com/michaelbraun/lucene-solr lucene-7544 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/lucene-solr/pull/111.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #111 commit 871c6d24bca90e32a3c5dc3de54dd48d6229ffc7 Author: Michael Braun <mbraun38@bloomberg.net> Date: 2016-11-07T20:36:41Z LUCENE-7544 - add UnifiedHighlighter extension points for custom queries
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user dsmiley commented on a diff in the pull request:

          https://github.com/apache/lucene-solr/pull/111#discussion_r86882518

          — Diff: lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestUnifiedHighlighter.java —
          @@ -959,4 +961,84 @@ protected PassageFormatter getFormatter(String field)

          { ir.close(); }

          + public void testBooleanWithSpanAndOverlappingTerms() throws IOException {
          — End diff –

          Can you please simplify this one... it's ultimately testing preSpanQueryRewrite... maybe make it clear that it's testing that by naming the test method as-such? Maybe this test should go into TestUnifiedHighlighterStrictPhrases as it's pertinent to that and not general stuff.

          Show
          githubbot ASF GitHub Bot added a comment - Github user dsmiley commented on a diff in the pull request: https://github.com/apache/lucene-solr/pull/111#discussion_r86882518 — Diff: lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestUnifiedHighlighter.java — @@ -959,4 +961,84 @@ protected PassageFormatter getFormatter(String field) { ir.close(); } + public void testBooleanWithSpanAndOverlappingTerms() throws IOException { — End diff – Can you please simplify this one... it's ultimately testing preSpanQueryRewrite... maybe make it clear that it's testing that by naming the test method as-such? Maybe this test should go into TestUnifiedHighlighterStrictPhrases as it's pertinent to that and not general stuff.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user michaelbraun commented on a diff in the pull request:

          https://github.com/apache/lucene-solr/pull/111#discussion_r86893258

          — Diff: lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestUnifiedHighlighter.java —
          @@ -959,4 +961,84 @@ protected PassageFormatter getFormatter(String field)

          { ir.close(); }

          + public void testBooleanWithSpanAndOverlappingTerms() throws IOException {
          — End diff –

          I will fix the name of the test to clarify and move to the appropriate file. Regarding PhraseHelper, that should probably be a separate issue/commit I'd think, no? Agree it should be have package visibility rather than be public.

          Show
          githubbot ASF GitHub Bot added a comment - Github user michaelbraun commented on a diff in the pull request: https://github.com/apache/lucene-solr/pull/111#discussion_r86893258 — Diff: lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestUnifiedHighlighter.java — @@ -959,4 +961,84 @@ protected PassageFormatter getFormatter(String field) { ir.close(); } + public void testBooleanWithSpanAndOverlappingTerms() throws IOException { — End diff – I will fix the name of the test to clarify and move to the appropriate file. Regarding PhraseHelper, that should probably be a separate issue/commit I'd think, no? Agree it should be have package visibility rather than be public.
          Hide
          dsmiley David Smiley added a comment -

          Here's the patch with some tweaks. "ant precommit" found some issues, which I fixed. I modified MultiTermHighlighting a bit to avoid the need for the extra indentation. It's hard to describe; you can see for yourself. I tweaked the param name too. Let me know if you like it; I'll probably commit Tuesday evening, barring substantive changes.

          Show
          dsmiley David Smiley added a comment - Here's the patch with some tweaks. "ant precommit" found some issues, which I fixed. I modified MultiTermHighlighting a bit to avoid the need for the extra indentation. It's hard to describe; you can see for yourself. I tweaked the param name too. Let me know if you like it; I'll probably commit Tuesday evening, barring substantive changes.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit da841be88774e7a00b4dd954399c7e997bf15d1a in lucene-solr's branch refs/heads/master from David Smiley
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=da841be ]

          LUCENE-7544: UnifiedHighlighter: extension hooks for custom query handling

          Show
          jira-bot ASF subversion and git services added a comment - Commit da841be88774e7a00b4dd954399c7e997bf15d1a in lucene-solr's branch refs/heads/master from David Smiley [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=da841be ] LUCENE-7544 : UnifiedHighlighter: extension hooks for custom query handling
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 868f11a4b51725527b446cae76a052d498e02f74 in lucene-solr's branch refs/heads/branch_6x from David Smiley
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=868f11a ]

          LUCENE-7544: UnifiedHighlighter: extension hooks for custom query handling

          (cherry picked from commit da841be)

          Show
          jira-bot ASF subversion and git services added a comment - Commit 868f11a4b51725527b446cae76a052d498e02f74 in lucene-solr's branch refs/heads/branch_6x from David Smiley [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=868f11a ] LUCENE-7544 : UnifiedHighlighter: extension hooks for custom query handling (cherry picked from commit da841be)
          Hide
          dsmiley David Smiley added a comment -

          Thanks Michael.

          Show
          dsmiley David Smiley added a comment - Thanks Michael.

            People

            • Assignee:
              dsmiley David Smiley
              Reporter:
              mbraun688 Michael Braun
            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development