document-dataply 0.0.7-alpha.0 → 0.0.7-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -10148,15 +10148,6 @@ function tokenize(text, options) {
10148
10148
  return [];
10149
10149
  }
10150
10150
 
10151
- // src/utils/hash.ts
10152
- function fastStringHash(str) {
10153
- let hash = 0;
10154
- for (let i = 0; i < str.length; i++) {
10155
- hash = (hash << 5) - hash + str.charCodeAt(i) | 0;
10156
- }
10157
- return hash >>> 0;
10158
- }
10159
-
10160
10151
  // src/core/documentAPI.ts
10161
10152
  var DocumentDataplyAPI = class extends import_dataply3.DataplyAPI {
10162
10153
  indices = {};
@@ -10533,17 +10524,14 @@ var DocumentDataplyAPI = class extends import_dataply3.DataplyAPI {
10533
10524
  return { verySmallChunkSize, smallChunkSize };
10534
10525
  }
10535
10526
  getTokenKey(pk, token) {
10536
- return fastStringHash(pk + ":" + token);
10527
+ return pk + ":" + token;
10537
10528
  }
10538
10529
  async applyCandidateByFTS(candidate, matchedTokens, filterValues, order) {
10539
10530
  const keys = /* @__PURE__ */ new Set();
10540
10531
  for (const token of matchedTokens) {
10541
10532
  const pairs = await candidate.tree.where(
10542
10533
  { primaryEqual: { v: token } },
10543
- {
10544
- filterValues,
10545
- order
10546
- }
10534
+ { order }
10547
10535
  );
10548
10536
  for (const c of pairs.values()) {
10549
10537
  if (!c || typeof c.k !== "number") continue;
@@ -5,7 +5,7 @@ export declare class DocumentDataplyAPI<T extends DocumentJSON, IC extends Index
5
5
  runWithDefault: <T_1>(callback: (tx: Transaction) => Promise<T_1>, tx?: Transaction) => Promise<T_1>;
6
6
  streamWithDefault: <T_1>(callback: (tx: Transaction) => AsyncGenerator<T_1>, tx?: Transaction) => AsyncGenerator<T_1>;
7
7
  indices: DocumentDataplyInnerMetadata['indices'];
8
- readonly trees: Map<string, BPTreeAsync<number, DataplyTreeValue<Primitive>>>;
8
+ readonly trees: Map<string, BPTreeAsync<string | number, DataplyTreeValue<Primitive>>>;
9
9
  readonly comparator: DocumentValueComparator<DataplyTreeValue<Primitive>, Primitive>;
10
10
  private pendingBackfillFields;
11
11
  private readonly lock;
@@ -48,20 +48,30 @@ export declare class DocumentDataplyAPI<T extends DocumentJSON, IC extends Index
48
48
  * @returns Driver and other candidates for query execution
49
49
  */
50
50
  getSelectivityCandidate<U extends Partial<DocumentDataplyIndexedQuery<T, IC>>, V extends DataplyTreeValue<U>>(query: Partial<DocumentDataplyQuery<V>>, orderByField?: string): Promise<{
51
- driver: {
51
+ driver: ({
52
52
  tree: BPTreeAsync<number, V>;
53
53
  condition: Partial<DocumentDataplyCondition<U>>;
54
54
  field: string;
55
- isFtsMatch?: boolean;
56
- matchTokens?: string[];
57
- };
58
- others: {
55
+ isFtsMatch: false;
56
+ } | {
57
+ tree: BPTreeAsync<string, V>;
58
+ condition: Partial<DocumentDataplyCondition<U>>;
59
+ field: string;
60
+ isFtsMatch: true;
61
+ matchTokens: string[];
62
+ });
63
+ others: ({
59
64
  tree: BPTreeAsync<number, V>;
60
65
  condition: Partial<DocumentDataplyCondition<U>>;
61
66
  field: string;
62
- isFtsMatch?: boolean;
63
- matchTokens?: string[];
64
- }[];
67
+ isFtsMatch: false;
68
+ } | {
69
+ tree: BPTreeAsync<string, V>;
70
+ condition: Partial<DocumentDataplyCondition<U>>;
71
+ field: string;
72
+ isFtsMatch: true;
73
+ matchTokens: string[];
74
+ })[];
65
75
  rollback: () => void;
66
76
  } | null>;
67
77
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document-dataply",
3
- "version": "0.0.7-alpha.0",
3
+ "version": "0.0.7-alpha.2",
4
4
  "description": "Simple and powerful JSON document database supporting complex queries and flexible indexing policies.",
5
5
  "license": "MIT",
6
6
  "author": "izure <admin@izure.org>",