How can I merge multiple Compass Resources into one, with one score?

Posted by Brent Fisher on Stack Overflow See other posts from Stack Overflow or by Brent Fisher
Published on 2010-06-10T20:58:26Z Indexed on 2010/06/10 21:02 UTC
Read the original article Hit count: 322

Filed under:
|
|

I am trying to integrate compass into my platform using the JDBC ResultSetToResourceMapping. What I want to do is set it up so that I could have multiple result set mappings, tied to one Resource, that produces one result, with one score, and a merged score. I have tried to trick Compass into doing this by mapping the same id across them, even though the property fields are different, but it just ends up giving me separate hits for each.

E.g. I have the following Data Model, Cases and Comments. One case might have several comments. Say I search for a term that appears in multiple comments. Right now, I a hit for each one, each with a different score.

Is there a way that I could merge or aggregate those hits into one hit? Say, instead of

Score      Entity ID  Snippets
100.0%     Case 3558  ... The fox jumped over the lazy dog ...
60.0%      Case 3558  ... In Alabama today, three jumping turtles were ...
25.0%      Case 3558  ... Three jumpers fled the scene...

I get

Score      Entity ID  Snippets
100.0%     Case 3558  The fox jumped over the lazy dog ...In Alabama today,
                      three jumping turtles were ... Three jumpers 
                      fled the scene...

Where the latter score is an aggregated score.

© Stack Overflow or respective owner

Related posts about lucene

Related posts about compass