Skip to content

Implement advanced search#1406

Open
d-buchmann wants to merge 5 commits into
Part-DB:masterfrom
d-buchmann:advanced-search-squashed
Open

Implement advanced search#1406
d-buchmann wants to merge 5 commits into
Part-DB:masterfrom
d-buchmann:advanced-search-squashed

Conversation

@d-buchmann

@d-buchmann d-buchmann commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Supersedes PR #944
Nota bene: Test were generated using AI. The actual code is handwritten.

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 capacitor named MLCC 100nF, Manufacturer Kemet, Footprint 0603 will be found with any combination of the 4 keywords in any order.

All above examples don't yield these results in the current search implementation.
While the filter would be the more efficient tool to achieve the same results, some users might not be familiar with this - but quite possibly with a search bar.

Added SearchSettings which has 3 items:

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".
@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.33333% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.49%. Comparing base (57a0dfd) to head (2a1c985).
⚠️ Report is 54 commits behind head on master.

Files with missing lines Patch % Lines
src/DataTables/Filters/PartSearchFilter.php 93.02% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1406      +/-   ##
============================================
+ Coverage     58.44%   58.49%   +0.05%     
- Complexity     8667     8687      +20     
============================================
  Files           634      637       +3     
  Lines         27991    28070      +79     
============================================
+ Hits          16359    16420      +61     
- Misses        11632    11650      +18     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.
@d-buchmann d-buchmann force-pushed the advanced-search-squashed branch from 8f1f10c to c21c6fe Compare June 9, 2026 06:27
@jbtronics

Copy link
Copy Markdown
Member

I took a rough look:

  • I think its not so useful to make this search mode global behavior, but instead user configurable (via the existing search options dropdown). This also allows to temporarily switch it. Maybe the system settings can stay as some default
  • Is there much need to make the token count configurable? Is there much disadvantage than just hardcode it to 5 or so? Its probably rare that someone use so many token anyway, and the worst that can happen is that the search request takes a bit longer, but you can still use a different search mode for this.

@d-buchmann d-buchmann force-pushed the advanced-search-squashed branch 2 times, most recently from ac1e6ed to 7d1738f Compare June 26, 2026 10:09
@d-buchmann d-buchmann force-pushed the advanced-search-squashed branch from 7d1738f to 2a1c985 Compare June 26, 2026 10:11
@d-buchmann

Copy link
Copy Markdown
Contributor Author

You're right about the user configurability, that way it can adapt to the varying user preferences much better.
I also hardcoded the token count to 5 which is indeed plenty and threw out the search settings completely because that would have overcomplicated it.

Meanwhile advanced search sounds odd to me, so I used the term extensive which describes better what it does - it just searches "more", not necessarily "better".

One more aspect I haven't yet solved is that regex and extensive search are mutually exclusive in the PHP code, but not in the user interface. It works, but if regex is enabled, the other two options will be silently ignored.

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.

2 participants