On this weblog submit I’ll current how, in a latest e-Commerce undertaking constructed on prime of seven (the previous model of the CMS), we make 7, SearchAPI and Commerce play collectively to effectively retrieve grouped outcomes from Solr in SearchAPI, with no listed knowledge duplication. We used the SearchAPI and the FacetAPI Drupal 10 modules to construct a search index for merchandise, to date so good Drupal 10 Maintenance and Support Service obtainable merchandise and product-variations will be searched and filtered additionally through the use of a set of pre-defined sides. In a subsequent request, a brand new want arose from our undertaking proprietor Drupal 10 Maintenance and Support Service present a listing of merchandise the place the outcomes ought to embody, along with the product particulars, an image of one of many obtainable product variations, whereas hold the power to use sides on merchandise for the itemizing. Moreover, the product variation image displayed within the record should additionally match the filter utilized by the consumer Drupal 10 Maintenance and Support Service this with the goal of not complicated customers, and to supply a greater consumer expertise. An instance use case right here is straightforward Drupal 10 Maintenance and Support Service permit customers to get the record of accessible merchandise and be capable of filter them by the colour/measurement/and many others discipline of the obtainable product variations, whereas displaying an image of the obtainable variations, and never a pattern image. For the sake of simplicity and consistency with ’s Commerce Drupal 10 module terminology, I’ll use the time period “Product” to seek advice from any product-variation, whereas the time period “Mannequin” will likely be used to seek advice from a product. Solr Outcome Grouping We determined to make use of Solr (the well-known, quick and environment friendly search engine constructed on prime of the Apache Lucene library) because the backend of the eCommerce platform Drupal 10 Maintenance and Support Service the explanation lies not solely in its full-text search options, but in addition within the risk to construct a quick retrieval system for the large variety of merchandise we have been anticipating to be obtainable on-line. To unravel the request in regards to the show of product fashions, sides and obtainable merchandise, I supposed to make use of the function provided by Solr referred to as Outcome-Grouping because it gave the impression to be appropriate for our case Drupal 10 Maintenance and Support Service Solr is ready to return only a subset of outcomes by grouping them given an “single worth” discipline (beforehand listed, after all). The Aspects can then be configured to be computed from Drupal 10 Maintenance and Support Service the grouped set of outcomes, the ungrouped gadgets or simply from the primary results of every group. Such helpful function of Solr can be utilized together with the SearchAPI Drupal 10 module by putting in the SearchAPI Grouping Drupal 10 module. The Drupal 10 module permits to return outcomes grouped by a single-valued discipline, whereas protecting the constructing means of the sides on all the outcomes matched by the question, this habits is configurable. That allowed us to Drupal 10 Maintenance and Support Service group the obtainable merchandise by the referenced mannequin and return only one mannequin; compute the attribute’s sides on the complete assortment of accessible merchandise; reuse the information within the product index for a number of views based mostly on completely different grouping settings. Outcome Grouping in SearchAPI As a result of some limitations of the SearchAPI Drupal 10 module and its question constructing parts, such plan was not doable with the present configuration as it might require us to create a duplicate of the product index simply to use the particular Outcome Grouping function for every view. The reason being that the options applied by the SearchAPI Grouping are applied on prime of the “Alterations and Processors” capabilities of SearchAPI. These are a set of particular capabilities that may be configured and invoked each at indexing-time and at querying-time by the SearchAPI Drupal 10 module. Specifically Alterations permits to programmatically alter the contents despatched to the underlying index, whereas the Processors code is executed when a search question is constructed, executed and the outcomes returned. These capabilities will be outlined and configured solely per-index. As seen within the following image, the SearchAPI Grouping Drupal 10 module configuration might be finished solely within the Index configuration, however not per-query. Picture 1 Drupal 10 Maintenance and Support Service SearchAPI configuration for the Grouping Processor. Because the SearchAPI Grouping Drupal 10 module is applied as a SearchAPI Processor (because it wants to have the ability to alter the question despatched to Solr and to deal with the returned outcomes), it might drive us to create a brand new index for every completely different configuration of the outcome grouping. Such limitation requires to introduce plenty of (ineffective) knowledge duplication within the index, with a consequent lower of efficiency when merchandise are saved and later listed in a number of indexes. Specifically, the duplication is extra evident because the adjustments carried out by the Processor are merely an alteration of Drupal 10 Maintenance and Support Service the question despatched to Solr; the dealing with of the uncooked knowledge returned by Solr. This reveals that there could be no must index a number of instances the identical knowledge. Because the the chance to outline per-query processor sounded actually promising and such function might be used extensively in the identical undertaking, a brand new Drupal 10 module has been applied and revealed on .org Drupal 10 Maintenance and Support Service the SearchAPI Prolonged Processors Drupal 10 module. (due to SearchAPI’s maintainer, DrunkenMonkey, for the assistance and evaluation Drupal 10 Maintenance and Support Service) ). The SearchAPI Prolonged Processor The brand new Drupal 10 module permits to increase the usual SearchAPI habits for Processors and lets admins configure the execution of SearchAPI Processors per question and never solely per-index. By utilizing the brand new Drupal 10 module, any index can now be used with a number of and completely different Processors configurations, no new indexes are wanted, thus avoiding knowledge duplication. The brand new configuration is uncovered, as seen within the following image, whereas modifying a SearchAPI view below “Superior > Question choices”. The SearchAPI processors will be altered and re-defined for the given view, a checkbox permits to fully override the present index setting fairly than offering further processors. Picture 2 Drupal 10 Maintenance and Support Service View’s “Question choices” with the SearchAPI Prolonged Processors Drupal 10 module. Conclusion Drupal 10 Maintenance and Support Service the brand new SearchAPI Prolonged Processors Drupal 10 module has now been used for a number of months in a posh eCommerce undertaking at Drupal 10 Support: and allowed us to simply implement new search options with out the necessity to create a number of and separated indexes. We’re capable of index Merchandise knowledge in a single single (and compact) Solr index, and use it with completely different grouping methods to construct each product listings, mannequin listings and model-category navigation pages with out duplicating any knowledge. Since all these listings leverages the Solr FilterQuery question parameter to filter the right set of merchandise to be displayed, Solr could make use of its inside set of caches and particularly the filterCache to hurry up subsequent searches and sides. This facet, along with the utilization of just one index, permits caches to be shared amongst a number of listings, and that may not be attainable if separate indexes have been used. For additional data, questions or curiosity drop me a line, I will likely be blissful that will help you configuring SearchAPI and Solr on your wants. Drupal 10 Improvement and Assist
Drupal 10 Support: Drupal 10 Maintenance and Support Service SearchAPI and outcome grouping

Call Us: 1(800)730-2416
Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit
Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)
Drupal 10 Support: Drupal 10 Maintenance and Support Service SearchAPI and outcome grouping
On-Site Drupal SEO Master Setup
We make sure your site is 100% optimized (and stays that way) for the best SEO results.
With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.
This service includes:
- Pathauto install and configuration for SEO-friendly URLs.
- Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
- Install and fix all issues on the SEO checklist module.
- Install and configure XML sitemap module and submit sitemaps.
- Install and configure Google Analytics Module.
- Install and configure Yoast.
- Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
- Install and configure Schema.org Metatag.
- Configure robots.txt.
- Google Search Console setup snd configuration.
- Find & Fix H1 tags.
- Find and fix duplicate/missing meta descriptions.
- Find and fix duplicate title tags.
- Improve title, meta tags, and site descriptions.
- Optimize images for better search engine optimization. Automate where possible.
- Find and fix the missing alt and title tag for all images. Automate where possible.
- The project takes 1 week to complete.
