Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
admin:indexing:text:results [2012/01/31 21:57]
doc
admin:indexing:text:results [2016/06/28 22:38] (current)
Line 10: Line 10:
 [[admin:​indexing:​text:​retrieve|External Files]] |  [[admin:​indexing:​text:​retrieve|External Files]] | 
 [[admin:​indexing:​text:​proximity|Proximity Searches]] |  [[admin:​indexing:​text:​proximity|Proximity Searches]] | 
 +[[admin:​indexing:​text:​advanced|Advanced Searches]] | 
 **[[admin:​indexing:​text:​results|Displaying Results]]** |  **[[admin:​indexing:​text:​results|Displaying Results]]** | 
 [[admin:​indexing:​text:​relevancy|Relevancy]] [[admin:​indexing:​text:​relevancy|Relevancy]]
Line 21: Line 22:
 Omnidex allows excerpts to be retrieved from large blocks of text to make viewing easier. ​ These excerpts show the portions of the text that qualified the row, with the search terms highlighted.  ​ Omnidex allows excerpts to be retrieved from large blocks of text to make viewing easier. ​ These excerpts show the portions of the text that qualified the row, with the search terms highlighted.  ​
  
-Excerpts are retrieved using the $CONTEXT function. ​ The $CONTEXT function works hand-in-hand with the $CONTAINS function. ​ The $CONTAINS function is used to label a particular ​proximity ​search, and the $CONTEXT function retrieves excerpts for that same label. ​ This is needed before there may be other criteria in the SQL statement, and even multiple Proximity Searches against multiple columns and tables. ​ Only one Proximity Search can feed these excerpts, necessitating the pairing of the $CONTAINS function and the $CONTEXT function. +Excerpts are retrieved using the $CONTEXT function. ​ The $CONTEXT function works hand-in-hand with the $CONTAINS function. ​ The $CONTAINS function is used to label a particular search, and the $CONTEXT function retrieves excerpts for that same label. ​ This is needed before there may be other criteria in the SQL statement, and even multiple Proximity Searches against multiple columns and tables. ​ Only one Proximity Search can feed these excerpts, necessitating the pairing of the $CONTAINS function and the $CONTEXT function.
- +
-=== $CONTAINS Function === +
- +
-The [[dev:​sql:​functions:​contains|$CONTAINS]] function allows a specific WHERE clause predicate to be labelled, and also allows options that control the search. ​ In its simplest form, the following two statements are identical:​ +
- +
-<code SQL> +
-> select title from books where language = '​English';​ +
- +
-TITLE +
------------------------------------------------------------------------------ +
-Alice'​s Adventures in Wonderland +
-Around the World in Eighty Days +
-Hamlet +
-The Adventures of Tom Sawyer +
-The Wonderful Wizard of Oz +
-5 rows returned +
-+
-> select title from books where $contains(language,​ '​English'​);​ +
- +
-TITLE +
------------------------------------------------------------------------------ +
-Alice'​s Adventures in Wonderland +
-Around the World in Eighty Days +
-Hamlet +
-The Adventures of Tom Sawyer +
-The Wonderful Wizard of Oz +
-5 rows returned +
-+
-</​code>​ +
- +
-The $CONTAINS function also allows options that manually engage the PowerSearch features, such as misspellings,​ synonyms, etc.   +
- +
-<​code>​ +
-> select title from books where $contains(content,​ '​missisipi','​misspellings'​);​ +
- +
-TITLE +
------------------------------------------------------------------------------ +
-Around the World in Eighty Days +
-The Adventures of Tom Sawyer +
-2 rows returned +
-</​code>​ +
- +
-The $CONTAINS function allows criteria to be labelled for eventual pairing with excerpts using the $CONTEXT function or relevancy scoring using the $SCORE function: +
- +
-<​code>​ +
-> select ​       TITLE +
->> ​ from        BOOKS +
->> ​ where       ​$contains(LANGUAGE,​ '​English',,​ '​LANGUAGE'​) and +
->> ​             $contains(CONTENT,​ '​missisipi',​ '​misspellings',​ '​CONTENT'​);​ +
- +
-TITLE +
------------------------------------------------------------------------------ +
-Around the World in Eighty Days +
-The Adventures of Tom Sawyer +
-2 rows returned +
-</​code>​+
  
 === $CONTEXT Function === === $CONTEXT Function ===
Line 83: Line 28:
 The [[dev:​sql:​functions:​context|$CONTEXT]] function retrieves excerpts of a text field based on a paired $CONTAINS function. ​ By default, a simple excerpt is displayed; however, options exist to allow embedding HTML tags to highlight the search terms for easy display in a web environment.  ​ The [[dev:​sql:​functions:​context|$CONTEXT]] function retrieves excerpts of a text field based on a paired $CONTAINS function. ​ By default, a simple excerpt is displayed; however, options exist to allow embedding HTML tags to highlight the search terms for easy display in a web environment.  ​
  
-<​code ​SQL>+<​code>​
 > select ​       TITLE, > select ​       TITLE,
 >> ​             $context >> ​             $context
Line 100: Line 45:
 >> *Mississippi* rolling by! --- >> *Mississippi* rolling by! ---
 2 rows returned 2 rows returned
-<edit/code>+</​code>​
  
 Excerpts can be easily formatted for display using HTML, including assigning CSS classes as needed: Excerpts can be easily formatted for display using HTML, including assigning CSS classes as needed:
  
-<​code ​SQL>+<​code>​
 > select ​       TITLE, > select ​       TITLE,
 >> ​             $context(255,​ '​STYLE=HTML CLASSES'​) >> ​             $context(255,​ '​STYLE=HTML CLASSES'​)
Line 124: Line 69:
 </​code>​ </​code>​
  
 +If the statement contains multiple $CONTAINS functions, they should be labelled with distinct names, and the $CONTEXT should reference the appropriate $CONTAINS clause. ​ The excerpts will be created based on that column'​s criteria.
 +
 +<​code>​
 +> select ​       TITLE,
 +>> ​             $CONTEXT(255,​ '​STYLE=TEXT',​ '​CONTENT'​)
 +>> ​ from        BOOKS
 +>> ​ where       ​$contains(LANGUAGE,​ '​English',,​ '​LANGUAGE'​) and
 +>> ​             $contains(CONTENT,​ '​missisipi',​ '​misspellings',​ '​CONTENT'​);​
 +
 +TITLE
 +-----------------------------------------------------------------------------
 +$CONTEXT(BOOKS.CONTENT)
 +-----------------------------------------------------------------------------
 +Around the World in Eighty Days
 +--- at Nauvoo, on the *Mississippi*,​ numbering twenty-five thousand ---
 +>> night it crossed the *Mississippi* at Davenport, and by ---
 +The Adventures of Tom Sawyer
 +--- a point where the *Mississippi* River was a trifle --- and saw the broad
 +>> *Mississippi* rolling by! ---
 +2 rows returned
 +>
 +</​code>​
 =====  ===== =====  =====
  
-**[[admin:​indexing:​text:​proximity|Prev]]** |+**[[admin:​indexing:​text:​advanced|Prev]]** |
 **[[admin:​indexing:​text:​relevancy|Next]]** **[[admin:​indexing:​text:​relevancy|Next]]**
  
 
Back to top
admin/indexing/text/results.1328047034.txt.gz · Last modified: 2016/06/28 22:38 (external edit)