Managing indexes - kwantu/platformconfiguration GitHub Wiki
The following clouseau search indexes are used
1. Indexes on the database: "kwantu_apps_<COMMUNITY_ID>"
Index | Notes |
---|---|
_design/clouseau/_search/list | |
_design/clouseau/_search/userRole | |
_design/clouseau/_search/assignee | |
_design/clouseau/_search/activityRoleUser | |
_design/clouseau/_search/title | |
_design/clouseau/_search/searchWorker | |
_design/clouseau/_search/sdo |
**2. Indexes on the database: "kwantu_configs" **
Index | Notes |
---|---|
_design/clouseau/_search/qrcode |
3. Indexes on the database: "kwantu_user_notifications_<USER_ID>"
Index | Notes |
---|---|
_design/clouseau/_search/notifications | |
_design/clouseau/_search/fav |
The structure of a call to an index is done through a service to the database. Note that the call will need to be properly authenticated.
http://<couchdb server domain:port>/<database>/<index>?q=<>&limit=n
where
index = index from the tables above
q = search query to send. *:* is the default query to return everything
limit = number of records to return
Example
http://10.155.78.82:8003/kwantu_apps_nat-d-24-957e12db-727d-4ccf-9ecb-0a8253a6f4a0/_design/clouseau/_search/list?q=*:*&limit=1
Curl example:
curl --noproxy "*" -u<admin user>:<admin password> http://10.155.78.82:8003/kwantu_apps_nat-d-24-957e12db-727d-4ccf-9ecb-0a8253a6f4a0/_design/clouseau/_search/list?q=*:*&limit=1
Helper code to create the call for all communities to trigger the index creation/update for community buckets
SELECT
CONCAT("curl --noproxy ""*"" -u<admin user>:<admin password> -m 10 ""http://<couchdb server domain:port>/kwantu_apps_",communityid,"/<index>?q=*:*&limit=1"" >> curl.out")
FROM `community`
WHERE accessType = '1'
Note: we set the timeout for curl at 10 seconds so that it does not wait for the index creation to be completed before moving on
Helper code to create the call for all communities to trigger the index creation/update for user buckets
SELECT
CONCAT("curl --noproxy ""*"" -u<admin user>:<admin password> -m 10 ""http://<couchdb server domain:port>/",`db_name`,
"/_design/clouseau/_search/notifications?q=*:*&limit=1&timeout=1"" >> curl.out")
FROM `changes_feed_control`
WHERE `type` = 'kusern';
Note: we set the timeout for curl at 10 seconds so that it does not wait for the index creation to be completed before moving on