Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API] TypeScript transformation - indexing #3500

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,25 @@

const IndexingFacade = Java.type("org.eclipse.dirigible.components.api.indexing.IndexingFacade");

export function search(index, term) {
const results = IndexingFacade.search(index, term);
return JSON.parse(results);
};
export class Searcher{

export function before(index, date) {
const results = IndexingFacade.before(index, '' + date.getTime());
return JSON.parse(results);
};
public static search(index: string, term: string): JSON {
const results = IndexingFacade.search(index, term);
return JSON.parse(results);
};

export function after(index, date) {
const results = IndexingFacade.after(index, '' + date.getTime());
return JSON.parse(results);
};
public static before(index: string, date: Date): JSON {
const results = IndexingFacade.before(index, '' + date.getTime());
return JSON.parse(results);
};

export function between(index, lower, upper) {
const results = IndexingFacade.between(index, '' + lower.getTime(), '' + upper.getTime());
return JSON.parse(results);
};
public static after(index: string, date: Date): JSON {
const results = IndexingFacade.after(index, '' + date.getTime());
return JSON.parse(results);
};

public static between(index: string, lower: Date, upper: Date): JSON {
const results = IndexingFacade.between(index, '' + lower.getTime(), '' + upper.getTime());
return JSON.parse(results);
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@

const IndexingFacade = Java.type("org.eclipse.dirigible.components.api.indexing.IndexingFacade");

export function add(index, location, contents, lastModified, parameters) {
if (!lastModified) {
lastModified = new Date();
}
let map = "{}";
if (parameters) {
map = JSON.stringify(parameters);
}
IndexingFacade.add(index, location, contents, '' + lastModified.getTime(), map);
};
export class Writer{

public static add(index: string, location: string, contents: string, lastModified: Date, parameters: any) {
if (!lastModified) {
lastModified = new Date();
}
let map = "{}";
if (parameters) {
map = JSON.stringify(parameters);
}
IndexingFacade.add(index, location, contents, '' + lastModified.getTime(), map);
};
}