1

I've just set out on the path to discovery of Factual API and I cannot see how to achieve a retrieval of a selection of entries each with a unique value in the specified field.

For example, give me 10 results from various cities:

q.limit(10);
q.field("locality").unique();  // no such filter exists
factual.fetch("places", q);

This would be an equivalent query in MySQL:

SELECT * FROM places GROUP BY locality LIMIT 10;

What I want is a little bit similar to facets:

FacetQuery fq = new FacetQuery("locality").maxValuesPerFacet(10);
fq.field("country").isEqual("gb");
FacetResponse resp = factual.fetch("places", fq);

but instead of the total for each result I would like to see a random object with all the information.

Is anything like this possible?

Johnny Baloney
  • 2,931
  • 1
  • 27
  • 34

0 Answers0