Skip to content

Commit

Permalink
lucene: feat: Support ranged node terms (#48624)
Browse files Browse the repository at this point in the history
* lucene: feat: Support ranged node terms

This is a much closer match to the actual data structures produced by the Lucene package.  I've been using this patch for several months in a couple of private projects for a company I did work for.

Also along for the ride is that the similarity field is a nullable number.  Again, matches the actual code of Lucene, but not as well used in my code.

* fix: missing semis

* fix: Remove extra export and swap to interface

* fix: Lint error fixage

Due to not actually doing this via a checked out copy, just editing on GitHub directly.

strict-export-declare-modifiers requires all declarations to be exported.

And some as-of-previous-commit excess semicolons.
  • Loading branch information
kf6kjg committed Oct 16, 2020
1 parent 220c695 commit 7dccb41
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions types/lucene/index.d.ts
Expand Up @@ -10,21 +10,38 @@ export interface TermLocation {
offset: number;
}

export interface Node {
boost: null | number;
export interface NodeField {
field: string | '<implicit>';
fieldLocation: null;
fieldLocation: null | {
end: TermLocation;
start: TermLocation;
};
}

export interface NodeTerm extends NodeField {
boost: null | number;
prefix: null | string;
quoted: boolean;
regex: boolean;
similarity: null;
similarity: null | number;
term: string;
termLocation: {
start: TermLocation;
end: TermLocation;
};
}

export interface NodeRangedTerm extends NodeField {
inclusive: "both" | "none" | "left" | "right";
term_max: string;
term_min: string;
}

export type Node =
| NodeTerm
| NodeRangedTerm
;

export type Operator = '<implicit>' | 'NOT' | 'OR' | 'AND' | 'AND NOT' | 'OR NOT';

export interface LeftOnlyAST {
Expand Down

0 comments on commit 7dccb41

Please sign in to comment.