MCPcopy Create free account
hub / github.com/BaseXdb/basex / opt

Method opt

basex-core/src/main/java/org/basex/query/func/db/DbText.java:34–53  ·  view source on GitHub ↗
(final CompileContext cc)

Source from the content-addressed store, hash-verified

32 }
33
34 @Override
35 protected final Expr opt(final CompileContext cc) throws QueryException {
36 compileData(cc);
37 arg(1, arg -> arg.simplifyFor(Simplify.DATA, cc).simplifyFor(Simplify.DISTINCT, cc));
38
39 // count number of results
40 final Data data = data();
41 final IndexType type = type();
42 if(type != IndexType.TOKEN && data != null && arg(1) instanceof Value) {
43 type.check(data, info);
44 long size = 0;
45 for(final byte[] token : tokens(cc.qc)) {
46 final int tl = token.length;
47 if(tl == 0 || tl > data.meta.maxlen) return this;
48 size += data.costs(new StringToken(type, token)).results();
49 }
50 exprType.assign(seqType(), size);
51 }
52 return this;
53 }
54
55 @Override
56 public final boolean ddo() {

Callers

nothing calls this directly

Calls 11

typeMethod · 0.95
checkMethod · 0.95
tokensMethod · 0.95
costsMethod · 0.95
compileDataMethod · 0.80
seqTypeMethod · 0.65
argMethod · 0.45
simplifyForMethod · 0.45
dataMethod · 0.45
resultsMethod · 0.45
assignMethod · 0.45

Tested by

no test coverage detected