@@ -378,7 +378,7 @@ func (qs *queryState) handleValuePostings(ctx context.Context, args funcArgs) er
378378 listType := schema .State ().IsList (q .Attr )
379379 hasLang := schema .State ().HasLang (q .Attr )
380380 getMultiplePosting := q .DoCount || q .ExpandAll || listType || hasLang
381- //pickMultiplePostings := true
381+ //getMultiplePosting := true
382382
383383 calculate := func (start , end int ) error {
384384 x .AssertTrue (start % width == 0 )
@@ -400,28 +400,27 @@ func (qs *queryState) handleValuePostings(ctx context.Context, args funcArgs) er
400400
401401 if ! getMultiplePosting {
402402 pl , _ := qs .cache .GetSinglePosting (key )
403- if pl == nil {
403+ if pl != nil {
404+ vals = make ([]types.Val , len (pl .Postings ))
405+ for i , p := range pl .Postings {
406+ vals [i ] = types.Val {
407+ Tid : types .TypeID (p .ValType ),
408+ Value : p .Value ,
409+ }
410+
411+ // TODO Apply facet tree before
412+ if q .FacetParam != nil {
413+ fcs .FacetsList = append (fcs .FacetsList , & pb.Facets {Facets : facets .CopyFacets (p .Facets , q .FacetParam )})
414+ }
415+ }
416+ }
417+ if pl == nil || len (vals ) == 0 {
404418 out .UidMatrix = append (out .UidMatrix , & pb.List {})
405419 out .FacetMatrix = append (out .FacetMatrix , & pb.FacetsList {})
406420 out .ValueMatrix = append (out .ValueMatrix ,
407421 & pb.ValueList {Values : []* pb.TaskValue {}})
408- if q .ExpandAll {
409- // To keep the cardinality same as that of ValueMatrix.
410- out .LangMatrix = append (out .LangMatrix , & pb.LangList {})
411- }
412422 continue
413423 }
414- vals = make ([]types.Val , len (pl .Postings ))
415- for i , p := range pl .Postings {
416- vals [i ] = types.Val {
417- Tid : types .TypeID (p .ValType ),
418- Value : p .Value ,
419- }
420-
421- if q .FacetParam != nil {
422- fcs .FacetsList = append (fcs .FacetsList , & pb.Facets {Facets : facets .CopyFacets (p .Facets , q .FacetParam )})
423- }
424- }
425424 } else {
426425 pl , err := qs .cache .Get (key )
427426 if err != nil {
0 commit comments