1
- <!-- $PostgreSQL: pgsql/doc/src/sgml/textsearch.sgml,v 1.48 2009/03/24 20:17:08 tgl Exp $ -->
1
+ <!-- $PostgreSQL: pgsql/doc/src/sgml/textsearch.sgml,v 1.49 2009/04/14 00:49:56 tgl Exp $ -->
2
2
3
3
<chapter id="textsearch">
4
4
<title id="textsearch-title">Full Text Search</title>
@@ -1082,7 +1082,8 @@ ORDER BY rank DESC LIMIT 10;
1082
1082
<para>
1083
1083
<literal>StartSel</>, <literal>StopSel</literal>: the strings with which
1084
1084
query words appearing in the document should be delimited to distinguish
1085
- them from other excerpted words.
1085
+ them from other excerpted words. You must double-quote these strings
1086
+ if they contain spaces or commas.
1086
1087
</para>
1087
1088
</listitem>
1088
1089
<listitem >
@@ -1095,70 +1096,75 @@ ORDER BY rank DESC LIMIT 10;
1095
1096
<para>
1096
1097
<literal>ShortWord</literal>: words of this length or less will be
1097
1098
dropped at the start and end of a headline. The default
1098
- value of three eliminates the English articles.
1099
+ value of three eliminates common English articles.
1099
1100
</para>
1100
1101
</listitem>
1101
1102
<listitem>
1102
1103
<para>
1103
- <literal>MaxFragments</literal>: maximum number of text excerpts
1104
- or fragments that matches the query words. It also triggers a
1105
- different headline generation function than the default one. This
1106
- function finds text fragments with as many query words as possible and
1107
- stretches those fragments around the query words. As a result
1108
- query words are close to the middle of each fragment and have words on
1109
- each side. Each fragment will be of at most MaxWords and will not
1110
- have words of size less than or equal to ShortWord at the start or
1111
- end of a fragment. If all query words are not found in the document,
1112
- then a single fragment of MinWords will be displayed.
1104
+ <literal>HighlightAll</literal>: Boolean flag; if
1105
+ <literal>true</literal> the whole document will be used as the
1106
+ headline, ignoring the preceding three parameters.
1113
1107
</para>
1114
1108
</listitem>
1115
1109
<listitem>
1116
1110
<para>
1117
- <literal>FragmentDelimiter</literal>: When more than one fragments are
1118
- displayed, then the fragments will be separated by this delimiter. This
1119
- option is effective only if MaxFragments is greater than 1 and there are
1120
- more than one fragments to be diplayed. This option has no effect on the
1121
- default headline generation function.
1111
+ <literal>MaxFragments</literal>: maximum number of text excerpts
1112
+ or fragments to display. The default value of zero selects a
1113
+ non-fragment-oriented headline generation method. A value greater than
1114
+ zero selects fragment-based headline generation. This method
1115
+ finds text fragments with as many query words as possible and
1116
+ stretches those fragments around the query words. As a result
1117
+ query words are close to the middle of each fragment and have words on
1118
+ each side. Each fragment will be of at most <literal>MaxWords</> and
1119
+ words of length <literal>ShortWord</> or less are dropped at the start
1120
+ and end of each fragment. If not all query words are found in the
1121
+ document, then a single fragment of the first <literal>MinWords</>
1122
+ in the document will be displayed.
1122
1123
</para>
1123
1124
</listitem>
1124
1125
<listitem>
1125
1126
<para>
1126
- <literal>HighlightAll </literal>: Boolean flag; if
1127
- <literal>true</literal> the whole document will be highlighted .
1127
+ <literal>FragmentDelimiter </literal>: When more than one fragment is
1128
+ displayed, the fragments will be separated by this string .
1128
1129
</para>
1129
1130
</listitem>
1130
1131
</itemizedlist>
1131
1132
1132
1133
Any unspecified options receive these defaults:
1133
1134
1134
1135
<programlisting>
1135
- StartSel=<b>, StopSel=</b>, MaxFragments=0, FragmentDelimiter=" ... ", MaxWords=35, MinWords=15, ShortWord=3, HighlightAll=FALSE
1136
+ StartSel=<b>, StopSel=</b>,
1137
+ MaxWords=35, MinWords=15, ShortWord=3, HighlightAll=FALSE,
1138
+ MaxFragments=0, FragmentDelimiter=" ... "
1136
1139
</programlisting>
1137
1140
</para>
1138
1141
1139
1142
<para>
1140
1143
For example:
1141
1144
1142
1145
<programlisting>
1143
- SELECT ts_headline('english', 'The most common type of search
1146
+ SELECT ts_headline('english',
1147
+ 'The most common type of search
1144
1148
is to find all documents containing given query terms
1145
1149
and return them in order of their similarity to the
1146
- query.', to_tsquery('query & similarity'));
1150
+ query.',
1151
+ to_tsquery('query & similarity'));
1147
1152
ts_headline
1148
1153
------------------------------------------------------------
1149
- given <b>query</b> terms
1154
+ containing given <b>query</b> terms
1150
1155
and return them in order of their <b>similarity</b> to the
1151
1156
<b>query</b>.
1152
1157
1153
- SELECT ts_headline('english', 'The most common type of search
1158
+ SELECT ts_headline('english',
1159
+ 'The most common type of search
1154
1160
is to find all documents containing given query terms
1155
1161
and return them in order of their similarity to the
1156
1162
query.',
1157
1163
to_tsquery('query & similarity'),
1158
1164
'StartSel = <, StopSel = >');
1159
1165
ts_headline
1160
1166
-------------------------------------------------------
1161
- given <query> terms
1167
+ containing given <query> terms
1162
1168
and return them in order of their <similarity> to the
1163
1169
<query>.
1164
1170
</programlisting>
0 commit comments