Page 1 of 1

Simple Product refresh...

Posted: Mon May 04, 2015 9:46 am
by kiteflo
Hi!

This seems to be a pretty simple question but actually I could not find any answer here :(

We are just experiencing the world of broadleaf commerce and have setup a little demo shop - we simply add certain products to categories and wanna display these items for demo reasons immediately. I know this is related to the solr cache stuff but actually I did not manage to apply a configuration which meets our needs.

Which file do I need to change and what do I need to change in order to have products displayed after a couple of seconds instead of re-starting tomcat each time?

Thanx in advance,
Florian

Re: Simple Product refresh...

Posted: Mon May 04, 2015 3:44 pm
by phillipuniverse
In the site applicationContext.xml (site/src/main/webapp/WEB-INF/applicationContext.xml) there is a Quartz job hooked up that will rebuild the Solr index on a set interval. This interval is initially set up to be 1 hour (3600000ms). You can change this interval in the solr.index.repeat.interval runtime property (currently set in common.properties in site/src/main/resources/runtime-properties) that the Quartz job in that applicationContext.xml file is paramaterized as. If you wanted it to occur every minute you cn change solr.index.repeat.interval

Alternatively, you can set up a Spring controller that does this for you when you hit a URL:

Code: Select all

@Resource("/solr/rebuild")
public class RebuildSolrController {

    @Resource
    protected SolrIndexService solrIndexService;

    @RequestMapping
    @ResponseBody
    public String rebuildIndex(HttpServletRequest request, HttpServletResponse response) {
        solrIndexService.rebuildIndex();
        return "Solr index successfully rebuilt";
    }
}


Then you can just hit localhost:8080/solr/rebuild in your browser and that will rebuild the index for you on-demand.

Re: Simple Product refresh...

Posted: Fri May 08, 2015 4:58 am
by kiteflo
thx Phillip, made my day!