Documentation Source Text

Check-in [d0b390051e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Further tweaks to the matchinfo() documentation.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d0b390051efa281509f92579723eadaaaeda0448
User & Date: drh 2015-06-17 16:05:57
Context
2015-06-19
18:57
Fix an error in fts5.in. check-in: 8f8e1e988f user: dan tags: trunk
2015-06-17
16:05
Further tweaks to the matchinfo() documentation. check-in: d0b390051e user: drh tags: trunk
15:59
Update the change log. Better fragments for matchinfo() flags. check-in: dcccfa67e1 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to pages/fts3.in.

1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
....
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
          docs_with_hits = array[3 * (c + p*cols) + 2]
</pre>
  <tr><td>y<td style="white-space:nowrap"><i>cols</i> * <i>phrases</i> 
    <td><tcl>hd_fragment matchinfo-y {matchinfo y flag}</tcl>
      For each distinct combination of a phrase and table column, the
      number of usable phrase matches that appear in the column. This is
      usually identical to the first value in each set of three returned by the
      'x' directive (see above). However, the number of hits reported by the
      'y' directive is zero for any phrase that is part of a sub-expression
      that does not match the current row. This makes a difference for
      expressions that contain AND operators that are descendants of OR
      operators. For example, consider the expression: 
<pre>
          a OR (b AND c)
</pre>
      and the document:
<pre>
          "a c d"
</pre>
      The 'x' directive would report a single hit for the phrases "a" and "c".
      However, the 'y' directive reports the number of hits for "c" as zero, as
      it is part of a sub-expression that does not match the document - (b AND c).
      For queries that do not contain AND operators descended from OR
      operators, the result values returned by 'y' are always the same as
      those returned by 'x'.

<p style="margin-left:0;margin-right:0">
................................................................................
      (phrase 0). The values corresponding to other column/phrase combinations
      may be located using the following formula:

<pre>
          hits_for_phrase_p_column_c  = array&#91;c + p*cols&#93;
</pre>
      For queries that use OR expressions, or those that use LIMIT or return
      many rows, the 'y' matchinfo option may incur significantly less overhead
      than 'x'.

<tr><td>b<td style="white-space:nowrap"><i>(cols+31)/32</i> * <i>phrases</i> 
<td><tcl>hd_fragment matchinfo-b {matchinfo b flag}</tcl>

  The matchinfo 'b' flag provides similar information to the
  [matchinfo 'y' flag], but in a more
  compact form. Instead of the precise number of hits, 'b' provides a single







|
|










|







 







|
<







1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
....
1163
1164
1165
1166
1167
1168
1169
1170

1171
1172
1173
1174
1175
1176
1177
          docs_with_hits = array&#91;3 * (c + p*cols) + 2&#93;
</pre>
  <tr><td>y<td style="white-space:nowrap"><i>cols</i> * <i>phrases</i> 
    <td><tcl>hd_fragment matchinfo-y {matchinfo y flag}</tcl>
      For each distinct combination of a phrase and table column, the
      number of usable phrase matches that appear in the column. This is
      usually identical to the first value in each set of three returned by the
      [matchinfo 'x' flag]. However, the number of hits reported by the
      'y' flag is zero for any phrase that is part of a sub-expression
      that does not match the current row. This makes a difference for
      expressions that contain AND operators that are descendants of OR
      operators. For example, consider the expression: 
<pre>
          a OR (b AND c)
</pre>
      and the document:
<pre>
          "a c d"
</pre>
      The [matchinfo 'x' flag] would report a single hit for the phrases "a" and "c".
      However, the 'y' directive reports the number of hits for "c" as zero, as
      it is part of a sub-expression that does not match the document - (b AND c).
      For queries that do not contain AND operators descended from OR
      operators, the result values returned by 'y' are always the same as
      those returned by 'x'.

<p style="margin-left:0;margin-right:0">
................................................................................
      (phrase 0). The values corresponding to other column/phrase combinations
      may be located using the following formula:

<pre>
          hits_for_phrase_p_column_c  = array&#91;c + p*cols&#93;
</pre>
      For queries that use OR expressions, or those that use LIMIT or return
      many rows, the 'y' matchinfo option may be faster than 'x'.


<tr><td>b<td style="white-space:nowrap"><i>(cols+31)/32</i> * <i>phrases</i> 
<td><tcl>hd_fragment matchinfo-b {matchinfo b flag}</tcl>

  The matchinfo 'b' flag provides similar information to the
  [matchinfo 'y' flag], but in a more
  compact form. Instead of the precise number of hits, 'b' provides a single