Indexing not working for query which contains Array inside


#1

select * from content WHERE _type=‘Book’ and (userId = ‘cjklccr2x00540a44c6ifja3y’
OR ANY uid IN sharedElessonUserIDs SATISFIES uid =‘cjklccr2x00540a44c6ifja3y’ END) and type = “” and active = true

For the above query the INDEX used is like
CREATE INDEX idx_sharedElessonUserIDs ON content((distinct (array t for t in sharedElessonUserIDs end))) WHERE (_type = “Book”)

After using indexing it is taking arround 20 sec to execute.
Do I have to modified something in the Index??.. so that the query will execute with in miliseconds.

Thanks


#2
CREATE INDEX `idx_sharedElessonUserIDs` ON `content` 
((distinct (array `t` for `t` in  ARRAY_APPEND(IFMISSINGORNULL(`sharedElessonUserIDs`,[]), userId) end)), active) WHERE ( `_type` = “Book”);
select * from content 
WHERE _type=‘Book’ and ANY uid IN  ARRAY_APPEND(IFMISSINGORNULL(`sharedElessonUserIDs`,[]), userId) SATISFIES uid =‘cjklccr2x00540a44c6ifja3y’ END AND active = true;

#3

Thanks a lot.It working fine.