[Groonga-mysql-commit] mroonga/mroonga [fix-for-visual-studio] doc en: add description about snippet

Back to archive index

HAYASHI Kentaro null+****@clear*****
Thu Sep 27 13:52:12 JST 2012


HAYASHI Kentaro	2012-09-27 13:52:12 +0900 (Thu, 27 Sep 2012)

  New Revision: f49d93794e50d5615c73f90e2e5ed40487c3ecb7
  https://github.com/mroonga/mroonga/commit/f49d93794e50d5615c73f90e2e5ed40487c3ecb7

  Log:
    doc en: add description about snippet
    
    TODO: add suitable execution example.

  Modified files:
    doc/source/userguide/storage.rst

  Modified: doc/source/userguide/storage.rst (+63 -0)
===================================================================
--- doc/source/userguide/storage.rst    2012-09-27 11:53:04 +0900 (54c6871)
+++ doc/source/userguide/storage.rst    2012-09-27 13:52:12 +0900 (6642fff)
@@ -281,6 +281,69 @@ As you can see in the example above, you can get the record ID by _id column or
   Query OK, 1 row affected (0.00 sec)
   Rows matched: 1  Changed: 1  Warnings: 0
 
+How to get snippet (Keyword in context)
+---------------------------------------
+
+There is a case that you want to extract keyword and surrounding text as a
+search results.
+
+Snippet means 'keyword and surrounding text'.
+It is called 'Keyword in context'.
+
+``mroonga_snippet`` function provides the way to get snippet from search results.
+
+Here is the syntax of ``mroonga_snippet`` function::
+
+  SELECT mroonga_snippet(document, max_length, max_count, encoding,
+    skip_leading_spaces, html_encoding, start_tag, end_tag,
+    word1, word1_start_tag, word1_end_tag,
+    word2, word2_start_tag, word2_end_tag, ...);
+
+Here is the detail of ``mroonga_snippet`` arguments.
+
+document
+  The column name or string value is required.
+
+max_length
+  The max length of snippet (bytes) is required.
+
+max_count
+  The max elements of snippets is required.
+
+encoding
+  The encoding of document is required.
+
+skip_leading_spaces
+  Specify whether skip leading spaces or not.
+
+html_encoding
+  HTML encoding is enabled or not.
+
+start_tag
+  The start tag of snippet.
+
+end_tag
+  The end tag of snippet.
+
+wordN
+  Specify any word.
+
+wordN_start_tag
+  It is the start tag of wordN.
+
+wordN_end_tag
+  It is the end tag of wordN.
+
+mroonga_snippet function is included in mroonga as a User-Defined Function (UDF), but if you have not yet register it in MySQL by CREATE FUNCTION, you need to invoke the following SQL for defining a function. ::
+
+  mysql> CREATE FUNCTION mroonga_snippet RETURNS STRING SONAME 'ha_mroonga.so';
+
+Here is the results of execution examples::
+
+TODO:
+
+
+
 Logging
 -------
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-mysql-commit mailing list
Back to archive index