3
我的索引索引有兩種類型的用戶(Type-A和Type-B),可以使用名爲「type」的字段來標識這兩種類型的用戶。 但是用戶有可能在兩種類型(A和B)下都有條目。搜索索引時避免重複索引
例如,
Jacob is a user who comes under both Types(A and B). So, he will have two documents in our Index like:
//document-1
name:...
type:A
age:...
//end of document-1
//document-2
name:...
Type:B
age:...
//end of document-2
我的目標是,
當用戶搜索,他僅僅是A型的,他應該是在 結果。
當用戶被搜索時,他只是Type-B,他應該在 結果中。
- 當一個用戶(如Jacob)被搜索到時,他既是A型又是B型, 只有Type-A文件應該在結果中。
我們如何通過查詢來實現這一目標?
在此先感謝!
感謝您提供有用的信息! – Mavellin