Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moderation: added query match rule #1049

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

0einstein0
Copy link
Member

@0einstein0 0einstein0 commented Nov 6, 2024

Closes Issue #1042

cli commands

Create percolator moderation index for records

invenio moderation create-queries-index -r records

Add a query

Defaults to score 10 and active True if not provided

invenio moderation add-query --query-strinf "metadata.title:Spam" --notes "New query" --score 13 --active True

Add queries from csv

Defaults to score 10 and active True if not provided
csv format

query_string1, notes, score, active
query_string2, notes, score, active
invenio moderation add-query -f .../queries.csv

@0einstein0 0einstein0 force-pushed the moderation-rules branch 2 times, most recently from e4a30b7 to 9b9e167 Compare November 8, 2024 08:17
Copy link
Member

@slint slint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor things, but otherwise LGTM

site/zenodo_rdm/moderation/percolator.py Outdated Show resolved Hide resolved
site/zenodo_rdm/moderation/percolator.py Show resolved Hide resolved
site/zenodo_rdm/moderation/percolator.py Outdated Show resolved Hide resolved
site/zenodo_rdm/moderation/rules.py Outdated Show resolved Hide resolved
from zenodo_rdm.moderation.models import ModerationQuery


def test_moderation_query_creation(app):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor/shelve: I trust the feature works, but if relatively easy I would also add a test that performs a match query.

@0einstein0 0einstein0 force-pushed the moderation-rules branch 5 times, most recently from d72dadb to a39f1e1 Compare November 8, 2024 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Store queries in DB table and index as OpenSearch percolators to allow for reverse lookup
2 participants