Implement extensive search (#1406)

* Implement advanced search

Up to 5 individual tokens (separated by spaces) can be given as search string.
Each token is individually searched for in all selected fields.

Examples (assuming the relevant fields are selected for search):
- a part named `foo` with a tag `bar` will be found with the search string "foo bar".
- a part named `bar baz` will be found with the search string "baz bar".
- a part with the ID 123 and in storage location `a_qux_b` will be found with the search string "qux 123".

* Add tests

These were created with the help of GPT-5.2.
Disclaimer: I don't have the experience to judge the quality or validity of the results.

* Restructure query buildup

* Update tests

* Move options from Settings to localStorage

* Consider mutual exclusivity of search options

If regex search is enabled, the other two options are disabled (only visually). This should give the user a fair idea of what's happening while keeping things as simple as possible.

* Added translations for the checkboxes

* Fix stimulus controller to allow handling multiple instances of the dropdown menu

* Added tooltips for the different search mode options

---------

Co-authored-by: Jan Böhmer <mail@jan-boehmer.de>
This commit is contained in:
d-buchmann 2026-07-27 18:42:32 +02:00 committed by GitHub
parent 49ffd3c938
commit 1686df968f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 434 additions and 34 deletions

View file

@ -13715,6 +13715,34 @@ Buerklin-API Authentication server:
<target>You can use this randomly generated value (share it with nobody):</target>
</segment>
</unit>
<unit id="pJfdMQU" name="search.extensive_matching">
<segment>
<source>search.extensive_matching</source>
<target>Extensive Matching</target>
</segment>
</unit>
<unit id="YO2ZB66" name="search.permit_wildcards">
<segment>
<source>search.permit_wildcards</source>
<target>Treat &lt;code&gt;%&lt;/code&gt; and &lt;code&gt;_&lt;/code&gt; as wildcards</target>
</segment>
</unit>
<unit id="_nxvnMn" name="search.regexmatching.help">
<segment>
<source>search.regexmatching.help</source>
<target>Use regular expressions like "^\w{3,5}" to search for parts. Does not require slashes padding.</target>
</segment>
</unit>
<unit id="mry8ytG" name="search.extensive_matching.help">
<segment>
<source>search.extensive_matching.help</source>
<target>The search term is split up into parts, and a result is found, when each part is contained in any field. Without this mode the full search term has to be contained in a single field.</target>
</segment>
</unit>
<unit id="zLnKtwP" name="search.permit_wildcards.help">
<segment>
<source>search.permit_wildcards.help</source>
<target>If enabled, _ is treated as a wildcard for one character and % is treated as a wildcard for zero or more characters.</target>
<unit id="OP7MacF" name="system.trusted_hosts.unconfigured.title">
<segment state="translated">
<source>system.trusted_hosts.unconfigured.title</source>