Skip to content
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
6 changes: 2 additions & 4 deletions basex-core/src/main/java/org/basex/query/QueryParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -4689,10 +4689,8 @@ private Expr[] ftRange(final boolean i, final Itr min) throws QueryException {
private Expr ftAdditive(final boolean i) throws QueryException {
if(!i) return additive();
skipWs();
token.reset();
while(digit(current())) token.add(consume());
if(token.isEmpty()) throw error(INTEXP);
return Itr.get(toLong(token.toArray()));
if(!digit(current())) throw error(INTEXP);
return numericLiteral(Long.MAX_VALUE, false, false);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,16 @@ private static void assertQuery(final String qu) {
{ "//w[text() contains text 'glad' using wildcards" + thes, "l.cky" },
{ "//w[text() contains text 'happy glad' any word" + thes, "lucky\nl.cky" },
{ "//w[text() contains text { 'stil.*' } using wildcards ftor { 'happy' }" + thes,
"lucky\na still life\nstill\nstillleben" }
"lucky\na still life\nstill\nstillleben" },
// GH-2785: underscores in integer literals
{ "//w[text() contains text 'happy' using thesaurus at '" + db
+ "' from 0_1 to 1_0 levels]", "lucky" },
{ "//w[text() contains text 'happy' using thesaurus at '" + db
+ "' exactly 0_1 levels]", "lucky" },
{ "//w[text() contains text 'happy' using thesaurus at '" + db
+ "' at least 0_1 levels]", "lucky" },
{ "//w[text() contains text 'happy' using thesaurus at '" + db
+ "' at most 1_0 levels]", "lucky" }
};
for(final String[] query : queries) {
final String qu = query[0] + " ! string()";
Expand Down
12 changes: 12 additions & 0 deletions basex-core/src/test/java/org/basex/query/ft/FTQueryTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.basex.query.ft;

import static org.basex.query.QueryError.*;
import static org.basex.query.func.Function.*;

import org.basex.*;
Expand Down Expand Up @@ -95,6 +96,17 @@ public final class FTQueryTest extends SandboxTest {
query("'a' contains text 'b' using fuzzy 10 errors", true);
}

/** Integer separators in full-text ranges. */
@Test public void gh2785() {
query("'fox' contains text 'cat' using fuzzy 1_0 errors", true);
query("'fox' contains text 'cat' using fuzzy 1 errors", false);
query("'fox' contains text 'cat' using fuzzy 1__0 errors", true);
error("'fox' contains text 'cat' using fuzzy 1_ errors", NUMBER_X);
error("'fox' contains text 'cat' using fuzzy _1 errors", QUERYEND_X);
error("'fox' contains text 'cat' using fuzzy errors", QUERYEND_X);
error("'fox' contains text 'cat' using fuzzy 99999999999999999999 errors", RANGE_X);
}

/** Fuzzy search: handling many similar terms. */
@Test public void gh2014() {
query(_DB_CREATE.args(NAME, " <a><b>aaaa aabc aaab</b><b>bbbb</b><b>aaad</b></a>",
Expand Down
Loading