Creating a Shop Search System with Geo Indexes

Background

Scenario

Table Store

Preparation for Building

(1) Activate Table Store

(2) Create an Instance

(3) Download SDKs

<dependency>
<groupId>com.aliyun.openservices</groupId>
<artifactId>tablestore</artifactId>
<version>4.8.0</version>
</dependency>
$ go get github.com/aliyun/aliyun-tablestore-go-sdk
$ npm install tablestore@4.1.0

(4) Design a Table

Start Building (Core Code)

(1) Create a Data Table

(2) Create a Data Table Index

(3) Data Import

(4) Data Reading

List<Query> mustQueries = new ArrayList<Query>();TermQuery termQuery = new TermQuery();
termQuery.setFieldName("type");
termQuery.setTerm(ColumnValue.fromString(milk tea));
mustQueries.add(termQuery);
GeoDistanceQuery geoDistanceQuery = new GeoDistanceQuery();
geoDistanceQuery.setFieldName("pos");
geoDistanceQuery.setCenterPoint("36.76613,111.41461");
geoDistanceQuery.setDistanceInMeter(1000);
mustQueries.add(geoDistanceQuery);
BoolQuery boolQuery = new BoolQuery();
boolQuery.setMustQueries(mustQueries);

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store