[Skip to main content](#vessel-content)

#   SQL error when all searched words have a length equal or less than the Min value

##

- **[oxido](/forum/user/29793-oxido "View oxido's Profile")**
- [![oxido's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/29793-oxido "View oxido's Profile") Topic Author
- [ Offline](/forum/user/29793-oxido)

Less More

- Posts: 282
- Thank you received: 42
-
-

2 weeks 6 days ago [\#100000142](#100000142) by [oxido](/forum/user/29793-oxido "View oxido's Profile")  *[SQL error when all searched words have a length equal or less than the Min value](/forum/26-product-category-display/100000028-sql-error-when-all-searched-words-have-a-length-equal-or-less-than-the-min-value#100000142 "-- HikaShop version -- : 6.6.0 -- Joomla version -- : 5.4.8 -- PHP version -- : 8.3.33 -- Browser(s) name and version -- : Chrome 154.0  Hello, I am encountering an SQL syntax error related to a custom product field used inside a HikaShop Filter. After detailed testing, I identified a specific pattern that seems to indicate a bug in how the Min/Max length filter generates its SQL conditions.  Context  &#42; &quot;pas cu pas&quot; = &quot;step by step&quot;.   &#42; I created a custom product field in HikaShop.  &#42; This field is used in a Filter module with Minimum length and Maximum length.  &#42; Search processing is set to “every words”.  Pattern of the issue The SQL error appears only when all searched words have a length equal to or less than the Min value. Examples:  &#42; If Min = 3 and the search term is “pas cu pas”, the error occurs because all words (“pas”, “cu”, “pas”) have length ≤ 3.  &#42; If Min = 2 and the search term is “pa cu pas”, the error does not occur because “pas” has 3 characters, which is greater than Min.  &#42; In general, if at least one searched word is longer than Min, the SQL error does not appear.  So the issue seems to be triggered only when &quot;  &quot; = &quot;every words / any word&quot; and Minimum length ≤ Searched value , which likely results in a malformed or empty SQL condition.  You have the link to the testing website, it is using ajax in search, so you need to refresh the page to see the error if not showing.  PS. In this new version of the forum I don't see the option to add protected data here, I would have given you the username and password to check on the testing site. :D")* was created by *[oxido](/forum/user/29793-oxido "View oxido's Profile")*

-- HikaShop version -- : 6.6.0
-- Joomla version -- : 5.4.8
-- PHP version -- : 8.3.33
-- Browser(s) name and version -- : Chrome 154.0

Hello,
I am encountering an SQL syntax error related to a custom product field used inside a HikaShop Filter. After detailed testing, I identified a specific pattern that seems to indicate a bug in how the Min/Max length filter generates its SQL conditions. Code:

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')) AND ((hikam_vendor.vendor_published IS NULL OR hikam_vendor.vendor_publish...' at line 1

**Context**

- **"pas cu pas" = "step by step".**
- I created a **custom product field** in HikaShop.
- This field is used in a **Filter module** with **Minimum length** and **Maximum length**.
- **Search processing** is set to **“every words”**.

**Pattern of the issue**
The SQL error appears **only when all searched words have a length equal to or less than the Min value**.
Examples:

- If **Min = 3** and the search term is **“pas cu pas”**, the error occurs because all words (“pas”, “cu”, “pas”) have length ≤ 3.
- If **Min = 2** and the search term is **“pa cu pas”**, the error does **not** occur because “pas” has 3 characters, which is greater than Min.
- In general, if **at least one searched word is longer than Min**, the SQL error does not appear.

So the issue seems to be triggered only when " **Search processing** " = "**every words / any word**" and **Minimum length ≤ Searched value** , which likely results in a malformed or empty SQL condition.

You have the link to the testing website, it is using ajax in search, so you need to refresh the page to see the error if not showing.

PS. In this new version of the forum I don't see the option to add protected data here, I would have given you the username and password to check on the testing site. ![:D](/bigsmile.gif ":D")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS8xMDAwMDAwMjgtc3FsLWVycm9yLXdoZW4tYWxsLXNlYXJjaGVkLXdvcmRzLWhhdmUtYS1sZW5ndGgtZXF1YWwtb3ItbGVzcy10aGFuLXRoZS1taW4tdmFsdWU/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86291
- Thank you received: 14269
-
-

2 weeks 6 days ago [\#100000145](#100000145) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[SQL error when all searched words have a length equal or less than the Min value](/forum/26-product-category-display/100000028-sql-error-when-all-searched-words-have-a-length-equal-or-less-than-the-min-value#100000145 "-- HikaShop version -- : 6.6.0 -- Joomla version -- : 5.4.8 -- PHP version -- : 8.3.33 -- Browser(s) name and version -- : Chrome 154.0  Hello, I am encountering an SQL syntax error related to a custom product field used inside a HikaShop Filter. After detailed testing, I identified a specific pattern that seems to indicate a bug in how the Min/Max length filter generates its SQL conditions.  Context  &#42; &quot;pas cu pas&quot; = &quot;step by step&quot;.   &#42; I created a custom product field in HikaShop.  &#42; This field is used in a Filter module with Minimum length and Maximum length.  &#42; Search processing is set to “every words”.  Pattern of the issue The SQL error appears only when all searched words have a length equal to or less than the Min value. Examples:  &#42; If Min = 3 and the search term is “pas cu pas”, the error occurs because all words (“pas”, “cu”, “pas”) have length ≤ 3.  &#42; If Min = 2 and the search term is “pa cu pas”, the error does not occur because “pas” has 3 characters, which is greater than Min.  &#42; In general, if at least one searched word is longer than Min, the SQL error does not appear.  So the issue seems to be triggered only when &quot;  &quot; = &quot;every words / any word&quot; and Minimum length ≤ Searched value , which likely results in a malformed or empty SQL condition.  You have the link to the testing website, it is using ajax in search, so you need to refresh the page to see the error if not showing.  PS. In this new version of the forum I don't see the option to add protected data here, I would have given you the username and password to check on the testing site. :D")*

Hi,

Thank you for the detailed analysis, it was right. When the Minimum length setting removes all the words of the search, the text filter still added an empty condition to the SQL query, hence the SQL error. The words exactly as long as the minimum length were also removed, while only shorter words should be skipped, which is why "PAS CU PAS" with a minimum of 3 failed.

We fixed it: now words as long as the minimum length are kept ("PAS" is searched with a minimum of 3), and when no word is left the filter is simply ignored with the "Text entered too short" message, as when the whole search is too short.

The fix will be included in the next version of HikaShop. You can also download the install package of the current version on our website and install it on yours in order to get the patch.

The following user(s) said Thank You: [oxido](/forum/user/29793-oxido "View oxido's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS8xMDAwMDAwMjgtc3FsLWVycm9yLXdoZW4tYWxsLXNlYXJjaGVkLXdvcmRzLWhhdmUtYS1sZW5ndGgtZXF1YWwtb3ItbGVzcy10aGFuLXRoZS1taW4tdmFsdWU/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop- Install &amp; Update- Product &amp; Category Display- Content Creation- Sales and Orders- - Orders management- - Reports &amp; Statistics- Customers- Checkout- Payment Methods- Shipping Methods- Import &amp; Export (CSV, XLS…)- Specific Features- - Affilation- - Taxes- - Wishlist- - Vote- - Carousel &amp; Slider- - Mass Actions- - Filters &amp; Search- - Discount &amp; Coupon- - Feature Request- Integrations- Showcase- General Talk about HikaShop- Development- - HikaShop 3.0 Beta- Translation- Commercial Jobs HikaShop Components- HikaMarket- - Market: Feature requests- - Market: How to?- - Market: Bug Report- HikaSerial- - General talk about HikaSerial- - Serial: Bug Report- - Serial: How to?- - Support en Français de HikaSerial (French Support)- - HikaSubscription- HikaAuction- - Auction: Feature requests- - Auction: How to?- - Auction: Bug report Hikashop around the world- Support en Français (French Support)- Russian- - FAQ. Курс выживания с Hikashop. Частые вопросы и о- - Расширения Hikashop- - Наши сайты на Hikashop- 日本語版サポート(Japanese Support)- Thai- German Archives- Bug Report- How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.154 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
