Solr
  1. Solr
  2. SOLR-1696

Deprecate old <highlighting> syntax and move configuration to HighlightComponent

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.5, 3.1, 4.0-ALPHA
    • Component/s: highlighter
    • Labels:
      None

      Description

      There is no reason why we should have a custom syntax for highlighter configuration.

      It can be treated like any other SearchComponent and all the configuration can go in there.

      1. SOLR-1696.patch
        11 kB
        Koji Sekiguchi
      2. SOLR-1696.patch
        10 kB
        Noble Paul

        Activity

        Hide
        Noble Paul added a comment - - edited

        The new syntax can be as follows

        <searchComponent class="solr.HighLightComponent" name="highlight">
          <highlighting class="DefaultSolrHighlighter">
           <!-- Configure the standard fragmenter -->
           <!-- This could most likely be commented out in the "default" case -->
           <fragmenter name="gap" class="org.apache.solr.highlight.GapFragmenter" default="true">
            <lst name="defaults">
             <int name="hl.fragsize">100</int>
            </lst>
           </fragmenter>
        
           <!-- A regular-expression-based fragmenter (f.i., for sentence extraction) -->
           <fragmenter name="regex" class="org.apache.solr.highlight.RegexFragmenter">
            <lst name="defaults">
              <!-- slightly smaller fragsizes work better because of slop -->
              <int name="hl.fragsize">70</int>
              <!-- allow 50% slop on fragment sizes -->
              <float name="hl.regex.slop">0.5</float>
              <!-- a basic sentence pattern -->
              <str name="hl.regex.pattern">[-\w ,/\n\"']{20,200}</str>
            </lst>
           </fragmenter>
        
           <!-- Configure the standard formatter -->
           <formatter name="html" class="org.apache.solr.highlight.HtmlFormatter" default="true">
            <lst name="defaults">
             <str name="hl.simple.pre"><![CDATA[<em>]]></str>
             <str name="hl.simple.post"><![CDATA[</em>]]></str>
            </lst>
           </formatter>
          </highlighting>
        </searchComponent>
        

        This way SolrCore can be totally agnostic of highlighter

        Show
        Noble Paul added a comment - - edited The new syntax can be as follows <searchComponent class= "solr.HighLightComponent" name= "highlight" > <highlighting class= "DefaultSolrHighlighter" > <!-- Configure the standard fragmenter --> <!-- This could most likely be commented out in the "default" case --> <fragmenter name= "gap" class= "org.apache.solr.highlight.GapFragmenter" default= "true" > <lst name= "defaults" > <int name= "hl.fragsize" > 100 </int> </lst> </fragmenter> <!-- A regular-expression-based fragmenter (f.i., for sentence extraction) --> <fragmenter name= "regex" class= "org.apache.solr.highlight.RegexFragmenter" > <lst name= "defaults" > <!-- slightly smaller fragsizes work better because of slop --> <int name= "hl.fragsize" > 70 </int> <!-- allow 50% slop on fragment sizes --> <float name= "hl.regex.slop" > 0.5 </float> <!-- a basic sentence pattern --> <str name= "hl.regex.pattern" > [-\w ,/\n\"']{20,200} </str> </lst> </fragmenter> <!-- Configure the standard formatter --> <formatter name= "html" class= "org.apache.solr.highlight.HtmlFormatter" default= "true" > <lst name= "defaults" > <str name= "hl.simple.pre" > <![CDATA[<em> ]]> </str> <str name= "hl.simple.post" > <![CDATA[</em> ]]> </str> </lst> </formatter> </highlighting> </searchComponent> This way SolrCore can be totally agnostic of highlighter
        Hide
        Noble Paul added a comment -

        The old syntax is deprecated and all the code moves in into HighlightComponent. SolrCore is agnostic of loading and managing HighlightComponent

        Show
        Noble Paul added a comment - The old syntax is deprecated and all the code moves in into HighlightComponent. SolrCore is agnostic of loading and managing HighlightComponent
        Hide
        Chris Male added a comment -

        Are you planning on logging a warning if they continue to use the deprecated syntax?

        Show
        Chris Male added a comment - Are you planning on logging a warning if they continue to use the deprecated syntax?
        Hide
        Koji Sekiguchi added a comment -

        Noble, thank you for opening this and attaching the patch! Are you planning to commit this shortly? because I'm ready to commit SOLR-1268 that is using old style config. If you commit it, I'll rewrite SOLR-1268. Or I can assign SOLR-1696 to me.

        Show
        Koji Sekiguchi added a comment - Noble, thank you for opening this and attaching the patch! Are you planning to commit this shortly? because I'm ready to commit SOLR-1268 that is using old style config. If you commit it, I'll rewrite SOLR-1268 . Or I can assign SOLR-1696 to me.
        Hide
        Koji Sekiguchi added a comment -

        I've just committed SOLR-1268. Now I'm trying to contribute a patch for this to sync with trunk...

        Show
        Koji Sekiguchi added a comment - I've just committed SOLR-1268 . Now I'm trying to contribute a patch for this to sync with trunk...
        Hide
        Koji Sekiguchi added a comment -

        A new patch attached. Just to sync with trunk plus warning log when deprecated syntax is found (the idea Chris mentioned above).

        Show
        Koji Sekiguchi added a comment - A new patch attached. Just to sync with trunk plus warning log when deprecated syntax is found (the idea Chris mentioned above).
        Hide
        Noble Paul added a comment -

        committed r899572

        Show
        Noble Paul added a comment - committed r899572
        Hide
        Hoss Man added a comment -

        Correcting Fix Version based on CHANGES.txt, see this thread for more details...

        http://mail-archives.apache.org/mod_mbox/lucene-dev/201005.mbox/%3Calpine.DEB.1.10.1005251052040.24672@radix.cryptio.net%3E

        Show
        Hoss Man added a comment - Correcting Fix Version based on CHANGES.txt, see this thread for more details... http://mail-archives.apache.org/mod_mbox/lucene-dev/201005.mbox/%3Calpine.DEB.1.10.1005251052040.24672@radix.cryptio.net%3E
        Hide
        Grant Ingersoll added a comment -

        Bulk close for 3.1.0 release

        Show
        Grant Ingersoll added a comment - Bulk close for 3.1.0 release

          People

          • Assignee:
            Noble Paul
            Reporter:
            Noble Paul
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development