Reputation: 1671
I have a Solr schema with a kind of versioning. IDs contain version number, so existing docs remain as new are indexed. Sample contents:
id = foo1
name = foo
version = 1
data = x
id = foo2
name = foo
version = 2
data = y
id = bar1
name = bar
version = 1
data = x
There are two distinct search scenarios: Search all versions or search only the latest. The first is trivial, but how do I implement a search in the data
field for only the latest versions of each name
? In the sample above I wish to search for "x" in latest, and expect to hit only "bar1".
I was hoping for a solution using http://wiki.apache.org/solr/FieldCollapsing, but if I search for "x" with group.field=name
Solr will group after search, giving me version 1 of the two names above. I would need it to work more like a filter query.
Upvotes: 2
Views: 214
Reputation: 52779
Dont think field collapsing would serve you the purpose.
I can think of couple of the options -
Upvotes: 2