Instant Search

Views: 59,251

Results 141 to 160 of 262
22 Mar 2022, 5:25 PM
#141
marcopm avatar

marcopm

New Zenner

Join Date:
Jun 2021
Posts:
42
Plugin Contributions:
1

Instant Search

giancalr:

Hello, I did a clean install of zen cart 157d but when I install the pug in me it gives this error: [22-Mar-2022 11:47:11 Europe / Rome] PHP Parse error: syntax error, unexpected ':', expecting '{' in /includes/functions/extra_functions/instant_search_functions.php on line 17

[22-Mar-2022 11:47:11 Europe / Rome] Request URI: /index.php?main_page=index, IP address: 151.26.166.102
-> PHP Parse error: syntax error, unexpected ':', expecting '{' in /includes/functions/extra_functions/instant_search_functions.php on line 17.

That's because you're using PHP 5.x.
Again: minimum requirement is PHP 7.x

27 Aug 2022, 2:14 PM
#142
jodean avatar

jodean

Totally Zenned

Join Date:
May 2011
Location:
Tennessee
Posts:
511
Plugin Contributions:
0

Re: Instant Search

I installed the current version into my 1.5.7d it works in the product search box but not in any other search box. All the files are in the correct locations and I have uninstalled and re-installed but it still only works in the product search. Since it works in the product search box but nowhere else I suspect I have something installed incorrectly.

Do you have any suggestion's where I should look to solve the problem?

27 Aug 2022, 5:07 PM
#143
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,868
Plugin Contributions:
19

Re: Instant Search

You don't state what template you are using. Bootstrap includes a great search feature but, you have to turn it on.

This one says it has some options so you might want to look through the files for possible switches.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

5 Sep 2022, 7:12 PM
#144
cruiser avatar

cruiser

New Zenner

Join Date:
Aug 2006
Posts:
34
Plugin Contributions:
0

Re: Instant Search

**Getting this error non stop for all instant searches. Just would like to see what I could do to stop the errors in my Debug Logs.

Log File:**

[05-Sep-2022 11:31:05 America/Los_Angeles] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 16384 bytes) in /includes/classes/db/mysql/query_factory.php on line 44

[05-Sep-2022 11:31:05 America/Los_Angeles] Request URI: /ajax.php?act=ajaxInstantSearch&method=instantSearch, IP address: xxxxxxxx
--> PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 16384 bytes) in /includes/classes/db/mysql/query_factory.php on line 44.

5 Sep 2022, 9:39 PM
#145
marcopm avatar

marcopm

New Zenner

Join Date:
Jun 2021
Posts:
42
Plugin Contributions:
1

Re: Instant Search

cruiser:

**Getting this error non stop for all instant searches. Just would like to see what I could do to stop the errors in my Debug Logs.

Log File:**

[05-Sep-2022 11:31:05 America/Los_Angeles] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 16384 bytes) in /includes/classes/db/mysql/query_factory.php on line 44

[05-Sep-2022 11:31:05 America/Los_Angeles] Request URI: /ajax.php?act=ajaxInstantSearch&method=instantSearch, IP address: xxxxxxxx
--> PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 16384 bytes) in /includes/classes/db/mysql/query_factory.php on line 44.

Ensure that "Search product's attributes values" under Instant Search settings is set to false and/or increase PHP memory limit from 256M to 512M

I sometimes get that error as well on my dev environment where php's memory_limit is set to 128M or so. I'll try to see if I can make some changes to the plugin to avoid those errors

6 Sep 2022, 1:33 PM
#146
jodean avatar

jodean

Totally Zenned

Join Date:
May 2011
Location:
Tennessee
Posts:
511
Plugin Contributions:
0

Re: Instant Search

I am using the Responsive template.

6 Sep 2022, 3:45 PM
#147
marcopm avatar

marcopm

New Zenner

Join Date:
Jun 2021
Posts:
42
Plugin Contributions:
1

Re: Instant Search

jodean:

I am using the Responsive template.

It should work then. Do you have any customizations to the template?
The plugin attaches the results dropdown under every input box with name "keyword". If it doesn't show then it could be that those search boxes have another name

28 Oct 2022, 8:54 PM
#148
njcyx avatar

njcyx

Zen Follower

Join Date:
Apr 2019
Posts:
376
Plugin Contributions:
0

Re: Instant Search

zc 1.58 php8.0 responsive classic template

I just tried to install this v2.1.0 version instant search from zc plug-in library. It still works!

It is my first time to use this plug-in and I have one question. My instant search result doesn't search the product description. For example, I have a sample text "ABCDE" in one of the listing description. If I search "ABCDE", I will get empty result from the instant search. I checked the previous posts and this plug-in should also search the listing description, correct? I checked the settings of this plug-in and I cannot find an on/off switch for description search...

29 Oct 2022, 6:35 AM
#149
marcopm avatar

marcopm

New Zenner

Join Date:
Jun 2021
Posts:
42
Plugin Contributions:
1

Re: Instant Search

njcyx:

zc 1.58 php8.0 responsive classic template

I just tried to install this v2.1.0 version instant search from zc plug-in library. It still works!

It is my first time to use this plug-in and I have one question. My instant search result doesn't search the product description. For example, I have a sample text "ABCDE" in one of the listing description. If I search "ABCDE", I will get empty result from the instant search. I checked the previous posts and this plug-in should also search the listing description, correct? I checked the settings of this plug-in and I cannot find an on/off switch for description search...

It doesn't search the product description. I might add this feature in a future version with another on/off switch setting, but, if enabled, I'm afraid it would slow down the search too much (it already has some slowness/memory consumption problems). At that point it would be like a normal ("advanced") search, while the focus of the instant search is to be faster and less refined than the normal search.

31 Oct 2022, 6:22 AM
#150
dw08gm avatar

dw08gm

Totally Zenned

Join Date:
Sep 2008
Location:
DownUnder, overlooking South Pole.
Posts:
1,018
Plugin Contributions:
2

Re: Instant Search

dbltoe:

You don't state what template you are using. Bootstrap includes a great search feature but, you have to turn it on.

This one says it has some options so you might want to look through the files for possible switches.

Please correct me if I am wrong, but you mean the AJAX search in ZCA Bootstrap Template.

As I thought instant search was also an AJAX search, I am interested in learning the difference between the two.

Was a version of the Instant Search mod incorporated into ZCA Bootstrap Template or is its search a completely different build?

Thanks

31 Oct 2022, 8:07 AM
#151
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,868
Plugin Contributions:
19

Re: Instant Search

They may both be. I just know I prefer the one in bootstrap. topkayakerDOTcom is from mod. silversageherbsDOTcom is bootstrap.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

31 Oct 2022, 3:10 PM
#152
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,973
Plugin Contributions:
8

Re: Instant Search

dw08gm:

Please correct me if I am wrong, but you mean the AJAX search in ZCA Bootstrap Template.

As I thought instant search was also an AJAX search, I am interested in learning the difference between the two.

Was a version of the Instant Search mod incorporated into ZCA Bootstrap Template or is its search a completely different build?

Thanks

there are significant differences between the two. few points:

  • they are both ajax searches.
  • the display of results is different between the two; however this always somewhat customizable in your template.
  • the search logic, as in the guts of them, is very different.
  • the resources necessary to do said searches could be completely different.

i will only comment on the logic differences. the bootstrap template incorporated changes made to zc v158. prior to v158, zc searching was woefully inadequate. changes now make use of boolean matches of the words that are being searched. you can see the bootstrap logic here:

https://github.com/lat9/ZCA-Bootstrap-Template/blob/87144033e825deb20e567b347f4bd86ef847364a/includes/classes/ajax/zcAjaxBootstrapSearch.php#L23-L50

and see the similarities to the new zc (as of v158) function zen_build_keyword_where_clause here:

https://github.com/zencart/zencart/blob/8972fc0fceb0f1d8ffd2828339063e3292bbc1d5/includes/functions/functions_search.php#L163-L204

the instant search mod makes use of the mysql operator REGEXP which uses regular expressions. you can see some of that logic here:

https://github.com/marco-pm/zencart_instantsearch/blob/ec57283921b49f836708390b0aa02021d983d77c/includes/classes/ajax/zcAjaxInstantSearch.php#L86-L92

i will not go on with a discussion of the power of regular expressions. i will suffice to quote something here from the 'net:

"What is the difference between RegExp and like in MySQL?
Basically, LIKE does very simple wildcard matches, and REGEX is capable of very complicated wildcard matches. In fact, regular expressions ( REGEX ) are so capable that they are [1] a whole study in themselves [2] an easy way to introduce very subtle bugs."

as the person responsible for the zen_build_keyword_where_clause, i think it is a vast improvement over previous searching in zc. however, i have implemented the instant search plugin on a few client sites, and i am duly impressed with its power and ability to provide excellent results. as previously stated somewhere, there are some potential performance pitfalls with instant search, but in general, i am a big fan of that plugin.

hope that helps.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

31 Oct 2022, 3:26 PM
#153
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,729
Plugin Contributions:
56

Re: Instant Search

Indeed! Thanks to both @marcopm and @carlwhat for making Zen Cart better with these code contributions.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

31 Oct 2022, 4:01 PM
#154
njcyx avatar

njcyx

Zen Follower

Join Date:
Apr 2019
Posts:
376
Plugin Contributions:
0

Re: Instant Search

marcopm:

It doesn't search the product description. I might add this feature in a future version with another on/off switch setting, but, if enabled, I'm afraid it would slow down the search too much (it already has some slowness/memory consumption problems). At that point it would be like a normal ("advanced") search, while the focus of the instant search is to be faster and less refined than the normal search.

Hi @marcopm, thanks for your explanation. It makes more senses now.

1 Nov 2022, 6:36 AM
#155
dw08gm avatar

dw08gm

Totally Zenned

Join Date:
Sep 2008
Location:
DownUnder, overlooking South Pole.
Posts:
1,018
Plugin Contributions:
2

Re: Instant Search

carlwhat:

there are significant differences between the two. [trimmed by me]

Thanks for providing the file comparisons.

It is going to take me a while to fully appreciate the coding differences (and the use of github).

Are the three little dots placed on the LHS of the line numbers and the pale yellow highlighting in the github files your doing.

Cheers

1 Nov 2022, 7:05 AM
#156
dw08gm avatar

dw08gm

Totally Zenned

Join Date:
Sep 2008
Location:
DownUnder, overlooking South Pole.
Posts:
1,018
Plugin Contributions:
2

Re: Instant Search

dbltoe:

They may both be. I just know I prefer the one in bootstrap. topkayakerDOTcom is from mod. silversageherbsDOTcom is bootstrap.

Thanks for the site comparison.

At first glance I am inclined to agree with you, however, I say this without having investigated the full capabilities of either search function nor whether these sites have fully used the capabilities of their search function.

The topkayaker search is setup to provide a vertical list beneath the search box where individual lines consists of tiny product thumbnail and product title. However the search box disappears from view upon shrinking down the display to mobile phone size, which suggests the site has not really been designed to be fluid responsive.

The silversageherbs search is setup to provide considerably more information in a larger boxed display format that takes advantage of the broader centre column and fluid responsive design, and therefore seems more forgiving of fat finger syndrome on small screens such as a mobile.

Cheers

11 Jan 2023, 4:15 PM
#157
marcopm avatar

marcopm

New Zenner

Join Date:
Jun 2021
Posts:
42
Plugin Contributions:
1

Re: Instant Search

The new 3.0.0 version of the plugin is available on GitHub and I have submitted it for review for the plugins section here.

This is a BIG update that brings new features and substantial improvements to previous versions:

  • Code almost entirely rewritten – no more slow searches or out of memory errors!
  • New search and rank logic, a combination of MySQL Full-Text search with Query Expansion and LIKE/REGEXP queries
  • New, additional search results page with sortable product list and infinite scroll
  • New admin settings, including control of which fields to search and their order
  • More robust dropdown auto-positioning
  • Support for Zen Cart 1.5.8 language files and plugin upgrade functionality
  • Additional template files for the Bootstrap theme
  • Integration with Search Log plugin
  • Admin settings validation
  • Removed jQuery dependency
  • Bug fixes

It's compatible with ZC 157 and 158, and PHP version 7.4 through 8.2. There are no modifications to ZC core files.

Highly recommended to read the included HTML readme, not only for the installation instructions but also for additional useful information within.

I report here some of the FAQs included in the readme:

What's the difference between Instant Search and the Advanced Search included in Zen Cart?
Instant Search uses Ajax (no page reload) and searches for matches only on specific fields (product's name, model and description) with the goal of being fast and relevant. It does not load all results at once, but rather stops once it has found enough, and sorts them by relevance to the user query. It can also find similar results (Query Expansion).

The storefront (formerly "Advanced") Search doesn't use Ajax and aims for completeness and flexibility. The user can apply various filter conditions, such as limiting the search to certain categories or price ranges and using AND/OR in the query. It is therefore the tool to use for tailored searches on all available fields. The storefront Search also shows the exact total number of results, but in order to do this and provide pagination, it must first retrieve them all from the database. Additionally, it does not sort the results by relevance.

What's the difference between Instant Search and the Ajax Search of the Bootstrap template?
Aside from a visual difference (Bootstrap Ajax search shows results in a modal instead of a dropdown), both use Ajax (no page reload) and only look for matches on specific product fields (product's name and model, also product's description – if enabled – in the case of Instant Search).
The difference is that Bootstrap Ajax Search is still partially based on the storefront Search algorithm. It retrieves all the results first to count them, and it doesn't sort them by relevance. Compared to the storefront Search though, it's very fast.
Depending on your needs, if you're using the Bootstrap template you may prefer the Bootstrap Ajax Search to Instant Search. You can easily switch between them in the configuration settings.

The search is slow
Ideally, the results should be returned in less than 1 second.
If that's not the case, disable the search in product descriptions (i.e. in the admin Fields to Search and Order setting, use name instead of name-description).
If the search is still slow, disable Query Expansion.

The autocomplete dropdown does not appear
If you have enabled dropdown results and nothing happens when the user types, you may be using a custom template and your search entry boxes have a different CSS selector. You can set the CSS selector in the admin Dropdown - Input Box Selector setting.

The look of the results listing page doesn't fit my store template
The plugin provides template files for Responsive Classic and Bootstrap templates. If you're using a different template, you might need to customize these files to fit your store's theme:
/includes/modules/YOUR_TEMPLATE/product_listing_instant_search.php
/includes/templates/YOUR_TEMPLATE/templates/tpl_instant_search_result_default.php
/includes/templates/YOUR_TEMPLATE/templates/tpl_ajax_instant_search_results_listing.php

The search returns too many non-relevant results
Disable Query Expansion.

The results listing page is slow when a sort is applied
A custom sort (e.g. sort by price) in the product list basically negates the speed advantage of Instant Search, because it has to find and load all products first in order to sort them.

Finally, some more "technical" considerations that led me to rewrite the plugin almost entirely.

The first step of a search is always to break down the search query entered by the user into tokens (separated by spaces) and then search the database for them. Using REGEXP (aka RLIKE) token1|token2|... or using (LIKE %token1% OR LIKE %token2% OR...) doesn't actually change much, execution times are comparable even with a very large number of records (I tried). Reading online, there are instances where one seems to work better than the other, but in general it doesn't make much difference. Nowadays db engines are usually smart enough to use indexes when they need it and do different optimizations to the query on their own.

What really makes the difference in terms of execution time is the sorting of the result according to relevance to the user's query. And here is the sore point.

Loading all the results into memory and then sorting them is a bad idea no matter what (see out of memory errors of the previous versions). Finding and sorting things in the database using indexes will of course always be more efficient. The query_factory class (the class of the global $db object) is also not the best in terms of performance. Using a PDO connection seems better (I tried for example with the DB facade provided by Laravel capsule, now that it's included in ZC 1.5.8), but still: loading and sorting result in memory = very bad idea.

Also, the plugin's custom rating function that I wrote was extremely basic and questionable, to say the least.

There's no need to reinvent the wheel: MySQL already provides a great search and sorting tool, the Full-Text search. It's actually nothing really new, in fact I even used, among others, the same technique described in this famous 13-year-old post that still applies perfectly today (product names have higher priority than product descriptions in search results).

The plugin now creates two full-text indexes (product name and product description) on the product_description table and takes advantage of MySQL Full-Text search function, in combination with some LIKE/REGEXP queries to cover all cases. From what I've tested so far, the performance is good. Searching in product descriptions could obviously lead to longer search times, in which case you should disable the option as explained in the readme.

Full-Text search also comes with the nice optional Query Expansion feature, which can provide similar products to display in the results. More about this in the readme.

Obviously all this is not comparable to the use of a specialized search engine (algolia, elasticsearch and the like), which offers unbeatable performance and many more features (among many, the "did you mean?" feature). But all things considered I think it's still a pretty good result, obtained without the need of install or configure anything else.

11 Jan 2023, 5:26 PM
#158
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,973
Plugin Contributions:
8

Re: Instant Search

big :thumbsup:

can't wait to check it out.

thanks for your work on this very cool plugin. as well as the detailed description on it and differences with other search methods in ZC.

best.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

11 Jan 2023, 5:40 PM
#159
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Instant Search

Wow! For the exemplary post and the major effort. Many thanks in advance.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

12 Jan 2023, 11:40 PM
#160
dw08gm avatar

dw08gm

Totally Zenned

Join Date:
Sep 2008
Location:
DownUnder, overlooking South Pole.
Posts:
1,018
Plugin Contributions:
2

Re: Instant Search

Dear Marcopm

You're making us all feel very excited about being here!

I am just wondering whether a somewhat detailed explanation/instruction upon how best to setup or structure the wording of the product description field would be highly beneficial to all and sundry.

Best Regards