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?
Asked
Active
Viewed 1,278 times
0
-
1You can check `DefaultSolrProductSearchService` some methods to perform searches in Solr are available there – Benkerroum Mohamed Mar 16 '21 at 13:33
-
But how can I build a query to get all products with catalog version? – Nexussim Lements Mar 16 '21 at 20:36
-
you can index only active catalog products in Solr, if this is okay with your set up. After all, only the active catalog gets displayed on the channels. – Vikrant Mar 17 '21 at 19:05
1 Answers
1
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")

Vikrant
- 1,809
- 1
- 13
- 18