We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Rough design:
class Query(db.Model): id = db.Column(db.Integer, primary_key=True) score = db.Column(db.Integer, default=0) query_string = db.Column(db.Text, nullable=False) notes = db.Column(db.Text, nullable=True) active = db.Column(db.Boolean, default=True) # Create the query (low-level API) new_query = Query( query_string='"1080p download"', score=5, ) db.session.add(new_query) db.session.commit() # Index as percolator (low-level API) current_search_client.index( index="moderation-records", body={ "query": { "query_string": {"query": new_query.query_string}, }, "score": new_query.score, "active": new_query.active, }, ) # High level Query.create( query_string='"1080p download"', score=5, ) db.session.commit() # TODO: In the future we could have a REST API to hook-in the administration interface """POST /api/moderation/queries { "query_string": "1080p download", "score": 5 } """ ## Create mapping record_mapping = current_search_client.indices.get("rdmrecords-records-record-v7.0.0") current_search_client.create_index( index="moderation-records", body="mappings": { "properties": { # Inclue the "live" mapping **record_mapping, # Percolator-specific fields "query": { "type": "percolator" }, "score": { "type": "integer" }, "active": { "type": "boolean" } } } ) ## Usage - During moderation rules matched_queries = current_search_client.search( index="moderation-records", body={ "query": { "percolate": { "field": "query", "document": record.dumps(), } } }, )
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Rough design:
The text was updated successfully, but these errors were encountered: