solrsap-commerce-cloudsolrjsolrcloudhybris-data-hub

Hybris SOLR get all products query


I have the following requirement: when you make a search and there are NO results, display all the products within the active catalog version. How can I make a query to fetch all the products from SOLR in Java? Is there any OOTB service that already fetch all products in a Catalog?


Solution

  • You can use the below query as well to fetch the active catalog version products via Solr.

    https://<your_domain>:<port>/solr/<solr_core>/select?indent=on&q=*:*&fq=(catalogId:"<active_catalog_id>"+AND+catalogVersion:"<active_catalog_version>")
    

    E.g.:

    https://localhost:8983/solr/master_electronics_Product_flip/select?indent=on&q=*:*&fq=(catalogId:"electronicsProductCatalog"+AND+catalogVersion:"Online")