NXQL : select documents where creator email equals ...

Hello,

I know that this NXQL is working :

SELECT * FROM Document WHERE dc:creator = 'user.name'

But is it possible to query on email attribute ? I tried this but it doesn't work :)

SELECT * FROM Document WHERE dc:creator/properties/email = 'admin@email.com'

Regards.

0 votes

1 answers

197 views

ANSWER



Hello,

I don't think you'll be able to do that natively through NXQL, dc:creator is not a complex property, it's a reference toward a principal, that's why you can't search based upon its property (you don't have access to that “object” yet)

Through custom code you could index aside the dc:creator property a new custom dc:creatorEmail property on ElasticSearch, and then use it in your search (or save it in a custom metadata directly if you want to rely on a search against DataBase). But you will need to manage the updates, like catching a user's email update to trigger an update on documents referencing them, which you would need to be careful with (you don't want a user email update to trigger reindexing on millions of documents).

Regards,

1 votes