In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to use TableStore GEO index to build a store search system". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to use TableStore GEO index to build a store search system.
I. background of the programme
For a set of GEO management system, its core and bottleneck lies in the storage performance and query ability of the database; on the one hand, the storage service needs to deal with the low latency and reading of massive data, on the other hand, the storage service should also provide efficient GEO+ multi-dimensional data retrieval. Table storage (TableStore), as a Serverless distributed NoSQL database, fully meets the needs of the system.
Next we will build a [hundreds of millions of magnitude GEO management system] based on TableStore.
Demand scenario
A store search platform provides hundreds of millions of store information. Through the PC and mobile web pages provided by the platform, users search the stores they like according to their own demand dimensions. The platform needs to show the specific location of the store, the details of the store and the jump of the store's home page on the map.
Dimension 1: [within 1km] [within 100 per capita] [highest score] [milk tea shop]
Dimension 2: [Hangzhou] [highest rated] [Shen Jia *] store
.
Implementing fast, multi-dimensional GEO query is the core function of GEO management solution. Examples are as follows:
Note: this sample provides [hundreds of millions of magnitude] store data. Official website console sample address: project sample
Cdn.com/c9ab5efa61a3e8747d513a849e6282fe422b8811.gif ">
The store search system based on form storage has a view of the page. The samples are embedded in the form storage console. Users can log in to the console to experience the system (for new users who are stored in forms, they need to click to activate the service, which is free of charge. The order data is stored in public instances, and the experience does not consume user storage, traffic and Cu).
Table storage (TableStore) scheme
Using the multiple indexing (SearchIndex) scheme developed by Table Storage (TableStore), you can easily build a set of hundreds of millions of store search systems. The multi-index function can create GEO index, word segmentation string index and so on, which provides users with the ability of GEO retrieval, multi-dimensional combination retrieval and so on. Users can create it at any time, and the stock and incremental data can be synchronized automatically.
As a fully managed, zero operation and maintenance distributed TableStore data storage service provided by Aliyun, TableStore has the functions of [massive data storage], [hot spot data automatic slicing], [massive data multi-dimensional retrieval] and so on, which effectively solves the challenge of large expansion of GEO data.
Users can create and activate indexes only when they need them. TableStore ensures the consistency of data synchronization, which greatly reduces the workload of users' scheme design, service operation and maintenance, code development and so on.
Second, construction preparation
If you have a good experience with the [hundreds of millions of store search system] implemented based on TableStore, and want to start the journey of building your own system, you can simply follow the steps below:
1. Activate form storage
The form storage service is activated through the console, and the form storage is ready-to-use (postpaid). The pay-by-quantity method has provided users with a free quota for functional testing. The form stores the console of the official website and the description of free quota.
2. Create an instance
Create a table storage instance through the console and select the Region that supports multiple indexes. (at present, the SearchIndex function has not yet been commercialized, Beijing, Shanghai, Hangzhou and Shenzhen will be opened temporarily, and the rest will be opened gradually.)
After the instance is created, submit a ticket to apply for the multi-index function for testing (it is turned on by default after commercialization, and there is no charge for use).
Request address: submit a ticket, and select * * form Storage * *-> * * consultation on Product Features and Features * *-> * * create a ticket * *. The application content is as follows:
Problem description: please fill in [apply for SearchIndex Invitational Test]
Confidential information: please fill in [region + instance name], for example: Shanghai + myInstanceName
3. Download SDK
New functions have been added to the use of SDK with multiple index (SearchIndex), official website address, temporary java, go and node.js SDK.
Java-SDK com.aliyun.openservices tablestore 4.7.4gomurSDK $go get github.com/aliyun/aliyun-tablestore-go-sdk4, table design
Store retrieval system sample, only easy to use a shop table, mainly contains fields: shop type, shop name, store location, store average score, per capita consumption consumption and so on. The table is designed as follows:
Table name: geo_positon
Column name data type index type field description _ id (primary key column) String
MD5 (pId) avoid hotspot pIdStirng
Shop number typeStringKEYWORD type nameStringTEXT shop name, TEXT type index can be fuzzy query, but can not sort posStringGEO_POINT store location: "30.132120.082" (latitude, accuracy) pointdoubleDOUBLE score. Start to build (core code) 1. Create a data table
Users only need to create a "store information table" under the instance where the request test is completed: create and manage the data table through the console (you can also create it directly through SDK):
2. Create a data table index
TableStore automatically synchronizes full and incremental index data: users can create and manage indexes through the console (you can also create indexes through SDK)
3. Data import
Insert test data (100 million pieces of data are inserted in the console sample, and users can insert a small amount of test data themselves)
Shop number shop (md5) (main key) type shop name shop location shop score per capita consumption
O00570221920000000f470ef0f548b925ceffe1a7e3 Hangbang cuisine Han village Hangbang cuisine 36.76613111.414612.8763.67
4. Data reading
There are two types of data reads:
Primary key read
Primary key column acquisition based on native table storage: getRow, getRange, batchGetRow, etc. Primary key reading is used for indexing (automatic) reverse query, and users can also provide a page for a single query of the primary key (order md5), which is extremely fast on the order of 100 million. Single primary key query does not support multi-dimensional retrieval.
Index read (shop query)
Query:search interface based on the new SearchIndex function. Users are free to design multi-dimensional conditional combination queries for index fields. Different query conditions and different sorting methods are constructed by setting and selecting different query parameters; at present, it supports: precise query, range query, prefix query, matching query, wildcard query, phrase matching query, participle string query, and Boolean and or combination.
For example, [milk tea shops within 1km meters around "36.76613111.41461"), the query conditions are as follows:
List mustQueries = new ArrayList (); 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.76613111.41461"); geoDistanceQuery.setDistanceInMeter (1000); mustQueries.add (geoDistanceQuery); BoolQuery boolQuery = new BoolQuery (); boolQuery.setMustQueries (mustQueries) At this point, I believe you have a deeper understanding of "how to use the TableStore GEO index to create a store search system". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.