Creating a Shop Search System with Geo Indexes


The core and bottleneck of a geo management system is the database storage performance and query capability. On one hand, storage services require low-latency data storage and reading that can deal with massive amounts of data; on the other hand, storage services also need to provide efficient geographic and multi-dimensional data retrieval. Table Store is a serverless and distributed NoSQL database that can completely meet the requirements of a geo management system.


A certain shop search platform provides information about 100 million shops. Users can search for desired shops based on their own dimensions on the PC application and website of this platform. The platform needs to display the specific locations of shops and shop details on a map, and support redirecting to shop homepages.

Table Store

The SearchIndex solution in Table Store allows you to easily set up a search system targeting 100 million shops. The SearchIndex feature allows creating indexes such as geo indexes and word-breaking string indexes. It provides you with the capabilities such as geo retrieval and multi-dimensional combined retrieval. Indexes can be created at any time. Inventory data and incremental data are automatically synchronized.

Preparation for Building

If you are satisfied with the shop search system for 100 million shops implemented based on Table Store and want to start to set up your own system, simply follow the following steps:

(1) Activate Table Store

Activate the Table Store service in the console. Table Store is out-of-the-box (post-paid) and billed on a pay-as-you-go basis. Table Store also provides a free quota that is sufficient for functional tests. For more information, visit Table Store Console and Free quota description.

(2) Create an Instance

Create a Table Store instance in the console and select a region that supports SearchIndex. (Currently the SearchIndex feature has not been commercialized and is supported in the following regions:Beijing, Shanghai, Hangzhou, and Shenzhen. This feature will be gradually available in other regions.)

  • Beta test invitation request: Open a ticket, select”Table Store” > “Product Features and Characteristics” > “Create a Ticket”. The application content is as follows:
  • Question description: Please enter “Apply for SearchIndex beta test invitation”
  • Confidential information: Please enter Region + Instance name, for example, Shanghai + myInstanceName

(3) Download SDKs

Use SDKs with SearchIndex (see the official website for more details). Currently, new functions are added for Java, Go, and Node.js SDKs.

$ go get
$ npm install tablestore@4.1.0

(4) Design a Table

The shop search system sample only uses one shop table that mainly includes fields such as shop type, shop name, shop location, average shop ratings, and per capita consumption. The table is designed as follows:

Start Building (Core Code)

(1) Create a Data Table

You only need to create a “shop information table” under the instance for which you have successfully applied for the beta test invitation: Create and manage data tables in the console (or directly by using SDKs):

(2) Create a Data Table Index

Table Store automatically synchronizes full and incremental index data: Users can create and manage indexes through the console (or, they can also create indexes using the SDK)

(3) Data Import

Insert test data (100 million entries are inserted into the sample in the console. You can insert a small amount of test data by yourself).

(4) Data Reading

Data reading falls into two types:

List<Query> mustQueries = new ArrayList<Query>();TermQuery termQuery = new TermQuery();
termQuery.setTerm(ColumnValue.fromString(milk tea));
GeoDistanceQuery geoDistanceQuery = new GeoDistanceQuery();
BoolQuery boolQuery = new BoolQuery();



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
Alibaba Cloud

Alibaba Cloud


Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website: