Skip to content

Conversation

@alex-au-922
Copy link
Contributor

@alex-au-922 alex-au-922 commented May 11, 2024

A large PR on implementing the range query.

Supported Types:

  • Unsigned Integer
  • Integer
  • Float
  • Date
  • IpAddr
    (I have no idea how RangeQuery over text works though tantivy supports it, feel free to correct me but now I just make it unavailable)

Changes:

  • Added Document add_ip_addr method for feature parity from from_dict with SchemaBuilder's schema
  • Created a new Enum class of FieldType as Type might confuse python users with the typing.Type class
  • Fixed little commenting errors in Document's add_json method
  • Created the Query.range_query method

Expected Usage:

@staticmethod
def range_query(
    schema: Schema,
    field_name: str,
    field_type: FieldType,
    lower_bound: _RangeType,
    upper_bound: _RangeType,
    include_lower: bool = True,
    include_upper: bool = True,
) -> Query:
    pass

query = Query.range_query(
    index.schema, 
    "date", 
    FieldType.Date, 
    datetime.datetime(2020, 1, 1), 
    datetime.datetime(2021, 1, 1), 
    include_upper=False
)

As the RangeQuery involves a lot of types, I would like to have a more comprehensive review before rolling out to main.

@alex-au-922
Copy link
Contributor Author

I have added back the Makefile for the ease of testing

Makefile Outdated

source_files := $(wildcard src/*.rs)

all: format lint build test
Copy link
Collaborator

Choose a reason for hiding this comment

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

We do have a Noxfile and hence I would recommend to add needed shortcuts to the Noxfile instead of adding a separate means of automation. (I do not really care whether Makefile or Noxfile, just that we use only one of it and not both. For a Python extension, a Noxfile does seem closer to home though...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your explanation! I have removed the Makefile now

@cjrh
Copy link
Collaborator

cjrh commented May 13, 2024

Thanks for this. I'll go through it when I have a chance. Most likely on the weekend.

@cjrh cjrh merged commit adc7b08 into quickwit-oss:master Jun 9, 2024
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