Coverage for functions \ flipdare \ search \ constants.py: 100%

5 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2026-05-08 12:22 +1000

1#!/usr/bin/env python 

2# Copyright (c) 2026 Flipdare Pty Ltd. All rights reserved. 

3# 

4# This file is part of Flipdare's proprietary software and contains 

5# confidential and copyrighted material. Unauthorised copying, 

6# modification, distribution, or use of this file is strictly 

7# prohibited without prior written permission from Flipdare Pty Ltd. 

8# 

9# This software includes third-party components licensed under MIT, 

10# BSD, and Apache 2.0 licences. See THIRD_PARTY_NOTICES for details. 

11# 

12 

13 

14from typing import Any 

15 

16__all__ = ["SEARCH_STOP_WORDS", "GENERAL_DEFINITION", "FRIEND_DEFINITION"] 

17 

18 

19# fmt: off 

20GENERAL_DEFINITION: dict[str, Any] = { 

21 "fields": [ 

22 {"name": "created_at", "type": "int64", "sort": True}, 

23 {"name": "updated_at", "type": "int64", "sort": True}, 

24 {"name": "uid", "type": "string", "facet": True}, 

25 {"name": "obj_id", "type": "string", "facet": True}, 

26 {"name": "obj_type", "type": "string", "facet": True}, 

27 {"name": "group_id", "type": "string", "facet": True, "optional": True}, 

28 {"name": "tags", "type": "string[]", "facet": True, "infix": True}, 

29 {"name": "tag_score", "type": "float", "sort": True}, 

30 {"name": "keywords", "type": "string[]"}, # prefix=True in queries covers autocomplete 

31 {"name": "score", "type": "float", "sort": True}, 

32 {"name": "views", "type": "int32", "sort": True}, 

33 ], 

34 "default_sorting_field": "created_at", 

35} 

36 

37FRIEND_DEFINITION: dict[str, Any] = { 

38 "fields": [ 

39 {"name": "created_at", "type": "int64", "sort": True}, 

40 {"name": "updated_at", "type": "int64", "sort": True}, 

41 {"name": "uid", "type": "string", "facet": True}, 

42 {"name": "friend_type", "type": "string", "facet": True}, 

43 {"name": "keywords", "type": "string[]"}, 

44 {"name": "friend_uid", "type": "string", "facet": True}, 

45 {"name": "friend_keywords", "type": "string[]"}, 

46 ], 

47 "default_sorting_field": "created_at", 

48} 

49# fmt: on 

50 

51SEARCH_STOP_WORDS = [ 

52 "a", 

53 "am", 

54 "an", 

55 "and", 

56 "as", 

57 "at", 

58 "by", 

59 "c's", 

60 "co", 

61 "do", 

62 "eg", 

63 "et", 

64 "for", 

65 "he", 

66 "hi", 

67 "i", 

68 "i'd", 

69 "i'm", 

70 "ie", 

71 "if", 

72 "in", 

73 "inc", 

74 "is", 

75 "it", 

76 "its", 

77 "me", 

78 "my", 

79 "nd", 

80 "no", 

81 "non", 

82 "nor", 

83 "not", 

84 "of", 

85 "off", 

86 "oh", 

87 "ok", 

88 "on", 

89 "or", 

90 "per", 

91 "que", 

92 "qv", 

93 "rd", 

94 "re", 

95 "so", 

96 "sub", 

97 "t's", 

98 "th", 

99 "the", 

100 "to", 

101 "too", 

102 "two", 

103 "un", 

104 "up", 

105 "us", 

106 "vs", 

107 "we", 

108]