4 seconds per facet, thus adding 3 more it takes us to 16 seconds.
btw, why is that, arango is doing full scan anyways. is it doing it 4 times 
with the query bellow? Is there any way to make it smarter?

 LET docs = (FOR a IN Asset 
 RETURN a)
LET attribute1 = (
 FOR a in docs 
  COLLECT attr = a.attribute1 WITH COUNT INTO length
 RETURN { value: attr, count: length}
)
LET attribute2 = (
 FOR a in docs 
  COLLECT attr = a.attribute2 WITH COUNT INTO length
 RETURN { value: attr, count: length}
)
LET attribute3 = (
 FOR a in docs 
  COLLECT attr = a.attribute3 WITH COUNT INTO length
 RETURN { value: attr, count: length}
)
LET attribute4 = (
 FOR a in docs 
  COLLECT attr = a.attribute4 WITH COUNT INTO length
 RETURN { value: attr, count: length}
)
RETURN {
  counts: (RETURN {
    total: LENGTH(docs), 
    offset: 2, 
    to: 4, 
    facets: {
      attribute1: {
        from: 0, 
        to: 5,
        total: LENGTH(attribute1)
      },
      attribute2: {
        from: 5, 
        to: 10,
        total: LENGTH(attribute2)
      },
      attribute3: {
        from: 0, 
        to: 1000,
        total: LENGTH(attribute3)
      },
      attribute4: {
        from: 0, 
        to: 1000,
        total: LENGTH(attribute4)
      }
    }
  }),
  items: (FOR a IN docs LIMIT 2, 4 RETURN {id: a._id, name: a.name}),
  facets: {
    attribute1: (FOR a in attribute1 SORT a.count LIMIT 0, 5 return a),
    attribute2: (FOR a in attribute2 SORT a.value LIMIT 5, 10 return a),
    attribute3: (FOR a in attribute3 LIMIT 0, 1000 return a),
    attribute4: (FOR a in attribute4 SORT a.count, a.value LIMIT 0, 1000 
return a)
   }
}


-- 
You received this message because you are subscribed to the Google Groups 
"ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to arangodb+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to