Commit 7c49ff3
committed
Fix FTS arm recall for natural-language queries (OR lexemes)
The full-text arm of CoreAnnotationVectorStore built its query with
plainto_tsquery (SearchQuery's default), which ANDs every lexeme. A
multi-concept natural-language question therefore matched no single
annotation and the FTS arm returned zero rows -- so a corpus with no
embeddings (hybrid degrading to FTS-only) answered 'I found nothing'.
_run_fts_query now OR-combines per-token plainto_tsquery sub-queries:
any term match qualifies, while SearchRank still ranks annotations
matching more terms higher. Per-token plainto safely elides stopwords
without raising a tsquery syntax error, so no manual stopword list or
raw-tsquery escaping is needed. This is the single FTS entry point for
the hybrid, fts-only and global_search paths, so the fix applies to all.
Added test_fts_matches_natural_language_query_spanning_annotations
(RED before the change: 0 matches; GREEN after: all three annotations
whose terms collectively satisfy the query).1 parent 32fda57 commit 7c49ff3
3 files changed
Lines changed: 57 additions & 1 deletion
File tree
- changelog.d
- opencontractserver
- llms/vector_stores
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 21 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| |||
1096 | 1099 | | |
1097 | 1100 | | |
1098 | 1101 | | |
1099 | | - | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
1100 | 1120 | | |
1101 | 1121 | | |
1102 | 1122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
187 | 222 | | |
188 | 223 | | |
189 | 224 | | |
| |||
0 commit comments