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|
+----+--------+---------+------------++----+--------+---------+------------+
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?