Skip to content

Conversation

@DemetrisChr
Copy link
Contributor

  • Added to_h methods that have the logic that used to be in to_json (This is helpful for the protostellar SDK). The to_json method is now defined in the base class and just converts to JSON what is returned by to_h
  • Removed the operator attribute from all search queries apart from MatchQuery as per the RFC
  • Removed some other attributes that are not in the spec (e.g. in MatchAllQuery)
  • Allow prefix_length without fuzziness in MatchQuery
  • Fixed DocIdQuery (doc_id had to be renamed to id, otherwise the server returns an error) + added a test for this

@cb-sdk-robot
Copy link
Collaborator

Can one of the admins verify this patch?

@DemetrisChr DemetrisChr requested a review from avsej April 4, 2023 14:54
@DemetrisChr DemetrisChr changed the title Remove extra attributes, fix bugs and add to_h RCBC-422: Remove extra attributes, fix bugs and add to_h Apr 4, 2023
data[:analyzer] = analyzer if analyzer
data[:operator] = operator if operator
data[:fuzziness] = fuzziness if fuzziness
data[:prefix_length] = prefix_length if prefix_length
Copy link
Member

Choose a reason for hiding this comment

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

prefix_length should not be checked if fuzziness was not specified

Copy link
Contributor Author

@DemetrisChr DemetrisChr Apr 4, 2023

Choose a reason for hiding this comment

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

The RFC says that prefix_length requires fuzziness to be specified for TermQuery, it doesn't mention this requirement for MatchQuery. I think it could make sense to have a prefix length for MatchQuery since it does stemming and other preprocessing, where you could end up matching words that don't have the same prefix as the query token, unless you use prefix_length. In TermQuery since it doesn't do any pre-processing it doesn't make sense to use prefix_length without fuzziness.

Copy link
Member

Choose a reason for hiding this comment

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

Nervermind, the spec does not say it. I don't know why I did it initially

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting, I guess in that case it doesn't really make a difference

@DemetrisChr DemetrisChr merged commit 61421f2 into couchbase:main Apr 4, 2023
@DemetrisChr DemetrisChr deleted the rcbc-422 branch April 4, 2023 15:44
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.

3 participants