[Groonga-commit] pgroonga/pgroonga.github.io at e034cac [master] Use format

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Oct 10 21:46:58 JST 2015


Kouhei Sutou	2015-10-10 21:46:58 +0900 (Sat, 10 Oct 2015)

  New Revision: e034cac68c047ef372e02c6abfaf24ecd326ba0b
  https://github.com/pgroonga/pgroonga.github.io/commit/e034cac68c047ef372e02c6abfaf24ecd326ba0b

  Message:
    Use format

  Modified files:
    reference/functions/pgroonga-score.md
    reference/functions/pgroonga-snippet-html.md

  Modified: reference/functions/pgroonga-score.md (+47 -4)
===================================================================
--- reference/functions/pgroonga-score.md    2015-10-10 21:46:29 +0900 (4e24cdf)
+++ reference/functions/pgroonga-score.md    2015-10-10 21:46:58 +0900 (312cf4e)
@@ -5,17 +5,60 @@ layout: en
 
 # `pgroonga.score` function
 
+## Summary
+
+`pgroonga.score` function returns precision as a number. If a record is more precision against searched query, the record has more higher number.
+
+## Syntax
+
 You can use `pgroonga.score` function to get precision as a number. If a record is more precision against searched query, the record has more higher number.
 
-You need to add primary key column into `pgroonga` index to use `pgroonga.score` function. If you don't add primary key column into `pgroonga` index, `pgroonga.score` function always returns `0`.
+```text
+double precision pgroonga.score(record)
+```
+
+`record` is a table name.
+
+Assume that you have the following schema:
+
+```sql
+CREATE TABLE score_memos (
+  id integer PRIMARY KEY,
+  content text
+);
+
+CREATE INDEX pgroonga_score_memos_content_index
+          ON score_memos
+       USING pgroonga (id, content);
+```
+
+`record` must be `score_memos`:
 
-`pgroonga.score` function always returns `0` when full text search isn't performed by index. In other words, `pgroonga.score` function always returns `0` when full text search is performed by sequential scan.
+```sql
+SELECT *, pgroonga.score(score_memos)
+  FROM score_memos
+ WHERE content %% 'PGroonga';
+```
 
-If `pgroonga.score` function returns `0` unexpectedly, confirm the followings:
+`pgroonga.score` function return precision as `double precision` type value.
+
+## Usage
+
+You need to add primary key column into `pgroonga` index to use `pgroonga.score` function. If you don't add primary key column into `pgroonga` index, `pgroonga.score` function always returns `0.0`.
+
+`pgroonga.score` function always returns `0.0` when full text search isn't performed by index. In other words, `pgroonga.score` function always returns `0` when full text search is performed by sequential scan.
+
+If `pgroonga.score` function returns `0.0` unexpectedly, confirm the followings:
 
   * Whether the column that is specified as primary key is included in index targets of the PGroonga index or not
   * Whether the full text search is performed by index or not
 
 Score is "how many keywords are included" (TF, Term Frequency) for now. Groonga supports customizing how to score. But PGroonga doesn't support yet it for now.
 
-See also [examples in tutorial](../../tutorial/#score).
+## Usage
+
+See [examples in tutorial](../../tutorial/#score).
+
+## See also
+
+  * [Examples in tutorial](../../tutorial/#score)

  Modified: reference/functions/pgroonga-snippet-html.md (+15 -3)
===================================================================
--- reference/functions/pgroonga-snippet-html.md    2015-10-10 21:46:29 +0900 (8002558)
+++ reference/functions/pgroonga-snippet-html.md    2015-10-10 21:46:58 +0900 (ab9e1d5)
@@ -5,10 +5,16 @@ layout: en
 
 # `pgroonga.snippet` function
 
-Here is `pgroonga.snippet_html` signature:
+## Summary
+
+`pgroonga.snippet_html` function returns texts around keywords from target text. It's also known as [KWIC](https://en.wikipedia.org/wiki/Key_Word_in_Context) (keyword in context). You can see it in search result on Web search engine.
+
+## Syntax
+
+Here is the syntax of this function:
 
 ```text
-pgroonga.snippet_html(target, ARRAY[keyword1, keyword2, ...])
+text[] pgroonga.snippet_html(target, ARRAY[keyword1, keyword2, ...])
 ```
 
 `target` is a `text` type value. `pgroonga.snippet_html` extracts keywords with around texts from `target`.
@@ -21,4 +27,10 @@ Element in the returned array is a text around keyword. The keyword is surround
 
 The maximum size of part of `target` in each element is 200 bytes. It's unit is byte not the number of characters. Each element may be lager than 200 bytes because each element includes `<span class="keyword">` and `</span>` and may have HTML escaped values. If '<' is HTML escaped to `&lt;`, the byte size is increased to 4 from 1.
 
-See also [examples in tutorial](../../tutorial/#snippet).
+## Usage
+
+See [examples in tutorial](../../tutorial/#snippet).
+
+## See also
+
+  * [Examples in tutorial](../../tutorial/#snippet)
-------------- next part --------------
HTML����������������������������...
Download 



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