Results 1 to 1 of 1
  1. #1
    3xca1ibur is offline Member
    Join Date
    Feb 2011
    Rep Power

    Default Lucene Spatial DistanceQueryBuilder


    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(); qbx = qb.all().createQuery();
    org.hibernate.Query fullTextQueryASD = fullTextSession.createFullTextQuery(qbx, ass);

    List resultASD = fullTextQueryASD.list(); //return a list of managed objects
    Cheers Rob
    Last edited by 3xca1ibur; 02-16-2011 at 03:31 PM. Reason: mis-post

Similar Threads

  1. Lucene StringTokenizer
    By JP10 in forum Lucene
    Replies: 0
    Last Post: 10-16-2010, 06:24 AM
  2. Apache Lucene
    By dkarthiin in forum Lucene
    Replies: 0
    Last Post: 03-25-2010, 01:25 PM
  3. Lucene with unicode
    By goms in forum Lucene
    Replies: 1
    Last Post: 02-02-2010, 02:20 PM
  4. how to get lucene logs
    By virendra in forum Lucene
    Replies: 0
    Last Post: 01-06-2010, 11:46 AM
  5. Apache Lucene 2.2.0
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 06-22-2007, 01:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts