graphiti-core 0.3.11__py3-none-any.whl → 0.3.13__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.

Potentially problematic release.


This version of graphiti-core might be problematic. Click here for more details.

@@ -37,6 +37,7 @@ logger = logging.getLogger(__name__)
37
37
  RELEVANT_SCHEMA_LIMIT = 3
38
38
  DEFAULT_MIN_SCORE = 0.6
39
39
  DEFAULT_MMR_LAMBDA = 0.5
40
+ MAX_QUERY_LENGTH = 512
40
41
 
41
42
 
42
43
  def fulltext_query(query: str, group_ids: list[str] | None = None):
@@ -49,8 +50,12 @@ def fulltext_query(query: str, group_ids: list[str] | None = None):
49
50
 
50
51
  group_ids_filter += ' AND ' if group_ids_filter else ''
51
52
 
52
- fuzzy_query = lucene_sanitize(query) + '~'
53
- full_query = group_ids_filter + fuzzy_query
53
+ lucene_query = lucene_sanitize(query)
54
+ # If the lucene query is too long return no query
55
+ if len(lucene_query.split(' ')) + len(group_ids or '') >= MAX_QUERY_LENGTH:
56
+ return ''
57
+
58
+ full_query = group_ids_filter + '(' + lucene_query + ')'
54
59
 
55
60
  return full_query
56
61
 
@@ -126,6 +131,8 @@ async def edge_fulltext_search(
126
131
  ) -> list[EntityEdge]:
127
132
  # fulltext search over facts
128
133
  fuzzy_query = fulltext_query(query, group_ids)
134
+ if fuzzy_query == '':
135
+ return []
129
136
 
130
137
  cypher_query = Query("""
131
138
  CALL db.index.fulltext.queryRelationships("edge_name_and_fact", $query)
@@ -219,6 +226,8 @@ async def node_fulltext_search(
219
226
  ) -> list[EntityNode]:
220
227
  # BM25 search to get top nodes
221
228
  fuzzy_query = fulltext_query(query, group_ids)
229
+ if fuzzy_query == '':
230
+ return []
222
231
 
223
232
  records, _, _ = await driver.execute_query(
224
233
  """
@@ -286,6 +295,8 @@ async def community_fulltext_search(
286
295
  ) -> list[CommunityNode]:
287
296
  # BM25 search to get top communities
288
297
  fuzzy_query = fulltext_query(query, group_ids)
298
+ if fuzzy_query == '':
299
+ return []
289
300
 
290
301
  records, _, _ = await driver.execute_query(
291
302
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: graphiti-core
3
- Version: 0.3.11
3
+ Version: 0.3.13
4
4
  Summary: A temporal graph building library
5
5
  License: Apache-2.0
6
6
  Author: Paul Paliychuk
@@ -32,7 +32,7 @@ graphiti_core/search/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
32
32
  graphiti_core/search/search.py,sha256=2YvUjOWnPYVa2DvZAqOuKbcdCxjX5bSynpQICqFqqGU,9040
33
33
  graphiti_core/search/search_config.py,sha256=dWcanEmMoL42RHF-jcZO9C2G9BdqjkI9w-5xe9Wd2Xg,2737
34
34
  graphiti_core/search/search_config_recipes.py,sha256=FpASZLdyMdTSwY4ISHrjRUnFKVCego7Wd3j5RPN-ris,4907
35
- graphiti_core/search/search_utils.py,sha256=fQkigkRS2EspsdE1CJoOadeT0rwFAR0CIxLBEI1_slI,19142
35
+ graphiti_core/search/search_utils.py,sha256=0muN5VgnxF9BnI8FN0pihA7eNvIidnAgu4jSslPxiLM,19458
36
36
  graphiti_core/utils/__init__.py,sha256=cJAcMnBZdHBQmWrZdU1PQ1YmaL75bhVUkyVpIPuOyns,260
37
37
  graphiti_core/utils/bulk_utils.py,sha256=JtoYTZPCigPa3n2E43Oe7QhFZRTA_QKNGy1jVgklHag,12614
38
38
  graphiti_core/utils/maintenance/__init__.py,sha256=TRY3wWWu5kn3Oahk_KKhltrWnh0NACw0FskjqF6OtlA,314
@@ -42,7 +42,7 @@ graphiti_core/utils/maintenance/graph_data_operations.py,sha256=RgdqYSau9Mr-f7IU
42
42
  graphiti_core/utils/maintenance/node_operations.py,sha256=h5nlRojbXOGJs-alpv6z6WnZ1UCixVGlAQYBQUqz8Bs,9030
43
43
  graphiti_core/utils/maintenance/temporal_operations.py,sha256=MvaRLWrBlDeYw8CQrKish1xbYcY5ovpfdqA2hSX7v5k,3367
44
44
  graphiti_core/utils/maintenance/utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
45
- graphiti_core-0.3.11.dist-info/LICENSE,sha256=KCUwCyDXuVEgmDWkozHyniRyWjnWUWjkuDHfU6o3JlA,11325
46
- graphiti_core-0.3.11.dist-info/METADATA,sha256=M7AI0LoxK_U9ZY_q7HjhHBG70DEHVxymjlUgXMR0Kd0,9437
47
- graphiti_core-0.3.11.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
48
- graphiti_core-0.3.11.dist-info/RECORD,,
45
+ graphiti_core-0.3.13.dist-info/LICENSE,sha256=KCUwCyDXuVEgmDWkozHyniRyWjnWUWjkuDHfU6o3JlA,11325
46
+ graphiti_core-0.3.13.dist-info/METADATA,sha256=yAr9jAsXTFLAeTTCYrtjfRTC9vPAQqbJT6UBjh3DOns,9437
47
+ graphiti_core-0.3.13.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
48
+ graphiti_core-0.3.13.dist-info/RECORD,,