SolrNet 新手 - 如何处理多个Where子句
我刚刚开始探索 SolrNet。以前我一直使用MSSQL FULL TEXT。
在 sql server 中,我的查询进行全文搜索,并且还具有多个联接和Where 子句。我还使用自定义分页仅返回数百万行中的 10 行。
我读过一些 solrNet 文档并运行博客上提供的示例应用程序。到目前为止一切进展顺利。只需要了解一下,我该如何处理 JOINS 和 WHERE 子句?
例如,如果用户搜索 Samsung,db 将返回 100k 条记录,但如果用户搜索 Samsung &&城市='纽约' &&价格>‘500’那么他只能得到几千张记录。
- 我是否在 Solr 中添加所有列并在 Solr 中编写 WHERE 子句?
- 对于 SQL JOINS 我该怎么办?
提前致谢!
I just started exploring SolrNet. Previously I have been using MSSQL FULL TEXT.
In sql server, my query make full text searches and also have multiple joins and Where clauses. I am also using custom paging to return only the 10 rows out of millions.
I have read few solrNet docs and run sample apps provided on the blogs. All worked well so far. Just need to get an idea, What do I do with JOINS and WHERE clauses??
e.g. If user searches for Samsung, db would return 100k records, but if users searches for Samsung && City='New york' && Price >'500' then he would only get couple of thousands records.
- Do I add all columns in Solr and write WHERE clauses in Solr?
- What do I do about SQL JOINS?
Thanks in Advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Solr 中没有连接。来自 Solr wiki:
关于 WHERE 子句(即过滤),请参阅SolrNet 中的查询、Solr 查询语法 和 常用Solr查询参数。
There are no joins in Solr. From the Solr wiki:
About WHERE clauses (i.e. filtering), see Querying in SolrNet, Solr query syntax, and Common Solr query parameters.
Solr 相当于 where 子句,即将列映射到字段并根据查询语法运行查询。像您的示例这样的查询:
可以在 Solr 中转换为类似的内容:
将数据库映射到 Solr 模式时需要小心,特别是您可能必须对数据进行非规范化。有关详细信息,请参阅 Solr wiki 上的此页面。基本上,您无法在 Solr 中真正执行复杂的 JOIN。这是一个“平坦”的指数。
The Solr equivalent of your where clauses is to map your columns to fields and run queries based on the query syntax. A query like your example:
could be translated to something like this in Solr:
You need to take some care when you map your database to a Solr schema, specifically you will probably have to denormalize your data. See this page on the Solr wiki for more information. Basically, you can't really do complex JOINs in Solr. It's a "flat" index.