@@ -376,9 +376,14 @@ func (qs *queryState) handleValuePostings(ctx context.Context, args funcArgs) er
376
376
377
377
outputs := make ([]* pb.Result , numGo )
378
378
listType := schema .State ().IsList (q .Attr )
379
+
380
+ // These are certain special cases where we can get away with reading only the latest value
381
+ // Lang doesn't work because we would be storing various different languages at various
382
+ // time. So when we go to read the latest value, we might get a different language.
383
+ // Similarly with DoCount and ExpandAll and Facets. List types are also not supported
384
+ // because list is stored by time, and we combine all the list items at various timestamps.
379
385
hasLang := schema .State ().HasLang (q .Attr )
380
- getMultiplePosting := q .DoCount || q .ExpandAll || listType || hasLang
381
- //getMultiplePosting := true
386
+ getMultiplePosting := q .DoCount || q .ExpandAll || listType || hasLang || q .FacetParam != nil
382
387
383
388
calculate := func (start , end int ) error {
384
389
x .AssertTrue (start % width == 0 )
@@ -399,7 +404,10 @@ func (qs *queryState) handleValuePostings(ctx context.Context, args funcArgs) er
399
404
fcs := & pb.FacetsList {FacetsList : make ([]* pb.Facets , 0 )} // TODO Figure out how it is stored
400
405
401
406
if ! getMultiplePosting {
402
- pl , _ := qs .cache .GetSinglePosting (key )
407
+ pl , err := qs .cache .GetSinglePosting (key )
408
+ if err != nil {
409
+ return err
410
+ }
403
411
if pl == nil || len (pl .Postings ) == 0 {
404
412
out .UidMatrix = append (out .UidMatrix , & pb.List {})
405
413
out .FacetMatrix = append (out .FacetMatrix , & pb.FacetsList {})
@@ -413,11 +421,6 @@ func (qs *queryState) handleValuePostings(ctx context.Context, args funcArgs) er
413
421
Tid : types .TypeID (p .ValType ),
414
422
Value : p .Value ,
415
423
}
416
-
417
- // TODO Apply facet tree before
418
- if q .FacetParam != nil {
419
- fcs .FacetsList = append (fcs .FacetsList , & pb.Facets {Facets : facets .CopyFacets (p .Facets , q .FacetParam )})
420
- }
421
424
}
422
425
} else {
423
426
pl , err := qs .cache .Get (key )
0 commit comments