I know how to query IndexTank with a query string, with or without geolocation. But how do you query with no query string and only geolocation?
index.addFunction(5, "-miles(d[0], d[1], q[0], q[1])");
results = index.search(Query.forString(queryString)
.withScoringFunction(5)
.withQueryVariable(0, latitude)
.withQueryVariable(1, longitude));
If the queryString is null or an empty string it doesn't work.
Thanks.
If you want to fetch all documents that are within a certain distance from a point, you need to issue a query that matches all documents and use a function filter on the scoring function that calculates the distance.
For example, if all your documents have a "match" field with the value "all", you can search for:
This would get all documents within 10 miles of (lat,long).