Skip to content

fix to be able to query with both alias and identifier#836

Open
daddaman-amz wants to merge 8 commits intovalkey-io:mainfrom
daddaman-amz:daddaman-jsonbug-fix
Open

fix to be able to query with both alias and identifier#836
daddaman-amz wants to merge 8 commits intovalkey-io:mainfrom
daddaman-amz:daddaman-jsonbug-fix

Conversation

@daddaman-amz
Copy link
Collaborator

@daddaman-amz daddaman-amz commented Feb 28, 2026

If the fields has an alias and user tries to query with original identifier we throw an error.

RL behavior silently gives zero results for same case:

127.0.0.1:6379> FT.CREATE idx2 ON HASH SCHEMA content as con TEXT NOSTEM category as cat TAG price as pr NUMERIC
OK
127.0.0.1:6379> ft.search idx2 @con:"smart" dialect 2
1) (integer) 1
127.0.0.1:6379> ft.search idx2 @content:"smart" dialect 2
1) (integer) 0
127.0.0.1:6379> ft.search idx2 @cat:{test} dialect 2
1) (integer) 1
127.0.0.1:6379> ft.search idx2 @category:{test} dialect 2
1) (integer) 0

Ideal behavior would be to handle both cases from a query which this PR does

Signed-off-by: Manish Addanki <daddaman@amazon.com>
Signed-off-by: Manish Addanki <daddaman@amazon.com>
Signed-off-by: Manish Addanki <daddaman@amazon.com>
Signed-off-by: Manish Addanki <daddaman@amazon.com>
Signed-off-by: Manish Addanki <daddaman@amazon.com>
Signed-off-by: Manish Addanki <daddaman@amazon.com>
Signed-off-by: Manish Addanki <daddaman@amazon.com>
@daddaman-amz daddaman-amz linked an issue Feb 28, 2026 that may be closed by this pull request
Signed-off-by: Manish Addanki <daddaman@amazon.com>
@@ -408,7 +408,10 @@ absl::flat_hash_set<std::string> IndexSchema::GetTextIdentifiersByFieldMask(
absl::StatusOr<std::string> IndexSchema::GetIdentifier(
Copy link
Collaborator Author

@daddaman-amz daddaman-amz Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used by filter_parser.cc for numeric, tags

ParseNumericPredicate
ParseTagPredicate

return itr != attributes_.end() ? &itr->second : nullptr;
}

absl::StatusOr<vmsdk::UniqueValkeyString> IndexSchema::DefaultReplyScoreAs(
Copy link
Collaborator Author

@daddaman-amz daddaman-amz Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used in PreParseQueryString (search.cc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] User to be able to use both alias and original identifier name [BUG] Incorrect syntax scanning for JSON vector indexes

2 participants