Searching within a subset of data - Solr

有些话、适合烂在心里 提交于 2019-12-24 03:18:14

问题


I am new to Solr (Lucene) world. What I am trying to figure out is how would I search within a subset of data? Let me elaborate:

  1. I have 10 employees in my Employee table in the database.
  2. Each employee has n number of customers that are stored in the Customers table in the same database.
  3. When an employee is searching, I want to search only within that employee's customers.

This is not exactly faceted search but I am pretty sure there is a way to do it in Solr looking at all the bells and whistles it has. One way I can think of is to create a separate index for each employee's customer, but that seems quite inefficient.

I will be using this through Solr.NET, but I don't think that should matter much in terms of how this would be implemented but throwing it out there just in case.


回答1:


You woud use FilterQuery - fq parameter. With this approach you can easily filter customers for selected employee.

Example:

...&fq=employeeId:12

In Solr.NET:

new SolrQueryByField("employeeId", 12)


来源:https://stackoverflow.com/questions/9183898/searching-within-a-subset-of-data-solr

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!