[ https://issues.apache.org/jira/browse/JENA-1459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16314794#comment-16314794 ]
ASF GitHub Bot commented on JENA-1459: -------------------------------------- GitHub user xristy opened a pull request: https://github.com/apache/jena/pull/339 resolve JENA-1459 add jena text highlighting This PR adds the highlighting feature describe in JENA-1459. This PR includes unit tests for the highlighting feature. Once the PR is approved, I'll submit an update to the jena-text documentation. You can merge this pull request into a Git repository by running: $ git pull https://github.com/BuddhistDigitalResourceCenter/jena JENA-1459-Highlighting Alternatively you can review and apply these changes as the patch at: https://github.com/apache/jena/pull/339.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 #339 ---- commit 1299d653d295f3dfebaeb25984d8e5d55c3f5245 Author: Chris Tomlinson <ct@...> Date: 2018-01-06T17:53:50Z Merged Highlighting ---- > add highlighting support to jena-text > ------------------------------------- > > Key: JENA-1459 > URL: https://issues.apache.org/jira/browse/JENA-1459 > Project: Apache Jena > Issue Type: Improvement > Components: Jena, Text > Affects Versions: Jena 3.6.0 > Reporter: Code Ferret > Assignee: Code Ferret > Original Estimate: 24h > Remaining Estimate: 24h > > This issue proposes an improvement to jena-text to include optional > highlighting of results via: > {{org.apache.lucene.search.highlight.Highlighter}} > and > {{org.apache.lucene.search.highlight.SimpleHTMLFormatter}} > The improvement will add an optional input argument to {{TextQueryPF}} that > signals that highlighting should be performed on the Lucene search results; > optionally indicates the _start_ and _end_ char sequences of a highlighted > term; optionally indicates the maximum number of fragments to highlight; and > optionally indicates a fragment separator. > The highlighted results are bound to the {{?literal}} output argument of > {{TextQueryPF}}. > Inclusion of this improvement will introduce a simple extraction of the > _highlight_ option string and a single test for the presence of the option > string so that the inclusion of the improvement will be of minimal impact > when highlighting is not used. The _highlight_ option string is passed > directly to {{TextIndex.query(...)}} and so can be used from code other than > {{TextQueryPF}}. > The simplest use of highlighting is like: > {code} > select ?s ?lit > where { > (?s ?sc ?lit) text:query (skos:prefLabel "one" 100 "lang:en" "highlight:") . > } > {code} > which will produce results such as: > {code} > "another ↦one↤ abc"@en > {code} > the right-arrow (\u21a6) and left-arrow (\u21a4) are the default _start_ and > _end_ highlighting character sequences. These are chosen to be very unlikely > to occur in literals. These can be changed easily via {{"s:"}} and {{"e:"}} > in the highlight options, for example: > {code} > select ?s ?lit > where { > (?s ?sc ?lit) text:query (skos:prefLabel "one" 100 "lang:en" "highlight: > s:<em class='hilite'> | e:</em>") . > {code} > which will produce results such as: > {code} > "another <em class='hilite'>one</em> abc"@en > {code} > Coding of this improvement is complete and a PR can be issued if there is > agreement that this improvement should be included in jena-text. -- This message was sent by Atlassian JIRA (v6.4.14#64029)