Page 1 of 1

Alternative to Using SolarSearchService on Homepage ?

Posted: Mon May 11, 2015 3:02 pm
by sumit784
Hi,

I am currently customizing the Home page for showing products from :-

- Various different categories ( 10 each)
- From a Deals/ offers table

I am going to show a bunch of products from various categories and deals, offers, to the user on Homepage itself.
Currently the homepage fetches the product from "solarSearchService" using the default categorey of /home.

Can I use the inbuilt
" @PersistenceContext(unitName = "blPU")
protected EntityManager em;
final Query query = em.createQuery( Select.....) "

To run my own custom queries to fetch products and show them on Homepage.

My queries :-

- Why is Solar Search service is used to fetch products on homepage, Any specific reason ?
- What difference will it make, If I use the Entitymanager ?
- Will there be a performance hit on application, if I dont use Solar Search Service.
- Is there any other alternate flow, code that is inbuilt for custom querying ?

Kindly provide answer in details.

Re: Alternative to Using SolarSearchService on Homepage ?

Posted: Thu May 14, 2015 9:45 am
by dlavoie
Hello Sumit,

I ain't a Broadleaf expert right now but I suppose that I get the philosophy behind it.

By reading your question I understand that you have not realized why Solr is used in Broadleaf.

Solr is used as a search engine for your platform. It will deliver a performance that you'll never reach by calling directly the entity manager. Broadleaf has been designed to handle millions of product references in your database. Solr helps Broadleaf to deliver fast search through its index engine. Calling complex search queries for your homepage by hitting the EntityManager would result in real poor performance and bad user experience. Leave the poor database alone with its transaction management and data consistency.

You've got a Ferrari to search for your products, why not using it ?

Regards,
Daniel

Re: Alternative to Using SolarSearchService on Homepage ?

Posted: Fri May 15, 2015 8:51 pm
by sumit784
Hi,

Thanks for responding in details. Well, I would love to ride Ferrari.

So, tallking technically, If duing the "HomePage " loading itself. How can I fetch products 15-20 product from 10 different categories or may be fetch some product bundles and display on HomePage.

How Do I do it ? What files do I need to change or Do I need to write my own customer controller etc for it.

Any code snipped will really be helpful ?

Thanks