diff --git a/hosting/docker-compose.dev.yaml b/hosting/docker-compose.dev.yaml index 2cbba5771f..8ee1753e11 100644 --- a/hosting/docker-compose.dev.yaml +++ b/hosting/docker-compose.dev.yaml @@ -34,37 +34,17 @@ services: - minio-service - couchdb-service - couchdb-lucene: - container_name: budi-couchdb-lucene-dev - build: - context: lucene - dockerfile: Dockerfile - ports: - - "${COUCH_LUCENE_PORT}:5985" - volumes: - - couchdb_lucene:/opt/couchdb-lucene - networks: - dbs: - aliases: - - couchdb-lucene - couchdb-service: container_name: budi-couchdb-dev restart: always - build: - context: couch - dockerfile: Dockerfile + image: ibmcom/couchdb3 environment: - COUCHDB_PASSWORD=${COUCH_DB_PASSWORD} - COUCHDB_USER=${COUCH_DB_USER} ports: - "${COUCH_DB_PORT}:5984" volumes: - - couchdb_data:/opt/couchdb/data -# networks: -# dbs: -# aliases: -# - couchdb + - couchdb3_data:/opt/couchdb/data couch-init: container_name: budi-couchdb-init-dev @@ -84,16 +64,10 @@ services: volumes: - redis_data:/data -networks: - dbs: - driver: bridge - volumes: - couchdb_data: + couchdb3_data: driver: local minio_data: driver: local redis_data: driver: local - couchdb_lucene: - driver: local diff --git a/hosting/hosting.properties b/hosting/hosting.properties index 5b80a844dd..138e66d629 100644 --- a/hosting/hosting.properties +++ b/hosting/hosting.properties @@ -18,6 +18,5 @@ APP_PORT=4002 WORKER_PORT=4003 MINIO_PORT=4004 COUCH_DB_PORT=4005 -COUCH_LUCENE_PORT=4006 REDIS_PORT=6379 BUDIBASE_ENVIRONMENT=PRODUCTION diff --git a/packages/server/src/db/views/staticViews.js b/packages/server/src/db/views/staticViews.js index 50e3a4a1a9..ae6496bb4a 100644 --- a/packages/server/src/db/views/staticViews.js +++ b/packages/server/src/db/views/staticViews.js @@ -76,33 +76,25 @@ exports.createRoutingView = async appId => { exports.createFulltextSearchIndex = async appId => { const db = new CouchDB(appId) const designDoc = await db.get("_design/database") - designDoc.fulltext = { - everything: { + designDoc.indexes = { + rows: { index: function(doc) { - let ret = new Document() - - function idx(obj) { + // eslint-disable-next-line no-undef + index("id", doc._id) + function idx(obj, prev = "") { for (let key of Object.keys(obj)) { - switch (typeof obj[key]) { - case "object": - idx(obj[key]) - break - case "function": - break - default: - ret.add(obj[key]) - break + let prevKey = prev !== "" ? `${prev}.${key}` : key + if (typeof obj[key] !== "object") { + // eslint-disable-next-line no-undef + index(prevKey, obj[key], { store: true }) + } else { + idx(obj[key], prevKey) } } } - - idx(doc) - if (doc._attachments) { - for (let i in Object.keys(doc._attachments)) { - ret.attachment("default", i) - } + if (doc._id.startsWith("ro_")) { + idx(doc) } - return ret }.toString(), }, }