The simple boundary scanner

The simple boundary scanner scans term boundaries by the specified maximum character value (hl.bs.maxScan) and common delimiters such as punctuation marks (hl.bs.chars). To implement it, we need to add the following code snippet to the highlighting section in solrconfig.xml:

<boundaryScanner name="simple" class="solr.highlight.SimpleBoundaryScanner" default="true">
<lst name="defaults">
<str name="hl.bs.maxScan">10</str >
<str name="hl.bs.chars">.,!? </str &gt;
</lst >
</boundaryScanner>

Example: Querying for ipod, highlighting for the field name using fastVector highlighter

URL: http://localhost:8983/solr/techproducts/select?hl=true&hl.method=fastVector&q=ipod&hl.fl=name&fl=id,name,cat

Response:

{
"responseHeader":{
"status":0,
"QTime":4,
"params":{
"q":"ipod",
"hl":"true",
"fl":"id,name,cat",
"hl.method":"fastVector",
"hl.fl":"name"}},
"response":{"numFound":3,"start":0,"docs":[
{
"id":"IW-02",
"name":"iPod & iPod Mini USB 2.0 Cable",
"cat":["electronics",
"connector"]},
{
"id":"F8V7067-APL-KIT",
"name":"Belkin Mobile Power Cord for iPod w/ Dock",
"cat":["electronics",
"connector"]},
{
"id":"MA147LL/A",
"name":"Apple 60 GB iPod with Video Playback Black",
"cat":["electronics",
"music"]}]
},
"highlighting":{
"IW-02":{
"name":["<em>iPod</em> & <em>iPod</em> Mini USB 2.0 Cable"]},
"F8V7067-APL-KIT":{
"name":["Belkin Mobile Power Cord for <em>iPod</em> w/ Dock"]},
"MA147LL/A":{
"name":["Apple 60 GB <em>iPod</em> with Video Playback Black"]}}}

The highlighting section includes the ID of each document and the field that contains the highlighted portion. Here we have used the hl.fl parameter to say that we want query terms highlighted in the name field. When there is a match to the query term in that field, it will be included for each document ID in the list. In the same way, we can explore highlighting more by configuring different parameters.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.221.0