js-solr-highlighter
Advanced tools
Comparing version 0.7.2 to 0.7.3
@@ -537,3 +537,3 @@ import { isStopWord, highlightByQuery } from './index.js' | ||
const content = | ||
"Pediatric non-red cell blood product transfusion practices: what's the evidence to guide transfusion of the 'yellow' blood products?" | ||
'Pediatric non-red cell blood product transfusion practices: what\'s the evidence to guide transfusion of the \'yellow\' blood products?' | ||
const received = highlightByQuery(query, content, { | ||
@@ -546,2 +546,26 @@ highlightAll: false | ||
}) | ||
test('breast cancer', () => { | ||
const query = 'breast cancer' | ||
const content = | ||
'Editorial: The Role of Breast Cancer Stem Cells in Clinical Outcomes.' | ||
const received = highlightByQuery(query, content, { | ||
highlightIdPattern: 'new-highlight-' | ||
}) | ||
const expected = | ||
'Editorial: The Role of <span id=\"new-highlight-0\" class=\"highlight\">Breast</span> <span id=\"new-highlight-1\" class=\"highlight\">Cancer</span> Stem Cells in Clinical Outcomes.' | ||
expect(received).toBe(expected) | ||
}) | ||
test('breast cancer', () => { | ||
const query = 'breast cancer' | ||
const content = | ||
'Editorial: The Role of Breast Cancer Stem Cells in Clinical Outcomes.' | ||
const received = highlightByQuery(query, content, { | ||
highlightClass: 'new-highlight' | ||
}) | ||
const expected = | ||
'Editorial: The Role of <span id=\"highlight-0\" class=\"new-highlight\">Breast</span> <span id=\"highlight-1\" class=\"new-highlight\">Cancer</span> Stem Cells in Clinical Outcomes.' | ||
expect(received).toBe(expected) | ||
}) | ||
}) | ||
@@ -548,0 +572,0 @@ |
{ | ||
"name": "js-solr-highlighter", | ||
"version": "0.7.2", | ||
"version": "0.7.3", | ||
"description": "A JavaScript library for highlighting HTML text based on the query in the lucene/solr query syntax", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
@@ -46,4 +46,4 @@ # js-solr-highlighter | ||
| highlightAll | boolean | highlightAll indicates whether to highlight all occurances of the text or the first found occurance only.<br />If undefined, it is true. | | ||
| highlightIdPattern | string | highlightIdPattern is the same pattern of the IDs associated with the highlights in the HTML.<br />A highlight ID consists of highlightIdPattern followed by the index of the highlight, such as "highlight-0", "highlight-1"...<br />If undefined, it is "highlight-" | | ||
| highlightClass | string | highlightClass is the classname of every highlight in the HTML. If undefined, it is "highlight" | | ||
| highlightIdPattern | string | highlightIdPattern is the same pattern of the IDs associated with the highlights in the HTML.<br />A highlight ID consists of highlightIdPattern followed by the index of the highlight, such as "highlight-0", "highlight-1"...<br />If undefined, it is "highlight-". | | ||
| highlightClass | string | highlightClass is the classname of every highlight in the HTML.<br />If undefined, it is "highlight". | | ||
@@ -50,0 +50,0 @@ ## Highlighting rules |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
652926
954