Closed chmorgan closed 4 months ago
@whmountains can you give this a shot?
Thanks for this @chmorgan
I may be doing something wrong, but it's not working for me. When I type in a two-letter query, it continues displaying the results of the previous, longer query.
I added some some logging to find the problem:
2024.04.25 10:09:26 - INFO - search - evaluating keyword `2k`
2024.04.25 10:09:26 - INFO - search - using LIKE query for `2k`: `AND description LIKE '%2k%'`
2024.04.25 10:09:26 - INFO - search - Executing query: SELECT "LCSC Part","MFR.Part","Package","Solder Joint","Library Type","Stock","Manufacturer","Description","Price" FROM parts WHERE parts MATCH ''AND description LIKE '%2k%' AND "Library Type" IN ("Basic") ORDER BY "LCSC Part" COLLATE naturalsort ASC LIMIT 1000
Traceback (most recent call last):
File "/Users/cw/Documents/KiCad/8.0/scripting/plugins/chmorgan-kicad-tools/partselector.py", line 587, in search
result = self.parent.library.search(parameters)
File "/Users/cw/Documents/KiCad/8.0/scripting/plugins/chmorgan-kicad-tools/library.py", line 218, in search
return cur.execute(query).fetchall()
sqlite3.OperationalError: fts5: syntax error near ""
Something funny is going on when there is nothing to match.: WHERE parts MATCH ''AND
Doh, I’ll fix tonight. We may be assuming there is always a match term.
Thanks for the test run.
On Thu, Apr 25, 2024 at 11:13 AM Caleb Whiting @.***> wrote:
Thanks for this @chmorgan https://github.com/chmorgan
I may be doing something wrong, but it's not working for me. When I type in a two-letter query, it continues displaying the results of the previous, longer query.
I added some some logging to find the problem:
2024.04.25 10:09:26 - INFO - search - evaluating keyword
2k
2024.04.25 10:09:26 - INFO - search - using LIKE query for2k
:AND description LIKE '%2k%'
2024.04.25 10:09:26 - INFO - search - Executing query: SELECT "LCSC Part","MFR.Part","Package","Solder Joint","Library Type","Stock","Manufacturer","Description","Price" FROM parts WHERE parts MATCH ''AND description LIKE '%2k%' AND "Library Type" IN ("Basic") ORDER BY "LCSC Part" COLLATE naturalsort ASC LIMIT 1000 Traceback (most recent call last): File "/Users/cw/Documents/KiCad/8.0/scripting/plugins/chmorgan-kicad-tools/partselector.py", line 587, in search result = self.parent.library.search(parameters) File "/Users/cw/Documents/KiCad/8.0/scripting/plugins/chmorgan-kicad-tools/library.py", line 218, in search return cur.execute(query).fetchall() sqlite3.OperationalError: fts5: syntax error near ""Something funny is going on when there is nothing to match.: WHERE parts MATCH ''AND
— Reply to this email directly, view it on GitHub https://github.com/Bouni/kicad-jlcpcb-tools/pull/452#issuecomment-2077529038, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJH4AG74OCNZDHHY72NE6DY7EMPZAVCNFSM6AAAAABGX4NKM6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZXGUZDSMBTHA . You are receiving this because you were mentioned.Message ID: @.***>
@whmountains alright, updated and should fix the issue you saw.
@whmountains ping on whether this addresses your issues. Would like to get it merged in for quality of life improvements for anyone using the plugin.
Can confirm this PR now works correctly with searches less than 3 chars.
:shipit:
Any updates on this @Bouni ? Would like to get this and the other PR merged for quality of use improvements for present users.
No, I'm on vacation at the moment. Will be back next week
Ahh ok, np, have a good vacation!
On Mon, May 6, 2024 at 7:23 AM bouni @.***> wrote:
No, I'm on vacation at the moment. Will be back next week
— Reply to this email directly, view it on GitHub https://github.com/Bouni/kicad-jlcpcb-tools/pull/452#issuecomment-2095787432, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJH4ABVNXFCTAKKNUODNMLZA5R2DAVCNFSM6AAAAABGX4NKM6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJVG44DONBTGI . You are receiving this because you were mentioned.Message ID: @.***>
LGTM
…han 3 unicode characters
FTS5 'match' only evaluates substrings longer than 3 unicode characters, searching for shorter substrings results in no matches being returned.
Fixes an issue where attempting to search for substrings shorter than 3 characters was resulting in empty search results.
Add "AND description LIKE '%SUBSTRING%'" terms for each substring shorter than 3 characters.