8000 Bug fix/fix devsup 753 (#14373) by Dronplane · Pull Request #14378 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Bug fix/fix devsup 753 (#14373) #14378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8000
Merged
merged 3 commits into from
Jun 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions 3rdParty/iresearch/core/search/disjunction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,9 @@ class disjunction final
virtual void visit(void* ctx, bool (*visitor)(void*, Adapter&)) override {
assert(ctx);
assert(visitor);
if (heap_.empty()) {
return;
}
hitch_all_iterators();
auto& lead = itrs_[heap_.back()];
auto cont = visitor(ctx, lead);
Expand Down Expand Up @@ -876,6 +879,7 @@ class disjunction final
}

std::pair<heap_iterator, heap_iterator> hitch_all_iterators() {
assert(!heap_.empty());
// hitch all iterators in head to the lead (current doc_)
auto begin = heap_.begin(), end = heap_.end()-1;

Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
v3.7.13 (XXXX-XX-XX)
--------------------

* Fix DEVSUP-753: now it is safe to call visit on exhausted disjunction
iterator.

* Fix URL request parsing in case data is handed in in small chunks.
Previously the URL could be cut off if the chunk size was smaller than the URL
size.
Expand Down
48 changes: 48 additions & 0 deletions tests/js/common/aql/aql-view-arangosearch-noncluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -2205,7 +2205,55 @@ function iResearchAqlTestSuite () {
let res= db._query("FOR doc IN WithPrimarySort SEARCH ANALYZER(doc.field3 == 1, 'customAnalyzer') "
+ " OPTIONS { waitForSync : true } SORT doc._key LIMIT 0, 50 RETURN doc ").toArray();
assertEqual(1, res.length);
},

testDisjunctionVisit : function() {
let queryColl = "DisjunctionCollection";
let queryView = "DisjunctionView";
try {
db._drop(queryColl);
db._dropView(queryView);
let coll = db._create(queryColl);
let view = db._createView(queryView, "arangosearch", {
links: {
[queryColl] : {
fields: {
value: { analyzers:['identity', 'text_en'] }
}
}
}
});
let documents = [
{"value":"test"},
// these docs will make STARTS_WITH more "costly" than PHRASE and conjunction will use PHRASE as lead!
{"value":"test1234"},
{"value":"test21321312312"},
{"value":"test213213123122"},
{"value":"test2132131231222"},
{"value":"test21321312312222"},
{"value":"test2132131231222322"},
{"value":"test2132131231231231222322"},
// this will make PHRASE iterator not use small_disjunction (more than 5 candidates for LEVENSHTEIN)
{"value":"rest"},
{"value":"arest"},
{"value":"brest"},
{"value":"zest"},
{"value":"qest"}];
db[queryColl].save(documents);
let res = db._query("FOR d IN " + queryView +" SEARCH "
+ " (ANALYZER(PHRASE(d.value, {LEVENSHTEIN_MATCH : ['test', 2, true]}), 'text_en') "
+ " && ANALYZER(STARTS_WITH(d.value, 'test'),'text_en')) OR "
+ " BOOST(PHRASE(d.value, 'test144', 'identity'), 10) "
+ " OPTIONS {waitForSync:true} SORT BM25(d) DESC LIMIT 20 "
+ " RETURN {'Score':BM25(d), 'Id' : d.value, 'Entity' : d }").toArray();
assertEqual(1, res.length);

} finally {
db._drop(queryColl);
db._dropView(queryView);
}
}

};
}

Expand Down
0