diff --git a/src/qlever/commands/index.py b/src/qlever/commands/index.py index 522f5263..5222f731 100644 --- a/src/qlever/commands/index.py +++ b/src/qlever/commands/index.py @@ -77,6 +77,8 @@ def relevant_qleverfile_arguments(self) -> dict[str, list[str]]: "index": [ "input_files", "cat_input_files", + "geo_cell_grid_level", + "geo_cell_grid_scheme", "encode_as_id", "multi_input_json", "parallel_parsing", @@ -290,6 +292,10 @@ def execute(self, args) -> bool: return False # Add remaining options. + if args.geo_cell_grid_level: + index_cmd += f" --geo-cell-grid-level {args.geo_cell_grid_level}" + if args.geo_cell_grid_scheme: + index_cmd += f" --geo-cell-grid-scheme {args.geo_cell_grid_scheme}" if args.encode_as_id: index_cmd += f" --encode-as-id {args.encode_as_id}" if args.only_pso_and_pos_permutations: diff --git a/src/qlever/qleverfile.py b/src/qlever/qleverfile.py index 3fc79c3f..e53786da 100644 --- a/src/qlever/qleverfile.py +++ b/src/qlever/qleverfile.py @@ -221,6 +221,28 @@ def arg(*args, **kwargs): "large enough to contain the end of at least one statement " "(default: 10M)", ) + index_args["geo_cell_grid_level"] = arg( + "--geo-cell-grid-level", + type=int, + default=None, + help="Level L of the geo cell grid for WKT literals: the grid " + "cell of each literal is encoded into its ID, which enables the " + "geo cell prefilter for spatial joins; requires VOCABULARY_TYPE " + "on-disk-compressed-geo-split (default: no grid)", + ) + index_args["geo_cell_grid_scheme"] = arg( + "--geo-cell-grid-scheme", + type=str, + choices=[ + "flat", + "flat-4-shifts", + "hierarchical", + "hierarchical-3-shifts", + ], + default=None, + help="Cell assignment scheme of the geo cell grid " + "(default: flat); only relevant with GEO_CELL_GRID_LEVEL > 0", + ) index_args["encode_as_id"] = arg( "--encode-as-id", type=str, diff --git a/test/qlever/commands/test_index_execute.py b/test/qlever/commands/test_index_execute.py index a274d688..e632fb7f 100644 --- a/test/qlever/commands/test_index_execute.py +++ b/test/qlever/commands/test_index_execute.py @@ -47,6 +47,8 @@ def test_execute_successful_indexing_without_extras( args.image = "test_image" args.multi_input_json = False args.ulimit = None + args.geo_cell_grid_level = None + args.geo_cell_grid_scheme = None args.encode_as_id = None args.parser_buffer_size = None args.materialized_views = None @@ -264,6 +266,8 @@ def test_execute_total_file_size_greater_than_ten_gb( args.image = "test_image" args.multi_input_json = False args.ulimit = None + args.geo_cell_grid_level = None + args.geo_cell_grid_scheme = None args.encode_as_id = None args.parser_buffer_size = None args.materialized_views = None @@ -380,6 +384,8 @@ def test_execute_successful_indexing_with_extras_and_show( args.vocabulary_type = "on-disk-compressed" args.show = True args.ulimit = None + args.geo_cell_grid_level = None + args.geo_cell_grid_scheme = None args.encode_as_id = None args.parser_buffer_size = None args.materialized_views = None diff --git a/test/qlever/commands/test_index_other_methods.py b/test/qlever/commands/test_index_other_methods.py index f5afaffc..b29e7452 100644 --- a/test/qlever/commands/test_index_other_methods.py +++ b/test/qlever/commands/test_index_other_methods.py @@ -33,6 +33,8 @@ def test_relevant_qleverfile_arguments(self): "index": [ "input_files", "cat_input_files", + "geo_cell_grid_level", + "geo_cell_grid_scheme", "encode_as_id", "multi_input_json", "parallel_parsing",