简体   繁体   English

SOLR / C# - 是否可以查询一个SOLR索引,并附加另一个索引的文档?

[英]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: 假设我有产品数据的索引1:

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? 我将如何进行索引索引,在哪里(如果客户已登录),还有一个字段从索引2中检索匹配值(customerid,productid)?

And is there a need for index two, or is there a more efficient way to store/retrieve customer specific prices? 是否需要索引2,或者是否有更有效的方式来存储/检索客户特定的价格?

Thanks in advance 提前致谢

Update 更新

There is approximately 7.000 customers and 2 million prices, if you need a "scope" on performance. 如果您需要“范围”表现,那么大约有7000个客户和200万个价格。

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). 1)解决方案1 ​​/ SOLR索引Solr不是数据库,它是一个搜索引擎,但如果你的价格非常不稳定(变化很大......等等)。 Better to go for a Database implementation. 最好去实现数据库。

There is approximately 7.000 customers and 2 million prices, if you need a "scope" on performance. 如果您需要“范围”表现,那么大约有7000个客户和200万个价格。 Solr is done to manage a lot of references. Solr完成了很多参考。 Don't be afraid of that, you need to build good indexes, the rest is managed by solr. 不要害怕,你需要建立良好的索引,其余的由solr管理。

Even though, if your want to use solr, perform one index this this fields: 即使如果你想使用solr,执行一个索引,这个字段:

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

2) I will suggest you to use Redis DB, your use case is not really a search engine. 2)我建议你使用Redis DB,你的用例不是真正的搜索引擎。 In redis you will store like this 在redis中你会像这样存储

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

Redis is blazing fast, is scallable and is loaded in memory! Redis速度极快,可以扩展并加载到内存中!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM