Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
dev:sql:functions:context:home [2009/12/04 04:14]
tdo created
dev:sql:functions:context:home [2016/06/28 22:38] (current)
Line 1: Line 1:
 {{page>:​top_add&​nofooter&​noeditbtn}} {{page>:​top_add&​nofooter&​noeditbtn}}
 <​html><​div align="​center"><​span style="​color:​red">​DRAFT</​span></​div></​html>​ <​html><​div align="​center"><​span style="​color:​red">​DRAFT</​span></​div></​html>​
 +===== Omnidex SQL Function: $CONTEXT =====
  
-===== $CONTEXT ​===== +===== Description ​=====
 The $CONTEXT function is used to retrieve small excerpts from a document containing the search criteria. ​ The $CONTEXT function returns the words adjacent to the criteria, formatting them if requested so that they keywords are easily visible. ​ The $CONTEXT function can return multiple of these contexts in one string, allowing the user to see the various locations which led to an entry being qualified. The $CONTEXT function is used to retrieve small excerpts from a document containing the search criteria. ​ The $CONTEXT function returns the words adjacent to the criteria, formatting them if requested so that they keywords are easily visible. ​ The $CONTEXT function can return multiple of these contexts in one string, allowing the user to see the various locations which led to an entry being qualified.
  
 +The $CONTEXT function is a select list item that retrieves excerpts, or windows, from a document showing the context in which a row matched the qualification criteria from a $CONTAINS criteria predicate. It shows the context in which the search criteria occurred in the document, without the cost of trafficking the entire document. Snippets of the original text, including the keywords and words around it, are returned to the application.
 +
 +This can prove useful in two ways. First, it allows a distillation of the row to be retrieved without incurring the cost of trafficking large amounts of data. This can make a tremendous difference in the application performance. Second, it provides a concise and convenient method of communicating the essence of the row to the user. A large amount of content is difficult for a user to absorb, but excerpts from a document can be quickly understood.
 +
 +$CONTEXT is used in conjunction with $CONTAINS, meaning the search criteria MUST be stated in a $CONTAINS function in a WHERE clause predicate. Additionally,​ a matching label must be specified in both the $CONTEXT and $CONTAINS functions, when the SQL statement contains multiple $CONTAINS criteria predicates.
 ==== Syntax ==== ==== Syntax ====
  
Line 14: Line 19:
  
 == options == == options ==
-An optional parameter that controls options for the function. ​ Valid options are:+An optional parameter that controls options for the function. ​The entire options string must be enclosed inside single quotes. '​options list'.  
 + 
 +Multiple options can be passed, space separated with the entire options list enclosed in single quotes. 
 + 
 +If, however, the value argument of any option=value pair contains any spaces, the value portion must be enclosed in escaped single quotes, as follows: '​style=html highlight=\'<​span onclick="​runFunc();">​\''​ 
 + 
 +Valid options are:
  
 == MAXCONTEXTS=n == == MAXCONTEXTS=n ==
Line 50: Line 61:
 == label == == label ==
 An optional label that describes this particular search. ​ This label is not needed unless multiple $CONTAINS functions are used in the SQL statement. ​ This label refers to the label used in the $CONTAINS function. The label is case-insensitive,​ and may be up to 32 characters long. An optional label that describes this particular search. ​ This label is not needed unless multiple $CONTAINS functions are used in the SQL statement. ​ This label refers to the label used in the $CONTAINS function. The label is case-insensitive,​ and may be up to 32 characters long.
 +==== Options ====
 +END_HIGHLIGHT ​
 +
 +===== Example =====
 +<​code>​
 +SELECT title, $score, $context FROM books
 +WHERE $contains(content,​ 'white rabbit',​ '​synonyms'​)
 +ORDER BY $score
 +
 +Alice'​s Adventures in Wonderland
 +79.050003
 +--- daisies, when suddenly a White Rabbit with pink eyes ran --- It was the
 +>> White Rabbit returning, splendidly dressed, with --- Bill It was the
 +>> White Rabbit, trotting slowly back again, ---
 +
 +The Adventures of Huckleberry Finn
 +29.570000
 +--- de on'y white genlman dat ever...the spunk of a rabbit. --- Is your man
 +>> white or black?"​ I...the spunk of a rabbit. --- the spunk of a rabbit.
 +>> I see I...up and says: "​He'​s white."​ ---
 +
 +Webster'​s Revised Unabridged Dictionary (1913)
 +18.160000
 +--- a yellow disk and white or pinkish...ashkoko,​ dassy, and rock rabbit.
 +>> --- ashkoko, dassy, and rock rabbit. See Cony, and...brocade. Dambonite
 +>> (n.) A white, crystalline,​ sugary substance obtained ---
 +
 +The Taming of the Shrew
 +2.860000
 +--- parsley to stuff a rabbit; and so may...gentlewoman?​ Such war of white
 +>> and red within her ---
 +
 +Webster'​s Revised Unabridged Dictionary (1913)
 +18.160000
 +--- a yellow disk and white or pinkish...ashkoko,​ dassy, and rock rabbit.
 +>> --- ashkoko, dassy, and rock rabbit. See Cony, and...brocade. Dambonite
 +>> (n.) A white, crystalline,​ sugary substance obtained ---
 +
 +The Taming of the Shrew
 +2.860000
 +--- parsley to stuff a rabbit; and so may...gentlewoman?​ Such war of white
 +>> and red within her ---
  
 +The Adventures of Tom Sawyer
 +2.860000
 +--- a hunted and helpless rabbit look as she...her face--it was white with
 +>> terror] --"did you ---
 +</​code>​
  
  
 
Back to top
dev/sql/functions/context/home.1259900083.txt.gz · Last modified: 2016/06/28 22:38 (external edit)