[ http://issues.apache.org/jira/browse/SOLR-24?page=comments#action_12419878 ]
Yonik Seeley commented on SOLR-24: ---------------------------------- I just got a chance to check this out... it's looking good Mike! I think this is something that will be useful to a lot of people. Perhaps highlight=true could be overloaded later to provide alternate ways of highlighting (giving positions rather than inserting <em> in the values). While <em> is a little flawed since it's problematic in field values that may already contain markup, I think it's probably the best/simplest default that people can use easily. Regarding the <lst name="id=theuniqueid">... should this be <lst name="theuinqueid"> without including the field name? Including the unique key field name (which I assume id is), does add a little more info, at the cost of making it harder for clients to use the value. I like that you leave in empty entries like <lst name="id=VS1GB400C3"/> for documents that there are no highlighter fragments for. This makes it possible to access the highlight info by position rather than relying on id correlation. I wasn't able to get multi-valued fields working though. Even if multiple values matched, I would only get a single <str> back in the highlight section. Example with the demo document set: http://localhost:8983/solr/select?q=features:(USB+video+color+includes+MB+memory+display+photo)&indent=on&highlight=true&highlightFields=features <lst name="highlighting"> <lst name="id=MA147LL/A"> <arr name="features"> <str>Stores up to 1515,000 songs, 2525,000 <em>photos</em>, or 150 hours of <em>video</em></str> </arr> </lst> > Add Highlighting to standard request handler > -------------------------------------------- > > Key: SOLR-24 > URL: http://issues.apache.org/jira/browse/SOLR-24 > Project: Solr > Type: New Feature > Components: search > Reporter: Mike Klaas > Attachments: highlight_patch_v1.diff, highlight_patch_v2.diff, > highlight_patch_v3.diff, highlight_patch_v4.diff > > This patch adds highlighting functionality to solr request handlers it also > refactors StandardRequestHandler to use the common functionality provided in > SolrPluginUtils. I'd have preferred to do two separate patches, but creating > two mutually-dependent patches on a repo without being able to commit a > revision was daunting. > ----------------------------------- > Refactoring StandardRequestHandler: > 1. Moved solr.util.CommonParams to its own class. Removed DisMax-specific > parameters, and placed in a subclass. > 2. StandardRequestHandler uses CommonParams to store config-time parameter > values (new feature) > 3. StandardRequestHandler uses SolrPluginUtils methods for duplicate > functionality > 4. Some of said SPU methods have grown a "params" parameter to enable them to > use default values. (Note: instead of passing this around, something like a > RequestHelper class which carries the SolrRequest and Param values would be > useful. This class could house the utility methods that require Request > parameters). > 5. SolrPluginUtils.getParam() only uses the default parameter if it is null, > not blank. > -------------------------------------- > Highlighting: > 1. Highlighting is controlled by three request parameters: > highlight: list of fields to highlight, or highlight the default field if > at all present > maxSnippets: maximum number of snippets to return for each field > highlightFormatterClass: 'solr.<classname>' or full package path of > highlight.Formatter subclass to use in highlighting. > 2. Default formatter is to use <em> tags. There are issues with this > approach, but are mitigated with the ability to specify a custom Formatter. > Definately should consider alternatives (a custom xml approach to denote > highlit regions will require some Highlighter package hackery). > 3. Document summaries are returned as a separate element under <response> > format is still up for discussion. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira