Comments (1)
Oh, this is difficult to fix...
WIP patch:
diff --git a/lib/ii.c b/lib/ii.c
index 75849fb7c..134525515 100644
--- a/lib/ii.c
+++ b/lib/ii.c
@@ -13533,19 +13533,25 @@ grn_ii_select_cursor_next_find_near(grn_ctx *ctx,
bool need_check = true;
if (data->mode == GRN_OP_NEAR_PHRASE ||
data->mode == GRN_OP_ORDERED_NEAR_PHRASE) {
+ int32_t start_pos = data->pos;
uint32_t phrase_id;
for (phrase_id = 0; phrase_id < data->n_phrases; phrase_id++) {
- if (!grn_ii_select_data_find_phrase(ctx, data, phrase_id, data->pos, 0)) {
+ if (!grn_ii_select_data_find_phrase(ctx, data, phrase_id, start_pos, 0)) {
need_check = false;
break;
}
- /* TODO: Can we update data->pos to reduce needless search? */
bt_push(data->bt, data->token_info);
+ if (data->mode == GRN_OP_ORDERED_NEAR_PHRASE &&
+ data->token_info->pos > start_pos) {
+ start_pos = data->token_info->pos;
+ }
+ /* TODO: Can we update data->pos to reduce needless search? */
}
} else if (data->mode == GRN_OP_NEAR_PHRASE_PRODUCT ||
data->mode == GRN_OP_ORDERED_NEAR_PHRASE_PRODUCT) {
uint32_t i;
uint32_t phrase_id = 0;
+ int32_t start_pos = data->pos;
for (i = 0; i < data->n_phrase_groups; i++) {
phrase_group *group = &(data->phrase_groups[i]);
bt_zap(group->btree);
@@ -13555,10 +13561,14 @@ grn_ii_select_cursor_next_find_near(grn_ctx *ctx,
if (grn_ii_select_data_find_phrase(ctx,
data,
phrase_id,
- data->pos,
+ start_pos,
0)) {
have_phrase = true;
bt_push(group->btree, data->token_info);
+ if (data->mode == GRN_OP_ORDERED_NEAR_PHRASE_PRODUCT &&
+ data->token_info->pos > start_pos) {
+ start_pos = data->token_info->pos;
+ }
/* TODO: Can we update data->pos to reduce needless search? */
}
}
diff --git a/test/command/suite/select/query/ordered_near_phrase_product/same_phrases.test b/test/command/suite/select/query/ordered_near_phrase_product/same_phrases.test
new file mode 100644
index 000000000..2ecd7e858
--- /dev/null
+++ b/test/command/suite/select/query/ordered_near_phrase_product/same_phrases.test
@@ -0,0 +1,19 @@
+table_create Entries TABLE_NO_KEY
+column_create Entries content COLUMN_SCALAR Text
+
+table_create Terms TABLE_PAT_KEY ShortText \
+ --default_tokenizer TokenNgram \
+ --normalizer NormalizerNFKC150
+column_create Terms entries_content COLUMN_INDEX|WITH_POSITION Entries content
+
+load --table Entries
+[
+{"content": "a.b.c.d"},
+{"content": "a[.]b.c[.]d"},
+{"content": "x.y.z"}
+]
+
+select Entries \
+ --match_columns content \
+ --query '*ONPP10"(a) (. [.]) (b) (. [.]) (c) (. [.]) (d)"' \
+ --output_columns '_score, content'
from groonga.
Related Issues (20)
- Int64 is not supported for output_type=apache-arrow in columns that reference records in other table
- Groonga 14.0.0 HOT 18
- Proposal: Notify Developers with Error Message for Missing Submodules in CMakeLists.txt HOT 5
- Optimize CI jobs to run only necessary tasks HOT 1
- doc: Improve the i18n document in contribution guide
- Integrate the step to install depended libraries for building document into setup.sh
- Unify duplicated contents between i18n and introduction page in document contribution guide
- doc: add steps for updating documentation to document contribution page HOT 4
- Groonga 14.0.1 HOT 1
- Cannot build on FreeBSD 14.0 HOT 4
- ci: Introduce sphinx-lint
- Groonga 14.0.2 HOT 1
- docs: Recommend using `TokenNgram`
- Documentation Build Fails After Changing File Extension From `.rst` to `.md`
- groonga: add --default-n-workers
- NormalizerNFKC: add an option to remove diacritical mark
- Groonga 14.0.3 HOT 12
- Relicensing to LGPL-2.1-or-later from LGPL-2.1-only HOT 36
- @komainu8
- Groonga 14.0.4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from groonga.