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

标签 c# .net solr e-commerce

假设我有一个包含产品数据的索引:

productid
productprice
productcategory
productname

用客户价格索引二:

customerid
customerprice
productid

我将如何进行查询以索引 1,其中(如果客户已登录),有一个字段从索引 2 检索匹配值(customerid、productid)?

是否需要索引二,或者是否有更有效的方法来存储/检索客户特定价格?

提前致谢

更新

如果您需要性能“范围”,大约有 7.000 个客户和 200 万个价格。

最佳答案

首先做一些简单的/有效的事情。

1) 解决方案 1/SOLR 索引 Solr 不是数据库,它是搜索引擎,但如果您的价格非常不稳定(变化很大......等等)。最好选择数据库实现。

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.

尽管如此,如果您想使用 solr,请对这个字段执行一个索引:

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

2) 我会建议你使用 Redis DB,你的用例并不是真正的搜索引擎。在redis中你会这样存储

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

Redis 速度极快,可调用并加载到内存中!

关于c# - SOLR/C# - 是否可以查询一个 SOLR 索引,并从另一个索引附加文档?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44388241/

相关文章:

c# - Windows Azure : Server Error , 404 - 找不到文件或目录

.net - 将 .NET 代码编译为一个 EXE,将其他命名空间编译为 DLL

c# - .NET 中的正则表达式是如何实现的?

c# - 如何统一检查同时输入的 WASD 和箭头键?

c# - 您能否使用 linq 查看两个 IEnumerables 数据是否包含任何公共(public)条目?

.net - 为什么值类型创建在栈上而引用类型创建在堆上?

c# - 从 MS CRM 插件中删除 SDK 消息处理步骤

performance - 一台机器上的多个 Solr 分片会提高性能吗?

java - 如何在 Windows Bitnami 堆栈上为 Solr 4.5 设置 JVM 堆大小?

java - 预期的 mime 类型 application/xml 但得到了 text/html