Skip to content

Commit 135f494

Browse files
authored
Merge pull request #1309 from VisLab/new_release
Removed string search from public interface -- experimental
2 parents 6538198 + b76085c commit 135f494

4 files changed

Lines changed: 37 additions & 6 deletions

File tree

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,19 @@ jupyter notebook examples/
160160

161161
See [`examples/README.md`](examples/README.md) for more details.
162162

163+
## Experimental features
164+
165+
**String-based search** (`hed.models.string_search` and `hed.models.schema_lookup`) is a middle-ground search facility that operates on raw HED strings without requiring pre-parsed `HedString` objects or a loaded schema. It supports the full `QueryHandler` query syntax (logical operators, grouping, wildcards) and optionally accepts a pre-generated schema lookup dictionary to enable ancestor-aware matching on short-form strings.
166+
167+
> **This facility is still experimental.** Its API — including class names, function signatures, and module structure — may change in future releases without notice. These modules are **not** exported from the top-level `hed` package; import them directly:
168+
>
169+
> ```python
170+
> from hed.models.string_search import StringQueryHandler, string_search
171+
> from hed.models.schema_lookup import generate_schema_lookup
172+
> ```
173+
174+
See the [search details documentation](https://www.hedtags.org/hed-python/search_details.html) for a full comparison of all three search implementations and performance benchmarks.
175+
163176
## Documentation
164177
165178
📖 **Full Documentation:** [https://www.hedtags.org/hed-python](https://www.hedtags.org/hed-python)

docs/api/models.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,16 @@ search_hed_objs
177177

178178
.. autofunction:: hed.models.query_service.search_hed_objs
179179

180-
String-based search
181-
-------------------
180+
String-based search (experimental)
181+
-----------------------------------
182+
183+
.. warning::
184+
185+
This facility is **experimental**. Its API (classes, function signatures, and
186+
behaviour) may change in future releases without notice. Do **not** rely on
187+
``hed.models.string_search`` or ``hed.models.schema_lookup`` as a stable
188+
public interface. Import directly from those sub-modules rather than from
189+
the top-level ``hed`` package.
182190

183191
Search functions that operate on raw HED strings without requiring pre-parsed ``HedString`` objects
184192
or a loaded schema. See also :doc:`/search_details` for a full comparison of all three

docs/search_details.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,14 @@ Use `QueryHandler` when you need schema-aware ancestor matching, or when you wan
5353

5454
#### `StringQueryHandler` — tree-based schema-optional search
5555

56-
Located in {mod}`hed.models.string_search`, `StringQueryHandler` is a new middle-ground implementation that inherits from `QueryHandler` and reuses the full expression-tree compiler, but operates on raw strings rather than pre-parsed `HedString` objects.
56+
```{warning}
57+
This facility is **experimental**. The API of `hed.models.string_search` and
58+
`hed.models.schema_lookup` may change in future releases without notice.
59+
These modules are **not** part of the stable public interface exported from
60+
the top-level `hed` package. Import directly from the sub-modules.
61+
```
62+
63+
Located in {mod}`hed.models.string_search`, `StringQueryHandler` is a middle-ground implementation that inherits from `QueryHandler` and reuses the full expression-tree compiler, but operates on raw strings rather than pre-parsed `HedString` objects.
5764

5865
It parses each raw HED string into a lightweight {class}`~hed.models.string_search.StringNode` tree that duck-types the `HedGroup`/`HedTag` interfaces expected by the existing expression evaluators — so all `QueryHandler` query syntax works unchanged.
5966

@@ -71,11 +78,16 @@ Use `StringQueryHandler` when you have raw strings (not `HedString` objects), ne
7178

7279
#### Generating a schema lookup
7380

81+
```{note}
82+
`hed.models.schema_lookup` is part of the experimental string-search facility.
83+
Its interface may change in future releases.
84+
```
85+
7486
If you want `StringQueryHandler` to resolve ancestors for short-form strings (e.g. query `Event` matching `Sensory-event`) without a full schema parse per row, you can pre-generate a lookup dictionary from a `HedSchema`:
7587

7688
```python
7789
from hed import load_schema_version
78-
from hed import generate_schema_lookup, save_schema_lookup, load_schema_lookup
90+
from hed.models.schema_lookup import generate_schema_lookup, save_schema_lookup, load_schema_lookup
7991

8092
schema = load_schema_version("8.4.0")
8193
lookup = generate_schema_lookup(schema) # {short_name_casefold: tag_terms_tuple}

hed/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
from hed.models.definition_dict import DefinitionDict
1010
from hed.models.query_handler import QueryHandler
1111
from hed.models.query_service import get_query_handlers, search_hed_objs
12-
from hed.models.string_search import StringQueryHandler, parse_hed_string, string_search
13-
from hed.models.schema_lookup import generate_schema_lookup, load_schema_lookup, save_schema_lookup
1412

1513
from hed.schema.hed_schema import HedSchema
1614
from hed.schema.hed_schema_group import HedSchemaGroup

0 commit comments

Comments
 (0)