Create an HTTP call backed by the database to fetch the list of valid vendors. 
Mark that response cacheable until the next refresh. Use an HTTP cache in case 
the database is temporarily unavailable.

You don't really need a custom filter, you can list all the valid vendors in 
the filter query. The matches will be in the filter cache, so it will be fast 
after the first request, even though the query is long.

wunder

On Nov 16, 2012, at 4:32 PM, Hayden Muhl wrote:

> I am working on migrating our system from Lucene to Solr, and my boss and I
> are at an impasse over an architectural issue. Here's the basic setup.
> 
> We index products from multiple retailers, and allow people to search
> across all retailers for specific products. It is a regular occurrence for
> us to disable or deactivate a retailer (on the order of once a day). What
> that means is that when someone does a search, we will not show results for
> products sold by deactivated retailers. The list of active/inactive
> retailers is maintained in a table in our SQL database. We have to maintain
> this functionality when we move to Solr, but we can't agree on how to
> implement this in Solr.
> 
> Currently, we load a new Lucene product index once every two hours. Every
> time we load a new index, we run a SQL query to find the current list of
> active retailers, and construct a filter based on that list.
> 
> My boss wants to essentially do the same thing we do now. Implement a
> custom filter that makes a call to the database to retrieve the list of
> retailers, caches that list for some period of time, then refreshes itself
> from time to time with another call to the database. I find it strange
> having a dependency between Solr and the database like that, because it
> would require a running database being present in order to even start Solr.
> I am new to Solr, so I don't have any alternative solutions.
> 
> tl;dr, We need to construct a Solr filter based on data stored in a
> database. What's the best way to get that data from the database into Solr
> and keep it updated?
> 
> - Hayden

--
Walter Underwood
wun...@wunderwood.org



Reply via email to