Thread: Instant Search

Page 16 of 23 FirstFirst ... 61415161718 ... LastLast
Results 151 to 160 of 221
  1. #151
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,106
    Plugin Contributions
    11

    Default Re: Instant Search

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

  2. #152
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,669
    Plugin Contributions
    11

    Default Re: Instant Search

    Quote Originally Posted by dw08gm View Post
    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-Bootstra...ch.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/b....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_...ch.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.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  3. #153
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,622
    Plugin Contributions
    123

    Default 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 Modifications
    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.

  4. #154
    Join Date
    Apr 2019
    Posts
    242
    Plugin Contributions
    0

    Default Re: Instant Search

    Quote Originally Posted by marcopm View Post
    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.

  5. #155
    Join Date
    Sep 2008
    Location
    DownUnder, overlooking South Pole.
    Posts
    976
    Plugin Contributions
    6

    Default Re: Instant Search

    Quote Originally Posted by carlwhat View Post
    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

  6. #156
    Join Date
    Sep 2008
    Location
    DownUnder, overlooking South Pole.
    Posts
    976
    Plugin Contributions
    6

    Default Re: Instant Search

    Quote Originally Posted by dbltoe View Post
    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
    Last edited by dw08gm; 1 Nov 2022 at 08:07 AM. Reason: typo

  7. #157
    Join Date
    Jun 2021
    Posts
    41
    Plugin Contributions
    2

    Default 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.
    Last edited by marcopm; 11 Jan 2023 at 05:21 PM.

  8. #158
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,669
    Plugin Contributions
    11

    Default Re: Instant Search

    big

    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.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  9. #159
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,571
    Plugin Contributions
    30

    Default Re: Instant Search

    Wow! For the exemplary post and the major effort. Many thanks in advance.
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  10. #160
    Join Date
    Sep 2008
    Location
    DownUnder, overlooking South Pole.
    Posts
    976
    Plugin Contributions
    6

    Default 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

 

 
Page 16 of 23 FirstFirst ... 61415161718 ... LastLast

Similar Threads

  1. Instant Quote
    By Congerman in forum General Questions
    Replies: 2
    Last Post: 15 Aug 2012, 12:29 PM
  2. Instant Coupon
    By Mickmo68 in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 4
    Last Post: 22 Dec 2008, 08:19 PM
  3. Instant Delivery?
    By eaglewu in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 30 Jul 2007, 09:30 AM
  4. changes instant
    By chufty bill in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 5 Sep 2006, 07:12 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR