mp1990
mp1990

Reputation: 10259

SOLR/C# - Is it possible to query one SOLR index, and attach a document from another index?

Let's say i have index one with product data:

productid
productprice
productcategory
productname

And index two with customer prices:

customerid
customerprice
productid

How would i go about making a query to index one, where (if customer is logged in), theres a field retrieving the matching value (customerid, productid) from index two?

And is there a need for index two, or is there a more efficient way to store/retrieve customer specific prices?

Thanks in advance

Update

There is approximately 7.000 customers and 2 million prices, if you need a "scope" on performance.

Upvotes: 1

Views: 400

Answers (1)

jeorfevre
jeorfevre

Reputation: 2316

First of all do something simple / working.

1) Solution 1 / SOLR index Solr is not a DB, it's a search engine, but if your prices are very volatile (changes a lot...etc). Better to go for a Database implementation.

There is approximately 7.000 customers and 2 million prices, if you need a "scope" on performance. Solr is done to manage a lot of references. Don't be afraid of that, you need to build good indexes, the rest is managed by solr.

Even though, if your want to use solr, perform one index this this fields:

- productid 
- productprice 
- productcategory 
- productname 
- customerid
- customerprice

2) I will suggest you to use Redis DB, your use case is not really a search engine. In redis you will store like this

product:{productid} => {productprice, productcategory, productname}
product:{productid}:customer:{custumerid} => {customerprice}

Redis is blazing fast, is scallable and is loaded in memory!

Upvotes: 3

Related Questions