Working example for geo polygon search with the Java API?

Hi,
I'm working on a geo spatial polygon based search and I'm trying to use the
Java API; is there any example/test that I could use as a starting point,
already doing this?
Thanks.

On Mar 9, 3:04 pm, Eugen Paraschiv hanrisel...@gmail.com wrote:

I'm working on a geo spatial polygon based search and I'm trying to use the
Java API; is there any example/test that I could use as a starting point,
already doing this?

I haven't used the polygon search feature, but assume you'd use it
like so:

FilterBuilder filter = FilterBuilders.geoPolygonFilter(filterName)
.addPoint(lat1, lon1).addPoint(lat2, lon2).addPoint(lat3, lon3);
QueryBuilder query = QueryBuilders.constantScoreQuery(filter);
SearchSourceBuilder source = new SearchSourceBuilder().query(query);
SearchRequest request =
Requests.searchRequest(indexName).source(source);
...

On Tue, Mar 13, 2012 at 12:12, Eugen Paraschiv hanriseldon@gmail.com
wrote:

Am I perhaps missing something or doing something wrong. Is there an
integration test that verifies the polygon search functionality?

I just tested this by replacing a geoBoundingBoxFilter with a
geoPolygonFilter (with 4 points), and it appears to work.

Can you post a complete test case? Do other queries (e.g. bounding box
or exact match) return results? May need to flush the index or wait a
short while...

OK, I'll start with that test and work my way towards polygon.
Thanks.
Eugen.

On Tue, Mar 13, 2012 at 10:50 PM, Eric Jain eric.jain@gmail.com wrote:

On Tue, Mar 13, 2012 at 12:12, Eugen Paraschiv hanriseldon@gmail.com
wrote:

Am I perhaps missing something or doing something wrong. Is there an
integration test that verifies the polygon search functionality?

I just tested this by replacing a geoBoundingBoxFilter with a
geoPolygonFilter (with 4 points), and it appears to work.

Can you post a complete test case? Do other queries (e.g. bounding box
or exact match) return results? May need to flush the index or wait a
short while...