Quick search for Part-DB
Workaround for Part-DB/Part-DB-server#305
The part-db_quicksearch_addon is a simple HTML file that allows you to search quickly in the Part-DB.
The programming was done with a lot of help from ChatGPT, although my programming skills and code quality are at a beginner level.
The addon is not officially supported by Part-DB. It retrieves the results of the <Part-DB-Server>/en/typeahead/parts/search
API and outputs them as a table.
An implementation via the new API would certainly be better.
✅ search while typing
✅ free search (the order of the queries does not matter)
✅ simple user interface
✅ output of image, name, description, category, footprint and ID
✅ Multilingual (German and English)
Note
New in version 1.2
- added Check for updates when the page is loaded (to disable it, comment out the line
window.onload = checkForUpdates;
at the end of the file)
Note
New in version 1.1
- added icons and metadata for app shortcuts from Part-DB
- added links to Images
- added Footer with link to GitHub and Part-DB
- added Count of search results at the end of the table
- The URL to the Part-DB server no longer needs to be specified
- Automatic translation, based on the browser language
- English README.md
For the beginning I assume basic knowledge of HTML. I may expand the instructions in the future.
The current version was tested with Part-DB version: 1.10.6, with MySQL database, reverse proxy and Docker.
-
download search.html file search.html
-
the following lines must be adapted in the HTML file:
Language in line no. 1<html lang="en">
(en
orde
)Part-DB server URL in line no. 85var baseURL = '<Part-DB-Server-url>/typeahead/parts/search/';
-
copy file to
public_media
orpublic/media
directory -
access quick search
<Part-DB-Server-url>/media/search.html
-
(Optional) Insert link in banner.md
[New quick search](/media/search.html)
-
(Optional) Disable Check for updates, comment out the line
window.onload = checkForUpdates;
at the end of the file
When connecting via HTTPS and a reverse proxy, the complete Part-DB URL must be specified.- Why is there no pull request in the Part DB server? I don't know how to create pages with Symfony. 😁
- maximum 100 results, API limit
- searching with
/
and other special characters may not work - During testing, I experienced once that the page was very slow. Deleting all cookies and website data solved the problem for me.
If you are experiencing bugs, please provide a screenshot of the Web console with 'XHR' and 'Requests'.
-
Image as link -
Footer with link to GitHub and Part-DB -
Show the number of search results
Many thanks to the Part-DB project https://github.com/Part-DB/Part-DB-server