Add proper ArangoSearchView API (#27756)

This commit is contained in:
Alan Plum
2018-08-01 11:34:35 -07:00
committed by Sheetal Nandi
parent 29d45249cd
commit 48a6bcba6f
2 changed files with 76 additions and 9 deletions
+10
View File
@@ -96,3 +96,13 @@ console.log(
RETURN u
`.toArray()
);
const view = db._view("yolo")!;
view.properties({
locale: "C",
commit: {
consolidate: {
bytes: { segmentThreshold: 20 }
}
}
});
+66 -9
View File
@@ -837,11 +837,68 @@ declare namespace ArangoDB {
// Views
interface View {
// TODO
[key: string]: any;
interface ArangoSearchView {
_dbName: string;
_id: string;
name(): string;
type(): ViewType;
rename(newName: string): void;
properties(
newProperties?: ArangoSearchViewPropertiesOptions
): ArangoSearchViewProperties;
}
interface ArangoSearchViewConsolidate {
threshold: number;
segmentThreshold: number;
}
interface ArangoSearchViewCollectionLink {
analyzers?: string[];
fields?: { [key: string]: ArangoSearchViewCollectionLink | undefined };
includeAllFields?: boolean;
trackListPositions?: boolean;
storeValues?: "none" | "id";
}
interface ArangoSearchViewProperties {
id: string;
name: string;
type: "arangosearch";
commit: {
cleanupIntervalStep: number;
commitIntervalMsec: number;
consolidate: {
bytes?: ArangoSearchViewConsolidate;
bytes_accum?: ArangoSearchViewConsolidate;
count?: ArangoSearchViewConsolidate;
fill?: ArangoSearchViewConsolidate;
};
};
locale: string;
links: {
[key: string]: ArangoSearchViewCollectionLink | undefined;
};
}
interface ArangoSearchViewPropertiesOptions {
locale?: string;
commit?: {
consolidate?:
| "none"
| {
count?: Partial<ArangoSearchViewConsolidate>;
bytes?: Partial<ArangoSearchViewConsolidate>;
bytes_accum?: Partial<ArangoSearchViewConsolidate>;
fill?: Partial<ArangoSearchViewConsolidate>;
};
commitIntervalMsec?: number;
cleanupIntervalStep?: number;
};
links?: {
[key: string]: ArangoSearchViewCollectionLink | undefined;
};
}
type ViewProperties = object; // TODO
// Global
@@ -923,13 +980,13 @@ declare namespace ArangoDB {
): DocumentMetadata;
// Views
_view(name: string): View | null;
_views(): View[];
_view(name: string): ArangoSearchView | null;
_views(): ArangoSearchView[];
_createView(
name: string,
type: ViewType,
properties: ViewProperties
): View;
properties: ArangoSearchViewPropertiesOptions
): ArangoSearchView;
_dropView(name: string): void;
// Global
@@ -1392,7 +1449,7 @@ declare module "@arangodb/foxx/router" {
}
declare module "@arangodb/foxx/graphql" {
import { GraphQLSchema, formatError } from "graphql";
import { formatError, GraphQLSchema } from "graphql";
type GraphQLModule = object;
type GraphQLFormatErrorFunction = typeof formatError;
interface GraphQLOptions {