facet and field collapse

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

facet and field collapse

Xuesong Luo
Hi, there,

Our index stores employee working history information. For each
employee, there could be multiple index records. The requirement is:

1. The search result should be sorted on score.
2. Each employee should only appear once regardless how many match
are found.
3. The result should support pagination.


For example, if the original search result is:


doc=1, id=A, score=100
doc=2, id=A, score=90
doc=3, id=B, score=80
doc=4, id=A, score=70
doc=5, id=B, score=69
doc=6, id=B, score=68
doc=7, id=C, score=60
doc=8, id=C, score=59
doc=9, id=D, score=59
doc=10, id=E, score=58
doc=206, id=B, score=40
We want the final result to be:
Doc=1, id=A
Doc=3, id=B
Doc=7, id=C
Doc=9, id=D
Doc=10, id=E
If the user wants to see record 2-4, he/she should get
Doc=3, id=B
Doc=7, id=C
Doc=9, id=D
I tried both facet and field collapse, it seems neither satisfies our
The problem of facet is it can only sort either on the number of counts
or the alphabetical order. If sort on counts, B will be returned before
The problem of using Field collapse is its pagination is based on doc,
not on group. In my pagination example, Doc 2-4 will be returned instead
of 3, 7, 9.
Does anyone have similar experience before? Any suggestions?