W
W
WordPress WooCommerce2015-05-09 12:30:09
elasticsearch
WordPress WooCommerce, 2015-05-09 12:30:09

How to make search in WordPress using ElasticSearch with access control?

It is necessary to implement a tricky search on a WordPress-based site.
Problem conditions:
1. The site is closed, only registered users can read it. About 300 users.
2. Some posts have access restrictions on the list of users and groups. Through our ACL plugin, where the IDs of users and groups that are allowed to access are stored in a meta field.
3. The posts have links to Google Docs and Spreadsheets.
You need to:
1. Implement search through ElasticSearch
2. With morphology and synonyms of words
3. Taking into account access control (you can not show posts to which there is no access to the user)
4. It is also desirable to index PDF documents + Google Docs (they are inserted as links).
How to set up ElasticSearch is clear.
From here two questions:
1. Whether it is possible to adjust search taking into account access lists? If so, how?
2. Is it possible to implement indexing of the texts of documents that are placed in posts as links?
Somewhere I once heard that this can be implemented on Sphinx if you send a request to the search system, and return the post IDs from there. And then the site means to select those that are allowed access for the current user.
I would be grateful for any thoughts, advice and tips.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MintTea, 2015-05-11
@MintTea

1) You can save a per-document ACL in the document itself, and then substitute the current user ID in the term filter for that field in every request. In fact, it is no different from the principles by which this is implemented in Rsubd.
2) Document indexing is possible through the plugin . You will need to manually extract links to files from it before saving the post, download them and feed their contents to elastic. With google docs, the idea is the same, here I really don’t know how to automatically get them in machine-readable form.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question