4

My Solr Index has two types of Users( Type-A and Type-B ), which can be identified with a field called as 'type'. But there is possibility for an user to have entries under both Types(A and B).

For example,

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

My objective is,

  • When a user is searched and he is only of Type-A, he should be in the result.

  • When a user is searched and he is only of Type-B, he should be in the result.

  • When a user(like Jacob) is searched and he is of both Type A and B, only document of Type-A should be in the result.

How could we achieve this through queries?
Thanks in advance!

Shruti
  • 1
  • 13
  • 55
  • 95
Mavellin
  • 665
  • 7
  • 17

1 Answers1

5

I assume you have some field that can identify uniquely a user? like name or iduser? if so just group by that fields using grouping. If you set group.main=true then the result will look no different than if you were not using grouping

Persimmonium
  • 15,593
  • 11
  • 47
  • 78