Skip to content

Commit

Permalink
more updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerhutcherson committed Nov 14, 2023
1 parent f5b30cb commit 68f215b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
14 changes: 7 additions & 7 deletions docs/user_guide/hash_vs_json_05.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,13 @@
"│ bytes_per_record_avg │ 3.40909 │\n",
"│ doc_table_size_mb │ 0.000700951 │\n",
"│ inverted_sz_mb │ 0.000143051 │\n",
"│ key_table_size_mb │ 0.000276566\n",
"│ key_table_size_mb │ 0.000248909\n",
"│ offset_bits_per_record_avg │ 8 │\n",
"│ offset_vectors_sz_mb │ 8.58307e-06 │\n",
"│ offsets_per_term_avg │ 0.204545 │\n",
"│ records_per_doc_avg │ 6.28571 │\n",
"│ sortable_values_size_mb │ 0 │\n",
"│ total_indexing_time │ 0.919\n",
"│ total_indexing_time │ 0.976\n",
"│ total_inverted_index_blocks │ 18 │\n",
"│ vector_index_sz_mb │ 0.0202332 │\n",
"╰─────────────────────────────┴─────────────╯\n"
Expand Down Expand Up @@ -278,9 +278,9 @@
],
"source": [
"from redisvl.query import VectorQuery\n",
"from redisvl.query.filter import Tag, Text\n",
"from redisvl.query.filter import Tag, Text, Num\n",
"\n",
"t = (Tag(\"credit_score\") == \"high\") & (Text(\"job\") % \"enginee*\")\n",
"t = (Tag(\"credit_score\") == \"high\") & (Text(\"job\") % \"enginee*\") & (Num(\"age\") > 17)\n",
"\n",
"v = VectorQuery([0.1, 0.1, 0.5],\n",
" \"user_embedding\",\n",
Expand Down Expand Up @@ -381,9 +381,9 @@
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[32m12:28:36\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Indices:\n",
"\u001b[32m12:28:36\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m 1. user-hashes\n",
"\u001b[32m12:28:36\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m 2. user-json\n"
"\u001b[32m13:25:11\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Indices:\n",
"\u001b[32m13:25:11\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m 1. user-hashes\n",
"\u001b[32m13:25:11\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m 2. user-json\n"
]
}
],
Expand Down
16 changes: 8 additions & 8 deletions redisvl/query/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ class Geo(FilterField):
FilterOperator.NE: "!=",
}
OPERATOR_MAP: Dict[FilterOperator, str] = {
FilterOperator.EQ: "@%s:[%f %f %i %s]",
FilterOperator.NE: "(-@%s:[%f %f %i %s])",
FilterOperator.EQ: "@%s:[%s %s %i %s]",
FilterOperator.NE: "(-@%s:[%s %s %i %s])",
}
SUPPORTED_VAL_TYPES = (GeoSpec, type(None))

Expand Down Expand Up @@ -270,12 +270,12 @@ class Num(FilterField):
FilterOperator.GE: ">=",
}
OPERATOR_MAP: Dict[FilterOperator, str] = {
FilterOperator.EQ: "@%s:[%i %i]",
FilterOperator.NE: "(-@%s:[%i %i])",
FilterOperator.GT: "@%s:[(%i +inf]",
FilterOperator.LT: "@%s:[-inf (%i]",
FilterOperator.GE: "@%s:[%i +inf]",
FilterOperator.LE: "@%s:[-inf %i]",
FilterOperator.EQ: "@%s:[%s %s]",
FilterOperator.NE: "(-@%s:[%s %s])",
FilterOperator.GT: "@%s:[(%s +inf]",
FilterOperator.LT: "@%s:[-inf (%s]",
FilterOperator.GE: "@%s:[%s +inf]",
FilterOperator.LE: "@%s:[-inf %s]",
}
SUPPORTED_VAL_TYPES = (int, float, type(None))

Expand Down
3 changes: 3 additions & 0 deletions tests/unit/test_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ def test_numeric_filter():
nf = Num("numeric_field") <= 5
assert str(nf) == "@numeric_field:[-inf 5]"

nf = Num("numeric_field") > 5.5
assert str(nf) == "@numeric_field:[-inf 5.5]"

nf = Num("numeric_field") <= None
assert str(nf) == "*"

Expand Down

0 comments on commit 68f215b

Please sign in to comment.