Solr
  1. Solr
  2. SOLR-516

Add hl.alternateFieldLen parameter, to set max length for hl.alternateField

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: highlighter
    • Labels:
      None

      Description

      USE CASE:
      You have a document that is composed of (short) title and (long) body fields and want body to be highlighted.
      In order to avoid highlighted body field to be empty, you can use hl.alternateField parameter.
      Although you want to set f.body.hl.alternateField=body, you may set f.body.hl.alternateField=title,
      because response time is awful when the body values are big. But the title field provides users with
      information smaller than body field.
      In this case, you can use f.body.hl.alternateFieldLen=100 to limit the body length to 100 characters.

      1. SOLR-516-solr-ruby.patch
        0.6 kB
        Koji Sekiguchi
      2. SOLR-516.patch
        3 kB
        Koji Sekiguchi
      3. SOLR-516.patch
        4 kB
        Koji Sekiguchi

        Issue Links

          Activity

          Hide
          Koji Sekiguchi added a comment -

          Added a test case.

          Show
          Koji Sekiguchi added a comment - Added a test case.
          Hide
          Koji Sekiguchi added a comment -

          attached a patch for solr-ruby.

          Show
          Koji Sekiguchi added a comment - attached a patch for solr-ruby.
          Hide
          Mike Klaas added a comment -

          A quite reasonable addition, thanks!. I commited the core patch but named the parameter hl.maxAlternateFieldLength. Since it is so long anyway, it doesn't hurt to be explicit.

          I have zero familiarity with the ruby side of Solr, so I will leave the issue open for the ruby client patch to be reviewed and applied.

          Show
          Mike Klaas added a comment - A quite reasonable addition, thanks!. I commited the core patch but named the parameter hl.maxAlternateFieldLength. Since it is so long anyway, it doesn't hurt to be explicit. I have zero familiarity with the ruby side of Solr, so I will leave the issue open for the ruby client patch to be reviewed and applied.

            People

            • Assignee:
              Mike Klaas
              Reporter:
              Koji Sekiguchi
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development