0
votes

I am using solr trunk to search some documents and group them by their category, but I have to group them first by another field. More specifically I am using this schema:

  • component_id: string
  • category: string
  • name: text

And I have two documents:

  1. component_id = register1, category = category1, name='foo bar'
  2. component_id = register1, category = category2, name='foo bar zoo'

My query is (only relevant parameters):

{edismax qf=name}(foo bar)&group.field=component_id&group.truncate=true&facet.field=category&bq=category:category1^2

And the facet results are:

'category': 
'category1', 1 
'category2',1

BUT, when I change the bq parameter, for example : bq=category:category1^20

The facet results have changed:

'category':
'category1', 1   
'category2', 0

Is that posible ? Is a bug ? If I set group.truncate=false everything is fine for this example, but it fails for the rest of the querys.

Thanks & regards

1

1 Answers

0
votes

I answer myself.

group.truncate is the correct option when your data is uniform or when your groups contains similar objects, but it has problems when mixing data from diferent categories.

if group.truncate=true |A| ∪ |B| <> |A| + |B| - A ∩ B

Everything is OK with bq parameter.