mygramdb-client 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mygramdb_client/__init__.py +88 -0
- mygramdb_client/client.py +909 -0
- mygramdb_client/command_utils.py +157 -0
- mygramdb_client/errors.py +45 -0
- mygramdb_client/search_expression.py +358 -0
- mygramdb_client/types.py +156 -0
- mygramdb_client-1.0.0.dist-info/METADATA +145 -0
- mygramdb_client-1.0.0.dist-info/RECORD +10 -0
- mygramdb_client-1.0.0.dist-info/WHEEL +4 -0
- mygramdb_client-1.0.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"""
|
|
2
|
+
MygramDB Client for Python.
|
|
3
|
+
|
|
4
|
+
A high-performance Python client for MygramDB - an in-memory full-text search engine
|
|
5
|
+
that is 25-200x faster than MySQL FULLTEXT with MySQL replication support.
|
|
6
|
+
|
|
7
|
+
Example usage:
|
|
8
|
+
from mygramdb_client import MygramClient, ClientConfig, SearchOptions
|
|
9
|
+
|
|
10
|
+
async def main():
|
|
11
|
+
client = MygramClient(ClientConfig(host='localhost', port=11016))
|
|
12
|
+
await client.connect()
|
|
13
|
+
|
|
14
|
+
result = await client.search('articles', 'hello world',
|
|
15
|
+
SearchOptions(limit=100))
|
|
16
|
+
print(f"Found {result.total_count} results")
|
|
17
|
+
|
|
18
|
+
await client.disconnect()
|
|
19
|
+
"""
|
|
20
|
+
from .client import MygramClient, create_mygram_client
|
|
21
|
+
from .errors import (
|
|
22
|
+
ConnectionError,
|
|
23
|
+
InputValidationError,
|
|
24
|
+
MygramError,
|
|
25
|
+
ProtocolError,
|
|
26
|
+
ServerError,
|
|
27
|
+
TimeoutError,
|
|
28
|
+
)
|
|
29
|
+
from .search_expression import (
|
|
30
|
+
SearchExpression,
|
|
31
|
+
convert_search_expression,
|
|
32
|
+
has_complex_expression,
|
|
33
|
+
parse_search_expression,
|
|
34
|
+
simplify_search_expression,
|
|
35
|
+
to_query_string,
|
|
36
|
+
)
|
|
37
|
+
from .types import (
|
|
38
|
+
CacheStats,
|
|
39
|
+
ClientConfig,
|
|
40
|
+
CountOptions,
|
|
41
|
+
CountResponse,
|
|
42
|
+
DebugInfo,
|
|
43
|
+
Document,
|
|
44
|
+
DumpStatus,
|
|
45
|
+
ReplicationStatus,
|
|
46
|
+
SearchOptions,
|
|
47
|
+
SearchResponse,
|
|
48
|
+
SearchResult,
|
|
49
|
+
ServerInfo,
|
|
50
|
+
SimplifiedExpression,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
__version__ = "1.0.0"
|
|
54
|
+
|
|
55
|
+
__all__ = [
|
|
56
|
+
# Client
|
|
57
|
+
"MygramClient",
|
|
58
|
+
"create_mygram_client",
|
|
59
|
+
# Config and Options
|
|
60
|
+
"ClientConfig",
|
|
61
|
+
"SearchOptions",
|
|
62
|
+
"CountOptions",
|
|
63
|
+
# Response types
|
|
64
|
+
"SearchResponse",
|
|
65
|
+
"SearchResult",
|
|
66
|
+
"CountResponse",
|
|
67
|
+
"Document",
|
|
68
|
+
"ServerInfo",
|
|
69
|
+
"ReplicationStatus",
|
|
70
|
+
"DebugInfo",
|
|
71
|
+
"DumpStatus",
|
|
72
|
+
"CacheStats",
|
|
73
|
+
# Search expression
|
|
74
|
+
"SearchExpression",
|
|
75
|
+
"SimplifiedExpression",
|
|
76
|
+
"parse_search_expression",
|
|
77
|
+
"simplify_search_expression",
|
|
78
|
+
"convert_search_expression",
|
|
79
|
+
"has_complex_expression",
|
|
80
|
+
"to_query_string",
|
|
81
|
+
# Errors
|
|
82
|
+
"MygramError",
|
|
83
|
+
"ConnectionError",
|
|
84
|
+
"ProtocolError",
|
|
85
|
+
"TimeoutError",
|
|
86
|
+
"InputValidationError",
|
|
87
|
+
"ServerError",
|
|
88
|
+
]
|