-
Notifications
You must be signed in to change notification settings - Fork 29
Closed
Labels
bugBreaks something but is not blockingBreaks something but is not blockingf: public uiPublic interface, as opposed to the professional interfacePublic interface, as opposed to the professional interfacef: search
Description
Bug description:
The index of entities (remote and local) contain a field organisations, which is used to filter which entities are displayed in the public search and autocomplete, according to if they are linked to documents in a specific organisation. This means that all entities linked to a document should be reindexed every time a document is modified.
However, this is not working as expected for multiple reasons:
- This indexing is made as bulk and the bulk_indexing is disabled by default in the config (and in production too).
- The function to reindex entities is called
index_contributions()and it only targets remote entities that are contributions, instead of all linked entities. See: https://github.com/rero/rero-ils/blob/staging/rero_ils/modules/documents/api.py#L375-L393 - There is an incorrect condition
if not refthat prevents the indexing to ever be made by this function (an entity always has a field $ref). - The public search and autocomplete doesn't filter entities by their field "organisations" in a viewcode like it does for documents. It shows entities that are not linked to the current organisation.
Expected behavior:
- Every time a document is reindexed (resource modified, holdings or file added), the linked entities should be reindexed so that they contain the correct "organisations".
- When in a public view for an organisations, only the entities that are linked to documents in this oprganisation should be displayed in the autocomplete and results list (same as documents)
- Write tests that check this behaviour.
- Enable bulk_indexing (at least in the production and test servers) so that the function can run.
- Correct the
index_contributionsfunction so that it indexes ALL entities linked to the document (remote or local, whatever the field) - Make sure that in the public entities search for a specific organisations, I can only see the entities that are linked to my organisation.
Steps to Reproduce:
Problem 1 (reindex)
- Edit a document that belongs to an organisation by adding a contributor or subject (linked entity)
- See in the index for the entity you just added that field
"organisations": []is empty
Problem 2 (filter)
- Find an entity that is linked to a document from only one (or zero) organisation
- Search for this entity in the public view of another organisation
- See that the entity shows up in the autocomplete and in the results list, even though there are no documents linked to it in the current org
Metadata
Metadata
Assignees
Labels
bugBreaks something but is not blockingBreaks something but is not blockingf: public uiPublic interface, as opposed to the professional interfacePublic interface, as opposed to the professional interfacef: search
Type
Projects
Status
Done