hermes-client-python 1.8.84__tar.gz → 1.8.86__tar.gz
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.
- {hermes_client_python-1.8.84 → hermes_client_python-1.8.86}/PKG-INFO +43 -23
- {hermes_client_python-1.8.84 → hermes_client_python-1.8.86}/README.md +42 -22
- {hermes_client_python-1.8.84 → hermes_client_python-1.8.86}/pyproject.toml +1 -1
- {hermes_client_python-1.8.84 → hermes_client_python-1.8.86}/.gitignore +0 -0
- {hermes_client_python-1.8.84 → hermes_client_python-1.8.86}/src/hermes_client_python/__init__.py +0 -0
- {hermes_client_python-1.8.84 → hermes_client_python-1.8.86}/src/hermes_client_python/client.py +0 -0
- {hermes_client_python-1.8.84 → hermes_client_python-1.8.86}/src/hermes_client_python/hermes_pb2.py +0 -0
- {hermes_client_python-1.8.84 → hermes_client_python-1.8.86}/src/hermes_client_python/hermes_pb2_grpc.py +0 -0
- {hermes_client_python-1.8.84 → hermes_client_python-1.8.86}/src/hermes_client_python/types.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hermes-client-python
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.86
|
|
4
4
|
Summary: Async Python client for Hermes search server
|
|
5
5
|
Project-URL: Homepage, https://github.com/SpaceFrontiers/hermes
|
|
6
6
|
Project-URL: Repository, https://github.com/SpaceFrontiers/hermes
|
|
@@ -38,22 +38,29 @@ pip install hermes-client-python
|
|
|
38
38
|
import asyncio
|
|
39
39
|
from hermes_client_python import HermesClient
|
|
40
40
|
|
|
41
|
+
|
|
41
42
|
async def main():
|
|
42
43
|
async with HermesClient("localhost:50051") as client:
|
|
43
44
|
# Create index with SDL schema
|
|
44
|
-
await client.create_index(
|
|
45
|
+
await client.create_index(
|
|
46
|
+
"articles",
|
|
47
|
+
"""
|
|
45
48
|
index articles {
|
|
46
49
|
field title: text [indexed, stored]
|
|
47
50
|
field body: text [indexed, stored]
|
|
48
51
|
field score: f64 [stored]
|
|
49
52
|
}
|
|
50
|
-
|
|
53
|
+
""",
|
|
54
|
+
)
|
|
51
55
|
|
|
52
56
|
# Index documents
|
|
53
|
-
await client.index_documents(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
await client.index_documents(
|
|
58
|
+
"articles",
|
|
59
|
+
[
|
|
60
|
+
{"title": "Hello World", "body": "First article", "score": 1.5},
|
|
61
|
+
{"title": "Goodbye World", "body": "Last article", "score": 2.0},
|
|
62
|
+
],
|
|
63
|
+
)
|
|
57
64
|
|
|
58
65
|
# Commit changes
|
|
59
66
|
await client.commit("articles")
|
|
@@ -70,6 +77,7 @@ async def main():
|
|
|
70
77
|
# Delete index
|
|
71
78
|
await client.delete_index("articles")
|
|
72
79
|
|
|
80
|
+
|
|
73
81
|
asyncio.run(main())
|
|
74
82
|
```
|
|
75
83
|
|
|
@@ -99,22 +107,28 @@ await client.close()
|
|
|
99
107
|
|
|
100
108
|
```python
|
|
101
109
|
# Create index with SDL schema
|
|
102
|
-
await client.create_index(
|
|
110
|
+
await client.create_index(
|
|
111
|
+
"myindex",
|
|
112
|
+
"""
|
|
103
113
|
index myindex {
|
|
104
114
|
field title: text [indexed, stored]
|
|
105
115
|
field body: text [indexed, stored]
|
|
106
116
|
}
|
|
107
|
-
|
|
117
|
+
""",
|
|
118
|
+
)
|
|
108
119
|
|
|
109
120
|
# Create index with JSON schema
|
|
110
|
-
await client.create_index(
|
|
121
|
+
await client.create_index(
|
|
122
|
+
"myindex",
|
|
123
|
+
"""
|
|
111
124
|
{
|
|
112
125
|
"fields": [
|
|
113
126
|
{"name": "title", "type": "text", "indexed": true, "stored": true},
|
|
114
127
|
{"name": "body", "type": "text", "indexed": true, "stored": true}
|
|
115
128
|
]
|
|
116
129
|
}
|
|
117
|
-
|
|
130
|
+
""",
|
|
131
|
+
)
|
|
118
132
|
|
|
119
133
|
# Get index info
|
|
120
134
|
info = await client.get_index_info("myindex")
|
|
@@ -128,19 +142,24 @@ await client.delete_index("myindex")
|
|
|
128
142
|
|
|
129
143
|
```python
|
|
130
144
|
# Index multiple documents (batch)
|
|
131
|
-
indexed, errors = await client.index_documents(
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
145
|
+
indexed, errors = await client.index_documents(
|
|
146
|
+
"myindex",
|
|
147
|
+
[
|
|
148
|
+
{"title": "Doc 1", "body": "Content 1"},
|
|
149
|
+
{"title": "Doc 2", "body": "Content 2"},
|
|
150
|
+
],
|
|
151
|
+
)
|
|
135
152
|
|
|
136
153
|
# Index single document
|
|
137
154
|
await client.index_document("myindex", {"title": "Doc", "body": "Content"})
|
|
138
155
|
|
|
156
|
+
|
|
139
157
|
# Stream documents (for large datasets)
|
|
140
158
|
async def doc_generator():
|
|
141
159
|
for i in range(10000):
|
|
142
160
|
yield {"title": f"Doc {i}", "body": f"Content {i}"}
|
|
143
161
|
|
|
162
|
+
|
|
144
163
|
count = await client.index_documents_stream("myindex", doc_generator())
|
|
145
164
|
|
|
146
165
|
# Commit changes (required to make documents searchable)
|
|
@@ -157,20 +176,21 @@ num_segments = await client.force_merge("myindex")
|
|
|
157
176
|
results = await client.search("myindex", term=("title", "hello"), limit=10)
|
|
158
177
|
|
|
159
178
|
# Boolean query
|
|
160
|
-
results = await client.search(
|
|
161
|
-
"
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
179
|
+
results = await client.search(
|
|
180
|
+
"myindex",
|
|
181
|
+
boolean={
|
|
182
|
+
"must": [("title", "hello")],
|
|
183
|
+
"should": [("body", "world")],
|
|
184
|
+
"must_not": [("title", "spam")],
|
|
185
|
+
},
|
|
186
|
+
)
|
|
165
187
|
|
|
166
188
|
# With pagination
|
|
167
189
|
results = await client.search("myindex", term=("title", "hello"), limit=10, offset=20)
|
|
168
190
|
|
|
169
191
|
# With field loading
|
|
170
192
|
results = await client.search(
|
|
171
|
-
"myindex",
|
|
172
|
-
term=("title", "hello"),
|
|
173
|
-
fields_to_load=["title", "body"]
|
|
193
|
+
"myindex", term=("title", "hello"), fields_to_load=["title", "body"]
|
|
174
194
|
)
|
|
175
195
|
|
|
176
196
|
# Access results
|
|
@@ -14,22 +14,29 @@ pip install hermes-client-python
|
|
|
14
14
|
import asyncio
|
|
15
15
|
from hermes_client_python import HermesClient
|
|
16
16
|
|
|
17
|
+
|
|
17
18
|
async def main():
|
|
18
19
|
async with HermesClient("localhost:50051") as client:
|
|
19
20
|
# Create index with SDL schema
|
|
20
|
-
await client.create_index(
|
|
21
|
+
await client.create_index(
|
|
22
|
+
"articles",
|
|
23
|
+
"""
|
|
21
24
|
index articles {
|
|
22
25
|
field title: text [indexed, stored]
|
|
23
26
|
field body: text [indexed, stored]
|
|
24
27
|
field score: f64 [stored]
|
|
25
28
|
}
|
|
26
|
-
|
|
29
|
+
""",
|
|
30
|
+
)
|
|
27
31
|
|
|
28
32
|
# Index documents
|
|
29
|
-
await client.index_documents(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
await client.index_documents(
|
|
34
|
+
"articles",
|
|
35
|
+
[
|
|
36
|
+
{"title": "Hello World", "body": "First article", "score": 1.5},
|
|
37
|
+
{"title": "Goodbye World", "body": "Last article", "score": 2.0},
|
|
38
|
+
],
|
|
39
|
+
)
|
|
33
40
|
|
|
34
41
|
# Commit changes
|
|
35
42
|
await client.commit("articles")
|
|
@@ -46,6 +53,7 @@ async def main():
|
|
|
46
53
|
# Delete index
|
|
47
54
|
await client.delete_index("articles")
|
|
48
55
|
|
|
56
|
+
|
|
49
57
|
asyncio.run(main())
|
|
50
58
|
```
|
|
51
59
|
|
|
@@ -75,22 +83,28 @@ await client.close()
|
|
|
75
83
|
|
|
76
84
|
```python
|
|
77
85
|
# Create index with SDL schema
|
|
78
|
-
await client.create_index(
|
|
86
|
+
await client.create_index(
|
|
87
|
+
"myindex",
|
|
88
|
+
"""
|
|
79
89
|
index myindex {
|
|
80
90
|
field title: text [indexed, stored]
|
|
81
91
|
field body: text [indexed, stored]
|
|
82
92
|
}
|
|
83
|
-
|
|
93
|
+
""",
|
|
94
|
+
)
|
|
84
95
|
|
|
85
96
|
# Create index with JSON schema
|
|
86
|
-
await client.create_index(
|
|
97
|
+
await client.create_index(
|
|
98
|
+
"myindex",
|
|
99
|
+
"""
|
|
87
100
|
{
|
|
88
101
|
"fields": [
|
|
89
102
|
{"name": "title", "type": "text", "indexed": true, "stored": true},
|
|
90
103
|
{"name": "body", "type": "text", "indexed": true, "stored": true}
|
|
91
104
|
]
|
|
92
105
|
}
|
|
93
|
-
|
|
106
|
+
""",
|
|
107
|
+
)
|
|
94
108
|
|
|
95
109
|
# Get index info
|
|
96
110
|
info = await client.get_index_info("myindex")
|
|
@@ -104,19 +118,24 @@ await client.delete_index("myindex")
|
|
|
104
118
|
|
|
105
119
|
```python
|
|
106
120
|
# Index multiple documents (batch)
|
|
107
|
-
indexed, errors = await client.index_documents(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
121
|
+
indexed, errors = await client.index_documents(
|
|
122
|
+
"myindex",
|
|
123
|
+
[
|
|
124
|
+
{"title": "Doc 1", "body": "Content 1"},
|
|
125
|
+
{"title": "Doc 2", "body": "Content 2"},
|
|
126
|
+
],
|
|
127
|
+
)
|
|
111
128
|
|
|
112
129
|
# Index single document
|
|
113
130
|
await client.index_document("myindex", {"title": "Doc", "body": "Content"})
|
|
114
131
|
|
|
132
|
+
|
|
115
133
|
# Stream documents (for large datasets)
|
|
116
134
|
async def doc_generator():
|
|
117
135
|
for i in range(10000):
|
|
118
136
|
yield {"title": f"Doc {i}", "body": f"Content {i}"}
|
|
119
137
|
|
|
138
|
+
|
|
120
139
|
count = await client.index_documents_stream("myindex", doc_generator())
|
|
121
140
|
|
|
122
141
|
# Commit changes (required to make documents searchable)
|
|
@@ -133,20 +152,21 @@ num_segments = await client.force_merge("myindex")
|
|
|
133
152
|
results = await client.search("myindex", term=("title", "hello"), limit=10)
|
|
134
153
|
|
|
135
154
|
# Boolean query
|
|
136
|
-
results = await client.search(
|
|
137
|
-
"
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
155
|
+
results = await client.search(
|
|
156
|
+
"myindex",
|
|
157
|
+
boolean={
|
|
158
|
+
"must": [("title", "hello")],
|
|
159
|
+
"should": [("body", "world")],
|
|
160
|
+
"must_not": [("title", "spam")],
|
|
161
|
+
},
|
|
162
|
+
)
|
|
141
163
|
|
|
142
164
|
# With pagination
|
|
143
165
|
results = await client.search("myindex", term=("title", "hello"), limit=10, offset=20)
|
|
144
166
|
|
|
145
167
|
# With field loading
|
|
146
168
|
results = await client.search(
|
|
147
|
-
"myindex",
|
|
148
|
-
term=("title", "hello"),
|
|
149
|
-
fields_to_load=["title", "body"]
|
|
169
|
+
"myindex", term=("title", "hello"), fields_to_load=["title", "body"]
|
|
150
170
|
)
|
|
151
171
|
|
|
152
172
|
# Access results
|
|
File without changes
|
{hermes_client_python-1.8.84 → hermes_client_python-1.8.86}/src/hermes_client_python/__init__.py
RENAMED
|
File without changes
|
{hermes_client_python-1.8.84 → hermes_client_python-1.8.86}/src/hermes_client_python/client.py
RENAMED
|
File without changes
|
{hermes_client_python-1.8.84 → hermes_client_python-1.8.86}/src/hermes_client_python/hermes_pb2.py
RENAMED
|
File without changes
|
|
File without changes
|
{hermes_client_python-1.8.84 → hermes_client_python-1.8.86}/src/hermes_client_python/types.py
RENAMED
|
File without changes
|