lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcelo Ochoa <marcelo.oc...@gmail.com>
Subject Re: SpatialQuery for location based search using Lucene
Date Sat, 27 Jun 2009 22:27:37 GMT
Hi:
  Did you know Local Lucene extension?
http://sourceforge.net/projects/locallucene/
  Some test are similar to your example:
http://locallucene.svn.sourceforge.net/viewvc/locallucene/trunk/locallucene/src/java/com/pjaol/search/test/UnitTests/
  Best regards, Marcelo.

On Sat, Jun 27, 2009 at 5:08 PM, mitu2009<musicfreaque@gmail.com> wrote:
>
> Hi,
>
> My lucene index has got latitude and longitudes fields indexed as follows:
>
>    doc.Add(new Field("latitude", latitude.ToString() , Field.Store.YES,
> Field.Index.UN_TOKENIZED));
>
>    doc.Add(new Field("longitude", longitude.ToString(), Field.Store.YES,
> Field.Index.UN_TOKENIZED));
>
> I want to retrieve a set of documents from this index whose lat and long
> values are in a given range.
>
> As you already know, Lat and long could be negative values.
> Given this,would the approach mentioned below give correct results or is
> there any other way to do this?
>
>
>
>     Term lowerLatitude = new Term("latitude", bounds.South.ToString() );
>                    Term upperLatitude = new Term("latitude",
> bounds.North.ToString());
>                    RangeQuery latitudeRangeQuery = new
> RangeQuery(lowerLatitude, upperLatitude, true);
>                    findLocationQuery.Add(latitudeRangeQuery,
> BooleanClause.Occur.SHOULD);
>
>
>
>                    Term lowerLongitude = new Term("longitude",
> bounds.West.ToString());
>                    Term upperLongitude = new Term("longitude",
> bounds.East.ToString());
>                    RangeQuery longitudeRangeQuery = new
> RangeQuery(lowerLongitude, upperLongitude, true);
>                    findLocationQuery.Add(longitudeRangeQuery,
> BooleanClause.Occur.SHOULD);
>
>
> Also,I wanted to know how Lucene's ConstantScoreRangeQuery is better than
> RangeQuery  class.
>
>
> Am facing another problem in this context:
> I've one of the documents in the index with the following 3 cities:
>
>  - Lyons, IL
>
>   Oak Brook, IL
>
>   San Francisco, CA
>
> If i give input as "Lyons, IL" then this record comes up.
> But if i give San Francisco, CA as input, then it does not.
>
> However, if i store the cities for this document as follows:
>
>  - San Francisco, CA
>
>   Lyons, IL
>
>   Oak Brook, IL
>
>  and when i give San Francisco, CA  as input, then this record shows in the
> search results.
>
> What i want here is that if i type any of the 3 cities in input,I should get
> this document in the search results.
>
> Please help me achieve this.
>
> Thanks.
>
>
>
>
>
>
>
> --
> View this message in context: http://www.nabble.com/SpatialQuery-for-location-based-search-using-Lucene-tp24236232p24236232.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>



-- 
Marcelo F. Ochoa
http://marceloochoa.blogspot.com/
http://marcelo.ochoa.googlepages.com/home
______________
Want to integrate Lucene and Oracle?
http://marceloochoa.blogspot.com/2007/09/running-lucene-inside-your-oracle-jvm.html
Is Oracle 11g REST ready?
http://marceloochoa.blogspot.com/2008/02/is-oracle-11g-rest-ready.html

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message