Index hashtags and mentions

This commit is contained in:
Thomas Sileo
2019-09-01 20:58:51 +02:00
parent 36bc93cfda
commit 52bc600832
5 changed files with 66 additions and 16 deletions

View File

@@ -46,6 +46,9 @@ class MetaKey(Enum):
OBJECT_ACTOR_HASH = "object_actor_hash"
PUBLIC = "public"
HASHTAGS = "hashtags"
MENTIONS = "mentions"
FOLLOW_STATUS = "follow_status"
THREAD_ROOT_PARENT = "thread_root_parent"
@@ -121,6 +124,14 @@ def is_public() -> _SubQuery:
return flag(MetaKey.PUBLIC, True)
def by_visibility(vis: ap.Visibility) -> _SubQuery:
return flag(MetaKey.VISIBILITY, vis.name)
def by_hashtag(ht: str) -> _SubQuery:
return flag(MetaKey.HASHTAGS, ht)
def inc(mk: MetaKey, val: int) -> _SubQuery:
return {"$inc": flag(mk, val)}