2

I am having a few problems understanding Lucene Spatial (partially due to a lack of documentation and good examples and partially due to stupidity I am sure!)

I am trying to run a query :-

DistanceQueryBuilder builder = new DistanceQueryBuilder(new Double(point[1]), new Double(point[0]), 1000d,
                    "geohash", CartesianTierPlotter.DEFALT_FIELD_PREFIX, true);


             ConstantScoreQuery queryx = new ConstantScoreQuery(builder.getFilter());               
                org.hibernate.Query fullTextQuery = fullTextSession.createFullTextQuery(queryx,Address.class);

I am certain that there are results within 1000 miles of the provided co-ords but I have no idea how to begin debugging it.

Using Luke to look at the index I have verified that at least 2 of the geohashes convert correctly to Lat and long that are within the given region.

There is also a field on the index for _tier_9 which is the level that the search is using.

I am sure that it is something simple I am missing, any help would be great.

I also did a test as per below to check that address objects are found by this method and that worked.

QueryBuilder qb = fullTextSession.getSearchFactory()

                .buildQueryBuilder().forEntity( Address.class ).get();
                org.apache.lucene.search.Query qbx = qb.all().createQuery();
                org.hibernate.Query fullTextQueryASD = fullTextSession.createFullTextQuery(qbx,Address.class);

                List resultASD = fullTextQueryASD.list(); //return a list of managed objects  

Cheers Rob

Rob
  • 703
  • 1
  • 7
  • 18

1 Answers1

0

Try using a smaller distance value than 1000, like 2.

gregm
  • 12,019
  • 7
  • 56
  • 78