# 22. Virtuoso Functions Guide - search_excerpt

Chapter Contents | Prev | Next
Keyword Search:
www.openlinksw.com
docs.openlinksw.com
Book Home
Contents
Preface
Virtuoso Functions Guide
Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
Remote SQL Data Source
Replication
SOAP
SQL
String
ascii
atoi
blob_to_string
blob_to_string_outpu...
chr
initcap
isblob
isstring
lcase
left
length
locate
ltrim
make_string
regexp_instr
regexp_like
regexp_match
regexp_parse
regexp_replace
regexp_substr
repeat
replace
right
rtrim
search_excerpt
serialize
space
split_and_decode
sprintf
strcasestr
strchr
string_output
string_output_flush
string_output_gz_com...
string_output_string
string_to_file
strrchr
strstr
subseq
substring
tmp_file_name
trim
ucase
upper
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web Server & Internet
XML
XPATH & XQUERY
Functions Index

## search_excerpt

Returns excerpts with hit words from text
search_excerpt (in hit_words any, in text varchar, [in within_first int], [in max_excerpt int], [in total int], [in html_hit_tag varchar]);
Description

This function produces representative samples for use in displaying a query hit. There are two modes: html mode and text mode. In html mode everything looks like html tags is ignored and searching of excerpt begins from <body> tag. All found hit words highlighted by html_hit_tag.

In text mode text is treated as plain text, html tag detection is disabled and hit words is not highlighted.

Parameters
hit_words – array of hit words to be found in text. Number of hit words can not be more than 10.
text – original text where hit words are searched
within_first – number of chars in text from the start to consider. Default value is 20000.
max_excerpt – maximum length of single excerpt phrase. Default value is 90.
total – maximum length of whole excerpt. Default value is 200.
html_hit_tag – HTML tag which is used to highlight hit words in excerpt. Default value is "b". If it is NULL text mode is used
Return Types

varchar

Examples
Creating search excerpt

creates a search excerpt from found DAV resource

    for select RES_CONTENT from WS.WS.SYS_DAV_RES
     where contains (RES_CONTENT, 'place and knowledge')
    do {
      http_value (search_excerpt (vector ('place', 'knowledge'),
                                  cast (RES_CONTENT as varchar),
    			      200000, 90, 200, 'b', 1),
    	      'P');
    }