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

Method add

basex-core/src/main/java/org/basex/index/ft/FTIndexTree.java:41–54  ·  view source on GitHub ↗

Checks if the specified token was already indexed. If yes, its PRE value is added to the existing values. Otherwise, a new index entry is created. @param token token to be indexed @param id ID value of the token @param pos pos value of the token @param index current file ID

(final byte[] token, final int id, final int pos, final int index)

Source from the content-addressed store, hash-verified

39 * @param index current file ID
40 */
41 void add(final byte[] token, final int id, final int pos, final int index) {
42 final int os = keys.size();
43 final int n = add(token, id, 0, index == 0);
44 if(os == keys.size()) {
45 final int i = index > 0 ? maps.get(Num.num(n)) : n;
46 if(poss.size() > i && poss.get(i) != null) {
47 poss.set(i, Num.add(poss.get(i), pos));
48 numpre.set(i, numpre.get(i) + 1);
49 return;
50 }
51 }
52 poss.add(Num.newNum(pos));
53 numpre.add(1);
54 }
55
56 /**
57 * Initializes the tree for adding new full-text data.

Callers

nothing calls this directly

Calls 7

numMethod · 0.95
addMethod · 0.95
newNumMethod · 0.95
sizeMethod · 0.65
getMethod · 0.65
setMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected