UNPKG

ravendb

Version:
62 lines 3.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AbstractCsharpMultiMapIndexCreationTask = void 0; const index_js_1 = require("../../Exceptions/index.js"); const IndexDefinition_js_1 = require("./IndexDefinition.js"); const DocumentConventions_js_1 = require("../Conventions/DocumentConventions.js"); const AbstractGenericIndexCreationTask_js_1 = require("./AbstractGenericIndexCreationTask.js"); const Constants_js_1 = require("../../Constants.js"); const ObjectUtil_js_1 = require("../../Utility/ObjectUtil.js"); class AbstractCsharpMultiMapIndexCreationTask extends AbstractGenericIndexCreationTask_js_1.AbstractGenericIndexCreationTask { maps = []; reduce; /** * Gets a value indicating whether this instance is map reduce index definition * @return if index is of type: Map/Reduce */ get isMapReduce() { return !!this.reduce; } // since this class is meant to be extended by the user, we don't follow protected name convention here addMap(map) { if (!map) { (0, index_js_1.throwError)("InvalidArgumentException", "Map cannot be null."); } this.maps.push(map); } createIndexDefinition() { if (!this.conventions) { this.conventions = new DocumentConventions_js_1.DocumentConventions(); } const indexDefinitionBuilder = new IndexDefinition_js_1.IndexDefinitionBuilder(this.getIndexName()); indexDefinitionBuilder.indexesStrings = this.indexesStrings; indexDefinitionBuilder.analyzersStrings = this.analyzersStrings; indexDefinitionBuilder.reduce = this.reduce; indexDefinitionBuilder.storesStrings = this.storesStrings; indexDefinitionBuilder.suggestionsOptions = this.indexSuggestions; indexDefinitionBuilder.termVectorsStrings = this.termVectorsStrings; indexDefinitionBuilder.spatialIndexesStrings = this.spatialOptionsStrings; indexDefinitionBuilder.outputReduceToCollection = this.outputReduceToCollection; indexDefinitionBuilder.patternForOutputReduceToCollectionReferences = this.patternForOutputReduceToCollectionReferences; indexDefinitionBuilder.patternReferencesCollectionName = this.patternReferencesCollectionName; indexDefinitionBuilder.additionalSources = this.additionalSources; indexDefinitionBuilder.additionalAssemblies = this.additionalAssemblies; indexDefinitionBuilder.configuration = this.configuration; indexDefinitionBuilder.lockMode = this.lockMode; indexDefinitionBuilder.priority = this.priority; indexDefinitionBuilder.state = this.state; indexDefinitionBuilder.deploymentMode = this.deploymentMode; indexDefinitionBuilder.vectorFieldStrings = this.vectorOptionsStrings; if (this.searchEngineType) { indexDefinitionBuilder.configuration[Constants_js_1.INDEXES.INDEXING_STATIC_SEARCH_ENGINE_TYPE] = this.searchEngineType; } else if (!ObjectUtil_js_1.ObjectUtil.isEmpty(this.vectorOptionsStrings)) { indexDefinitionBuilder.configuration[Constants_js_1.INDEXES.INDEXING_STATIC_SEARCH_ENGINE_TYPE] = "Corax"; } const indexDefinition = indexDefinitionBuilder.toIndexDefinition(this.conventions, false); indexDefinition.maps = new Set(this.maps); return indexDefinition; } } exports.AbstractCsharpMultiMapIndexCreationTask = AbstractCsharpMultiMapIndexCreationTask; //# sourceMappingURL=AbstractCsharpMultiMapIndexCreationTask.js.map