lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yang Yang <m4ecli...@gmail.com>
Subject Re: lucene anchor-distance based search
Date Thu, 18 Nov 2010 07:06:15 GMT
Thank you very much!!! :)

I will have a look at the docs .

2010/11/18 Anshum <anshumg@gmail.com>

> Hi.
> The way you're forming the BooleanQuery seems fine to me (minus the ture
> should've been true, and 'm guessing its a typo).
> About the geo-spatial search, you may have a look at the various approaches
> there are for the same. Have a look at the  contrib module in lucene.
> http://wiki.apache.org/lucene-java/SpatialSearch
> For your understanding, you could have a look at the bounding box approach.
>
> --
> Anshum Gupta
> http://ai-cafe.blogspot.com
>
>
> On Thu, Nov 18, 2010 at 7:38 AM, yang Yang <m4eclipse@gmail.com> wrote:
>
> > We are using the hibernate search which is based on lucene as the search
> > engine to build a full text search for our position-related data in the
> > MYSQL db.
> > This is the main structure of the table(it save the id,coordinate and
> name
> > of one Surface_Feature):
> > +----+--------+---------+------------+
> > | id | co_x   | co_y    | name       |
> > +----+--------+---------+------------+
> > |  1 | 11111  | 22222   | Disney Park|
> > +----+--------+---------+------------+
> > Then these attributes are mapped as the fields in lucene by hibernate
> > search.And I do the following configuration to the field:
> > .....
> > field_co_x -->Store.Yes,Index.UN_TOKENIZED.
> > field_co_y -->Store.Yes,Index.UN_TOKENIZED.
> > field_name -->Store.Yes,Index.TOKENIZED.
> > ...
> >
> >
> > Then we want to query the Surface_Features basing on a special scope.
> >
> > For example:
> > 1) Range search
> > if we want to search the Surface_Feature whose co_x  is between
> [minX,maxX]
> > and whose iny is between [minY,maxY],for this requirement I thought the
> > RangeTermQuery.
> > --code snippet--
> >
> >        TermRangeQuery trq_x=new TermRangeQuery("co_x ", minX, maxX, ture,
> > true);
> >        TermRangeQuery trq_Y=new TermRangeQuery("co_y", minY, maxY, ture,
> > true);
> >
> >        BooleanQuery query=new BooleanQuery();
> >        query.add(trq_x, BooleanClause.Occur.MUST);
> >        query.add(trq_Y,BooleanClause.Occur.MUST);
> > Is this right?
> >
> > 2) Anchor-distance based search
> > But I have no idea about how to query features basing on a anchor and a
> > distance.
> >
> > That'to say I want to search features who are located inside the circle
> > defined by the anchor and the distance.
> >
> > It seems that the sphinx provide a function named SetGeoAnchor(),so I
> > wonder
> > if lucene can implement the same requirement?
> >
> > BWT,for some condition-required search I can make the condition as a
> filter
> > and then filter the result.
> >
> > Also I can build a BooleanQuery according to the condition just like the
> > code in the range search,I wonder which is better?
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message