CN109558423A - A kind of data search method based on key-value pair, device and equipment - Google Patents
A kind of data search method based on key-value pair, device and equipment Download PDFInfo
- Publication number
- CN109558423A CN109558423A CN201811288856.8A CN201811288856A CN109558423A CN 109558423 A CN109558423 A CN 109558423A CN 201811288856 A CN201811288856 A CN 201811288856A CN 109558423 A CN109558423 A CN 109558423A
- Authority
- CN
- China
- Prior art keywords
- found
- product
- key
- value pair
- classification
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2455—Query execution
Abstract
This application discloses a kind of data search method based on key-value pair, device and equipment, and wherein method includes: to obtain the corresponding product feature to be found of name of product to be found, determine key assignments to be found according to product feature to be found;The classification for determining key assignments to be found searches corresponding classification bucket to be found according to the classification of key assignments to be found from database;Key assignments to be found key-value pair to be found accordingly is searched from classification bucket to be found using hash algorithm;Target product data corresponding with product feature to be found and corresponding target output interface are searched according to key-value pair to be found, target product data are exported by target output interface.Through the above scheme, when effectively preventing product data output, there is the case where multiple product data share an output interface, output interface is caused to block, and then accelerate the search speed of product data.
Description
Technical field
This application involves technical field of data processing, more particularly to a kind of data search method based on key-value pair, dress
It sets and equipment.
Background technique
With developing for some companies, the product of company is more and more, and the client of company wants to these products
When some detailed data informations are understood, generally require directly to be searched by name of product.
General company can be by the corresponding data information memory of each product in the database, and user is developed using company oneself
APP, from APP search entrance input product title, then directly transferred from database corresponding with the name of product
Data information, with for reference.
But name of product and corresponding product data can not be returned simultaneously by an interface, usually by name of product and
Corresponding product data are stored in mobile terminal local, then return to the corresponding interface APP again, thus will increase the mistake of storage
Journey, and then increase and search the time, it makes troubles to the lookup of product data.
Summary of the invention
In view of this, this application provides a kind of data search method based on key-value pair, device and equipment.Main purpose
When being to solve to carry out product data lookup at present, name of product and corresponding product data can not be returned simultaneously by an interface
It returns, and then stores it in local, and lead to the technical issues of searching time extension.
According to the application's in a first aspect, providing a kind of data search method based on key-value pair, the step of the method
Suddenly include:
The corresponding product feature to be found of name of product to be found is obtained, is determined according to the product feature to be found to be checked
Look for key assignments, wherein each name of product to be found corresponds at least one product feature to be found, each product feature pair to be found
Answer a key assignments to be found;
The classification for determining the key assignments to be found is searched from database corresponding according to the classification of the key assignments to be found
Classification bucket to be found;
The key assignments to be found key-value pair to be found accordingly is searched from the classification bucket to be found using hash algorithm,
Wherein, at least one key-value pair is stored in each classification bucket;
Target product data corresponding with the product feature to be found and right are searched according to the key-value pair to be found
The target output interface answered is exported the target product data by the target output interface, wherein each key-value pair pair
Answer an output interface.
According to the second aspect of the application, a kind of data search device based on key-value pair is provided, described device includes:
Acquiring unit, for obtaining the corresponding product feature to be found of name of product to be found, according to the production to be found
Product feature determines key assignments to be found, wherein each name of product to be found corresponds at least one product feature to be found, each to
Search the corresponding key assignments to be found of product feature;
Unit is searched, for determining the classification of the key assignments to be found, according to the classification of the key assignments to be found from data
Corresponding classification bucket to be found is searched in library;
The search unit is also used to search the key assignments to be found from the classification bucket to be found using hash algorithm
Corresponding key-value pair to be found, wherein be stored at least one key-value pair in each classification bucket;
Output unit, for searching target production corresponding with the product feature to be found according to the key-value pair to be found
Product data and corresponding target output interface export the target product data by the target output interface,
In, the corresponding output interface of each key-value pair.
According to the third aspect of the application, a kind of computer equipment, including memory and processor, the storage are provided
Device is stored with computer program, and the processor is realized described in first aspect when executing the computer program based on key-value pair
Data search method the step of.
According to the fourth aspect of the application, a kind of computer storage medium is provided, computer program is stored thereon with, institute
State the step of data search method described in first aspect based on key-value pair is realized when computer program is executed by processor.
By above-mentioned technical proposal, a kind of data search method based on key-value pair, device and equipment provided by the present application,
The product feature of product and product data can be stored as to the mode of key-value pair, assign to each classification bucket for these key-value pairs
In, in this way, need to only be found from classification bucket accordingly using hash algorithm when user wants to look up the product data of corresponding product
Key-value pair, and then the corresponding product data of key-value pair are exported by output interface corresponding with the key-value pair, and shows
User.When effectively preventing product data output, there are multiple product data and share an output interface, output interface is caused to go out
The case where now blocking, and then accelerate the search speed of product data.
Above description is only the general introduction of technical scheme, in order to better understand the technological means of the application,
And it can be implemented in accordance with the contents of the specification, and in order to allow above and other objects, features and advantages of the application can
It is clearer and more comprehensible, below the special specific embodiment for lifting the application.
Detailed description of the invention
By reading the following detailed description of the preferred embodiment, various other advantages and benefits are common for this field
Technical staff will become clear.The drawings are only for the purpose of illustrating a preferred embodiment, and is not considered as to the application
Limitation.And throughout the drawings, the same reference numbers will be used to refer to the same parts.In the accompanying drawings:
Fig. 1 is the flow chart of one embodiment of the data search method based on key-value pair of the application;
Fig. 2 is the composition figure of the key-value pair of the application;
Fig. 3 is the hash algorithm search program figure of the application;
Fig. 4 is the flow chart of another embodiment of the data search method based on key-value pair of the application;
Fig. 5 is the structural block diagram of one embodiment of the data search device based on key-value pair of the application;
Fig. 6 is the structural schematic diagram of the computer equipment of the application.
Specific embodiment
Exemplary embodiments of the present disclosure are described in more detail below with reference to accompanying drawings.Although showing the disclosure in attached drawing
Exemplary embodiment, it being understood, however, that may be realized in various forms the disclosure without should be by embodiments set forth here
It is limited.On the contrary, these embodiments are provided to facilitate a more thoroughly understanding of the present invention, and can be by the scope of the present disclosure
It is fully disclosed to those skilled in the art.
The embodiment of the present application provides a kind of data search method based on key-value pair, can by the product feature of product and
Product data are stored as the mode of key-value pair, assign in each classification bucket for these key-value pairs, in this way, when user wants to look up pair
When answering the product data of product, only corresponding key-value pair need to be found from classification bucket using hash algorithm, and then by key-value pair pair
The product data answered show user, and then accelerate the search speed of product data.
As shown in Figure 1, the embodiment of the present application provides a kind of data search method based on key-value pair, step includes:
Step 101, the corresponding product feature to be found of name of product to be found is obtained, is determined according to product feature to be found
Key assignments to be found, wherein each name of product to be found corresponds at least one product feature to be found, and corresponds at least one
Key assignments to be found.
In this step, when user wants to look up the product data of some product, the product is inputted from input window
Name of product (name of product i.e. to be found), system will search corresponding feature (example to be found according to name of product to be found
Such as, product category, product colour, date of manufacture etc.).Wherein, in system can by the corresponding product feature of each name of product into
Row association, and each product feature is matched into corresponding key assignments, and list is stored in system.
Step 102, the classification for determining key assignments to be found is searched from database corresponding according to the classification of key assignments to be found
Classification bucket to be found.
In this step, in the corresponding code of each key assignments, have on the head of code or tail portion and mark the key assignments class
Other symbol only need to just can determine that the class of the key assignments to be found according to the head of the code of key assignments to be found or tail portion in this way
Not, and then the classification bucket to be found that storage corresponds to product data to be found is found.
Step 103, key assignments to be found key-value pair to be found accordingly is searched from classification bucket to be found using hash algorithm,
Wherein, at least one key-value pair is stored in each classification bucket.
In this step, each key-value pair answers a Hash codes (hashcode), i.e. key-value pair, thus can use Kazakhstan
Uncommon algorithm obtains corresponding hashcode (that is, key-value pair to be found) according to key assignments to be found (key key).Corresponding program code
Are as follows: int hash=hash (key.hashcode ()).
Step 104, corresponding with product feature to be found target product data and right are searched according to key-value pair to be found
The target output interface answered exports target product data by target output interface, wherein each key-value pair corresponding one defeated
Outgoing interface.
In this step, target product data are obtained according to hashcode (key-value pair to be found) using hash algorithm
(value) the corresponding position in the classification bucket to be found, extracts corresponding target product data from corresponding position.Program generation
Code are as follows: int i=indexFor (hash, table.length).When wherein, in order to avoid product data output, occur multiple
The case where product data share an output interface, and output interface is caused to block, the present embodiment is each key-value pair in advance
Match corresponding output interface.And matched output interface is stored in corresponding classification bucket together with key-value pair.
Target product data are exported from target output interface, if the name of product to be found that user needs, finds more
A target product data just export this multiple target product data from corresponding multiple target output interfaces simultaneously, and aobvious
User is shown on showing device.For example, having in display, product category: sneakers, product colour: between reddish yellow blue phase, production date
Phase: on May 25th, 2017 etc..
Through the above technical solutions, the product feature of product and product data can be stored as to the mode of key-value pair, it is
These key-value pairs are assigned in each classification bucket, in this way, need to only utilize Kazakhstan when user wants to look up the product data of corresponding product
Uncommon algorithm finds corresponding key-value pair from classification bucket, and then the corresponding product data of key-value pair is passed through corresponding to the key-value pair
Output interface output, and show user.When effectively preventing product data output, there are multiple product data and share one
Output interface, the case where causing output interface to block, and then accelerate the search speed of product data.
The data search method based on key-value pair of the present embodiment, further includes:
Step (1) collects at least one corresponding product feature of each name of product and the corresponding product of product feature
Data.
Product feature is converted into corresponding key assignments by step (2), and key assignments is formed key-value pair with corresponding product data,
And corresponding output interface is matched for key-value pair.
In this step, the product feature of various products and corresponding product data are collected, for subsequent use
Family is searched, and product feature is matched into the form of key-value pair with product data.And for the ease of the defeated of the product data
Out, corresponding output interface is matched for each key-value pair.
For example, being directed to product rotary drum washing machine, corresponding product feature has: washing weight, the date of manufacture, product colour,
Operating power etc., corresponding product data are as follows: 7.5kg, December 1, silvery white, 500w/h in 2017.Then, it does washing for impeller
The product feature of machine matches corresponding key assignments, washing weight: 001, the date of manufacture: and 002, product colour: 003, operating power:
004.The then key-value pair of product feature and product data composition are as follows: 001-7.5kg, 002-2017 December 1,003- are silvery white
Color, 004-500w/h.Finally, matching corresponding output interface for key-value pair, the output interface of 001-7.5kg is No. 1 delivery outlet,
002-2017 December 1 is No. 2 delivery outlets, and 003- silvery white is No. 3 delivery outlets, and 004-500w/h is No. 4 delivery outlets.
Step (3), matches corresponding mapping relations for key-value pair in the way of Hash mapping.
In this step, by way of Hash mapping (Hashmap), operation, i.e. key are provided mapping for each key-value pair
Value allows using null value and null key mapping relations.
Step (4) carries out category division to key-value pair according to mapping relations, and by least one corresponding key of each classification
Value pair, and output interface corresponding with key-value pair are placed in corresponding classification bucket.
In this step, category division is carried out for the mapping relations of these key-value pairs, assigns to the corresponding classification of each classification
In bucket, the mapping relations of key-value pair are suitably distributed between bucket of all categories using hash function, can be basic operation (get
And put) stable performance is provided.
Step (5), in the database by the storage of classification bucket.
In this step, it will be stored with the classification bucket of multiple key-value pairs and corresponding output interface, existed according to the difference of classification
It is stored in database, to search corresponding classification bucket from database according to classification.
Through the above technical solutions, the product feature of each product and corresponding product data can be converted into accordingly
Key-value pair matches corresponding output interface for each key-value pair, when can prevent multiple product data while export, occupies same
A output interface, and appearance the case where cause output interface to block.It recycles hash algorithm that these key-value pairs are carried out classification to draw
It is stored in the classification bucket of corresponding classification after point, it thus can be according to the corresponding key assignments of product feature of certain product, from classification
Corresponding key-value pair, and then the product feature of certain product of calling and obtaining user needs are searched in bucket, so that entire search procedure is convenient
Quickly.
If in step 103, not searching key assignments to be found key-value pair to be found accordingly from classification bucket to be found, it was demonstrated that
The corresponding product data of one or more product features of the product to be found are not stored in database.
It then needs to be updated the classification bucket stored in database, therefore, the data based on key-value pair of the present embodiment
Lookup method, further includes:
Step A passes through internet search all-network product feature corresponding with name of product to be found.
In this step, it is first determined have all websites of the name of product to be found, and extract station address, to website
It accesses, all product features relevant to the name of product to be found in each website is all concentrated in together, then
Identical product feature is only retained into remaining deletion, remaining product feature is summarized as networking products spy
Sign.
Step B, by all-network product feature, networking products feature identical with product feature to be found is deleted, and is remained
Remaining networking products feature is missing product feature.
In this step, have in the all-network product feature to gather it is some identical as product feature to be found,
Have it is some different from product feature to be found, therefore in order to avoid these networking products features identical with product feature to be found
Interference, need to be deleted.Remaining networking products feature is only the missing product feature supplemented.
Step C searches the corresponding missing product data of missing product feature from network.
In this step, the corresponding station address of missing product feature is obtained, and is accessed to these websites, according to scarce
It loses product feature and obtains corresponding missing product data.And missing product data are downloaded and are saved in cache database.
Missing product data are passed through missing output for the corresponding missing output interface of missing product data matching by step D
Interface output.
In this step, from having found the corresponding missing product number of name of product to be found not having in database in network
According to rear, directly for these corresponding missing output interfaces of missing product data matching, (wherein, different missing product data are corresponding
Different missing output interface).Then it is combined with the target product data found in above-mentioned steps, and by respective
Output interface output.
Through the above technical solutions, the product data of the product needed in the classification bucket of database to user are searched
In the process, if corresponding product data can not be found in the classification bucket of database, or a part of corresponding product number is only found
According to the target for then needing to be searched in a network according to the name of product, and missing product data being corresponded to found
Product data are exported by corresponding output interface together, show user.It can guarantee the product number shown for user in this way
According to integrality.
Step E is converted into missing product feature to lack key assignments accordingly, by missing key assignments and corresponding missing product number
Key-value pair is lacked according to composition, missing key-value pair is subjected to mapping matching with corresponding missing output interface.
Step F is that missing key-value pair determines corresponding classification, and will lack key-value pair in the way of Hash mapping, with
And corresponding missing output interface is placed in corresponding classification bucket, and corresponding classification bucket is updated.
Step G, in the database by the storage of updated classification bucket.
In the above-mentioned technical solutions, when finding that the corresponding product data of corresponding name of product to be found can not be in database
After all being found in the classification bucket of storage, the corresponding missing product data of the name of product to be found that need to find from network
It adds in corresponding classification bucket, and then guarantees that the later period again searches the corresponding product data of the name of product to be found
When, it can all be found in the classification bucket of the database, no longer need to obtain from network, when saving the lookup of product data
Between.
Before step (5), the method for the present embodiment further include:
Step (5 ') is patterned each classification bucket in the way of iteration collection view by key-value pair,
Obtain lookup figure corresponding with each classification bucket.
It then corresponds to step 103 to specifically include: transferring the lookup figure in classification bucket to be found, according to key assignments to be found from looking into
It looks in figure and obtains corresponding key-value pair to be found.
In the above-mentioned technical solutions, by hash algorithm iteration collection view in the way of, by each classification bucket
In key-value pair be patterned, then by the key-value pair in each classification bucket with grid, stack, circle etc. search figure store,
Thus the product data that user needs directly can be searched according to figure of searching corresponding in classification bucket, wherein collection
View can dynamically change the layout for searching figure, or be laid out with any arrangement that you are envisioned that figure is searched.
It is deposited through the above technical solutions, the key-value pair in each classification bucket is searched figure with grid, stack, circle etc.
Storage, can accelerate the lookup time of product data.
Step (1) specifically includes:
Step (11), transfers the network address of at least one corresponding website of each name of product.
Step (12) accesses to website by network address, and obtains product corresponding with each name of product in website
Feature, and product data corresponding with product feature.
And/or
Step (11 '), after the setting command for receiving each name of product, by the corresponding setting window of each name of product
It is shown, so that user inputs product feature corresponding with name of product and product data in corresponding setting window.
Step (12 ') receives at least one product feature corresponding with each name of product and production that setting window transmits
Product data.
Through the above technical solutions, multiple product features of each product and corresponding can be obtained by two ways
Product data are obtained automatically by Web search respectively, if network obtains incomplete automatically, user can be by setting
It sets window and is manually entered corresponding product data.And then guarantee the integrality of the product data for each product collected.
Furthermore it is also possible to which periodically (for example, a week) to classification bucket storing data each in database, is updated, more
New mode can be any of the above-described one or two.
Step (5) specifically includes:
Step (51) is that each classification bucket is encrypted using setting code, wherein the setting code of each classification bucket is
Identical or different number.
For example, be arranged to 263* for the password of I classification bucket, the password of II classification bucket is arranged to 264* etc., or by this
The password of a little classification buckets is uniformly arranged to 2596.
It can guarantee the safety of each classification bucket store data inside in this way, and the password of each classification bucket can be regular
Adjustment, after cryptocompromise, someone steals data in classification bucket.
Step (52) matches corresponding symbol code for each encrypted classification bucket, wherein symbol code adds with each
The classification of classification bucket after close is corresponding.
In this step, the corresponding password of each classification bucket can be preferably distinguished, the password of each classification bucket is avoided to go out
The case where now obscuring.
Then corresponding step 103 specifically includes:
The classification that key assignments to be found is determined using hash algorithm obtains the corresponding symbol code of classification of key assignments to be found,
Corresponding classification bucket to be found is searched from database according to corresponding symbol code, and using setting code to classification to be found
Bucket is decrypted.
By the process for encrypting and decrypting above, the safety of the data stored in each classification bucket can effectively ensure that,
Data are avoided to be stolen.
Technical solution through this embodiment, the product feature of product and product data can be stored as key-value pair
Mode is assigned in each classification bucket for these key-value pairs, in this way, when user wants to look up the product data of corresponding product, only
Corresponding key-value pair need to be found from classification bucket using hash algorithm, so by the corresponding product data of key-value pair by with the key
Value exports corresponding output interface, and shows user.When effectively preventing product data output, there are multiple product data
The case where sharing an output interface, output interface caused to block, and then accelerate the search speed of product data.
Include the following steps: in the data search method based on key-value pair of another embodiment of the application
One, data management
1, data update, and data (that is, product feature and product data of product) acquisition modes are broadly divided into network interface
Two ways is obtained and be manually entered, data real-time update and data scalability, two kinds of acquisition data mode data are realized
Source is different, and network interface obtains mainly adds data by administrator in back-stage management, and APP is getting data needs
Back office interface can be requested when update, complete the update to local data;It is manually entered mainly by developer to data management
The addition interface of system calls, the update of complete paired data.In order to guarantee the safety of data, need for the data got
Carry out data encryption.
2, data are stored
After the completion of data update, each product feature and corresponding product data are corresponding, and data can be in terms of storing
The corresponding product data of product feature are simply interpreted as key-value pair one by one, according to different data types by data with key
The form of value pair stores in the database, as shown in Fig. 2, key-value paies, i.e. key-value pair, key indicate key in figure
(that is, product feature), value indicate key assignments (that is, product data).Corresponding output interface is matched for each value.
Two, data search is laid out
Fast data search matching is a main modular based on key-value pair quick search, is mainly answered in key-value pair inquiry
With Hashmap, the realization of the Map interface based on Hash table.For business demand, HashMap is as unordered storage side
In case, data search speed is fast.
Specific search procedure is as follows:
It (1) is that each key-value pair matches corresponding mapping relations, and allows using null value and null by Hashmap
Key.This mode does not guarantee the sequence of the mapping relations of each key-value pair, less guarantees the sequence constancy.
Then, category division is carried out using the mapping relations that hash function is these key-value pairs, it is corresponding assigns to each classification
Classification bucket in, can for basic operation (get and put) provide stable performance.
(2) according to the mapping relations of the key-value pair in each classification bucket obtained above and classification bucket, iteration is utilized
The mode of collection view is patterned, and is obtained grid, stack, circle etc. and is searched figure, collection view can move
State changes the layout for searching figure, or the lookup figure formed with arrangement mode set by user is laid out.
Wherein, the quantity and classification bucket that iteration collection view is patterned required time and classification bucket can deposit
The mapping relations quantity of the largest key value pair of storage is proportional.
(3) corresponding value product data are searched using hash algorithm, detailed process is as shown in Figure 3.
The first step obtains hashcode according to key key using hash algorithm in the lookup figure in corresponding classification bucket.
Method: int hash=hash (key.hashCode ()).
Second step obtains the corresponding position in searching figure value according to hashcode, phase is extracted from corresponding position
The value answered.Method: int i=indexFor (hash, table.length).
If not finding the corresponding hashcode of key key in the graphic, it was demonstrated that corresponding value product data information lacks
It loses, needs quickly to be searched corresponding value product data by following manner:
Firstly, it is necessary to which the title of corresponding product is obtained by network according to key key.
Then, the corresponding all value product data of the name of product, and the value that will acquire are obtained from network
Product data value product data corresponding with the name of product in database are compared, and finding does not have in database
One or more value, i.e. missing product data.
Thus a key can be converted into a fixed position, the reason of this is also that by quick lookup.
When user needs to obtain corresponding product data, so that it may obtain the position where the corresponding value of the key key, quickly
Take out value.
Wherein, hashmap bottom is realized with data, specific procedure code are as follows:
transient Entry[]table;Here table is exactly for storing data.
static class Entry<K,V>implements Map.Entry<K,V>{
final Kkey;
V value;
Entry<K,V>next;
final inthash;}
Wherein, Entry indicates variable.
Three, data export
The correspondence output interface for obtaining the value found returns to caller by corresponding output interface, and is opened up
Show.
Above-mentioned corresponding flow chart is summarized as shown in figure 4, steps are as follows:
Step 401, network obtains product data, is directly entered step 403.
Step 402, product data are manually entered, enter step 403.
Step 403, product data are encrypted.
Step 404, product data are stored.
Step 405, product data are searched.
Step 406, judge whether to find corresponding product data, be to enter step 407, otherwise enter step 408.
Step 407, product data are decrypted and is exported.
Step 408, network obtains name of product.
Step 409, the product data of missing are searched.
Step 410, the product data of missing are encrypted, subsequently into step 407.
Step 411, product data are shown.
In conclusion need to only utilize hash algorithm from classification bucket when user wants to look up the product data of corresponding product
In find corresponding key-value pair, and then it is the corresponding product data of key-value pair are defeated by output interface corresponding with the key-value pair
Out, the purpose for quickly searching product data is realized.In addition, can also effectively the product data of missing quickly be searched and be opened up
Show.
Further, the specific implementation as Fig. 1 method, the embodiment of the present application provide a kind of data based on key-value pair
Device is searched, as shown in figure 5, device includes: acquiring unit 51, searches unit 52 and output unit 53.
Acquiring unit 51, for obtaining the corresponding product feature to be found of name of product to be found, according to product to be found
Feature determines key assignments to be found, wherein each name of product to be found corresponds at least one product feature to be found, each to be checked
Look for the corresponding key assignments to be found of product feature;
Unit 52 is searched to be searched from database for determining the classification of key assignments to be found according to the classification of key assignments to be found
Seek corresponding classification bucket to be found;
Unit 52 is searched, is also used to search key assignments to be found from classification bucket to be found using hash algorithm to be checked accordingly
Look for key-value pair, wherein be stored at least one key-value pair in each classification bucket;
Output unit 53, for searching target product number corresponding with product feature to be found according to key-value pair to be found
According to and corresponding target output interface, target product data are exported by target output interface, wherein each key-value pair
A corresponding output interface.
In a particular embodiment, device further include:
Collector unit, it is corresponding for collecting at least one corresponding product feature of each name of product and product feature
Product data;
Converting unit, for product feature to be converted into corresponding key assignments, by key assignments and corresponding product data group bonding
Value pair, and corresponding output interface is matched for key-value pair;
Matching unit, for key-value pair to be matched corresponding mapping relations in the way of Hash mapping;
Division unit, for carrying out category division to key-value pair according to mapping relations, and each classification is corresponding at least
One key-value pair, and output interface corresponding with key-value pair are placed in corresponding classification bucket;
Storage unit, for storing in the database classification bucket.
In a particular embodiment, if not searching key assignments to be found key assignments to be found accordingly from classification bucket to be found
It is right.
Then collector unit is also used to special by internet search all-network product corresponding with name of product to be found
Sign;By in all-network product feature, networking products feature identical with product feature to be found is deleted, remaining networking products
Feature is missing product feature;The corresponding missing product data of missing product feature are searched from network;
Output unit 53 is also used to lack output interface for missing product data matching is corresponding, will lack product data
Pass through missing output interface output.
In a particular embodiment, device further include:
Updating unit is converted into lacking key assignments accordingly for that will lack product feature, and missing key assignments is lacked with corresponding
Missing key-value pair is carried out mapping matching with corresponding missing output interface by loss of production product data composition missing key-value pair;Utilize Kazakhstan
The mode of uncommon mapping is that missing key-value pair determines corresponding classification, and will lack key-value pair and corresponding missing is exported and connect
Mouth is placed in corresponding classification bucket, and corresponding classification bucket is updated;In the database by the storage of updated classification bucket.
In a particular embodiment, device further include:
Butut unit, for carrying out cloth to each classification bucket in the way of iteration collection view by key-value pair
Figure, obtains lookup figure corresponding with each classification bucket;
Unit 52 is searched, is also used to transfer the lookup figure in classification bucket to be found, is schemed according to key assignments to be found from lookup
Corresponding key-value pair to be found is obtained in shape.
In a particular embodiment, collector unit specifically includes:
Module is transferred, for transferring the network address of at least one corresponding website of each name of product;
Access modules for being accessed by network address to website, and obtain corresponding with each name of product in website
Product feature, and product data corresponding with product feature;
And/or
Setup module, after the setting command for receiving each name of product, by the corresponding setting of each name of product
Window is shown, so that user inputs product feature corresponding with name of product and product number in corresponding setting window
According to;
Receiving module, for receive at least one product feature corresponding with each name of product for transmitting of setting window and
Product data.
In a particular embodiment, storage unit is also used to be that each classification bucket is encrypted using setting code, wherein
The setting code of each classification bucket is identical or different number;Corresponding symbol code is matched for each encrypted classification bucket,
Wherein, symbol code is corresponding with the classification of each encrypted classification bucket;
Unit 52 is then searched, is also used to determine the classification of key assignments to be found using hash algorithm, obtains key assignments to be found
The corresponding symbol code of classification is searched corresponding classification bucket to be found according to corresponding symbol code from database, and is utilized
Classification bucket to be found is decrypted in setting code.
Embodiment based on method shown in above-mentioned Fig. 1 and Fig. 5 shown device, to achieve the goals above, the application are implemented
Example additionally provides a kind of computer equipment, as shown in fig. 6, including memory 62 and processor 61, wherein memory 62 and processing
Device 61 is arranged at memory 62 in bus 63 and is stored with computer program, and processor 61 realizes Fig. 1 when executing computer program
Shown in the data search method based on key-value pair.
Based on this understanding, the technical solution of the application can be embodied in the form of software products, which produces
Product can store in a nonvolatile memory (can be CD-ROM, USB flash disk, mobile hard disk etc.), including some instructions are used
So that a computer equipment (can be personal computer, server or the network equipment etc.) executes each reality of the application
Apply method described in scene.
Optionally, the equipment can also connect user interface, network interface, camera, radio frequency (Radio Frequency,
RF) circuit, sensor, voicefrequency circuit, WI-FI module etc..User interface may include display screen (Display), input list
First such as keyboard (Keyboard) etc., optional user interface can also include USB interface, card reader interface etc..Network interface can
Choosing may include standard wireline interface and wireless interface (such as blue tooth interface, WI-FI interface).
It will be understood by those skilled in the art that a kind of structure of computer equipment provided in this embodiment is not constituted to this
The restriction of entity device may include more or fewer components, perhaps combine certain components or different component layouts.
Based on the embodiment of above-mentioned method as shown in Figure 1 and Fig. 5 shown device, correspondingly, the embodiment of the present application also provides
A kind of storage medium, is stored thereon with computer program, which realizes above-mentioned base as shown in Figure 1 when being executed by processor
In the data search method of key-value pair.
It can also include operating system, network communication module in storage medium.Operating system is that management computer equipment is hard
The program of part and software resource supports the operation of message handling program and other softwares and/or program.Network communication module is used
Communication between each component in realization storage medium inside, and communicated between hardware and softwares other in computer equipment.
Through the above description of the embodiments, those skilled in the art can be understood that the application can borrow
It helps software that the mode of necessary general hardware platform is added to realize, hardware realization can also be passed through.
By the technical solution of application the application, the product feature of product and product data can be stored as key-value pair
Mode is assigned in each classification bucket for these key-value pairs, in this way, when user wants to look up the product data of corresponding product, only
Corresponding key-value pair need to be found from classification bucket using hash algorithm, so by the corresponding product data of key-value pair by with the key
Value exports corresponding output interface, and shows user.When effectively preventing product data output, there are multiple product data
The case where sharing an output interface, output interface caused to block, and then accelerate the search speed of product data.
It will be appreciated by those skilled in the art that the accompanying drawings are only schematic diagrams of a preferred implementation scenario, module in attached drawing or
Process is not necessarily implemented necessary to the application.It will be appreciated by those skilled in the art that the mould in device in implement scene
Block can according to implement scene describe be distributed in the device of implement scene, can also carry out corresponding change be located at be different from
In one or more devices of this implement scene.The module of above-mentioned implement scene can be merged into a module, can also be into one
Step splits into multiple submodule.
Above-mentioned the application serial number is for illustration only, does not represent the superiority and inferiority of implement scene.Disclosed above is only the application
Several specific implementation scenes, still, the application is not limited to this, and the changes that any person skilled in the art can think of is all
The protection scope of the application should be fallen into.
Claims (10)
1. a kind of data search method based on key-value pair, which is characterized in that the step of the method includes:
The corresponding product feature to be found of name of product to be found is obtained, key to be found is determined according to the product feature to be found
Value, wherein each name of product to be found corresponds at least one product feature to be found, each product feature to be found corresponding one
A key assignments to be found;
The classification for determining the key assignments to be found is searched from database corresponding to be checked according to the classification of the key assignments to be found
Look for classification bucket;
The key assignments to be found key-value pair to be found accordingly is searched from the classification bucket to be found using hash algorithm,
In, at least one key-value pair is stored in each classification bucket;
Target product data corresponding with the product feature to be found and corresponding are searched according to the key-value pair to be found
Target output interface exports the target product data by the target output interface, wherein each key-value pair corresponding one
A output interface.
2. according to right want 1 described in data search method, which is characterized in that obtain name of product to be found corresponding described
Before product feature to be found, the method also includes:
Collect at least one corresponding product feature of each name of product and the corresponding product data of the product feature;
The product feature is converted into corresponding key assignments, key assignments is formed into key-value pair with corresponding product data, and be described
Key-value pair matches corresponding output interface;
The key-value pair is matched into corresponding mapping relations in the way of Hash mapping;
Category division is carried out to the key-value pair according to the mapping relations, and by least one corresponding key assignments of each classification
It is right, and output interface corresponding with key-value pair is placed in corresponding classification bucket;
In the database by classification bucket storage.
3. according to right want 2 described in data search method, which is characterized in that if not searched from the classification bucket to be found
The key assignments to be found key-value pair to be found accordingly, then the method also includes:
Pass through internet search all-network product feature corresponding with the name of product to be found;
By in all-network product feature, networking products feature identical with the product feature to be found is deleted, remaining net
Network product feature is missing product feature;
The corresponding missing product data of the missing product feature are searched from network;
Corresponding missing output interface is matched for the missing product data, the missing product data are defeated by the missing
Outgoing interface output.
4. data search method according to claim 3, which is characterized in that corresponding being matched for the missing product data
Output interface is lacked, after the missing product data are exported by the missing output interface, further includes:
The missing product feature is converted into lack key assignments accordingly, missing key assignments is formed with corresponding missing product data
Key-value pair is lacked, the missing key-value pair is subjected to mapping matching with corresponding missing output interface;
Corresponding classification is determined for the missing key-value pair in the way of Hash mapping, and by the missing key-value pair, and
Corresponding missing output interface is placed in corresponding classification bucket, and corresponding classification bucket is updated;
In the database by the storage of updated classification bucket.
5. according to right want 2 described in data search method, which is characterized in that by the classification bucket storage in the database it
Before, the method also includes:
Each classification bucket is patterned in the way of iteration collection view by key-value pair, is obtained and each classification
The corresponding lookup figure of bucket;
The key assignments to be found key-value pair to be found accordingly is searched from the classification bucket to be found using hash algorithm, specifically
Include:
The lookup figure in the classification bucket to be found is transferred, it is corresponding from acquisition in figure is searched according to the key assignments to be found
Key-value pair to be found.
6. according to right want 2 described in data search method, which is characterized in that it is described to collect each name of product accordingly at least
One product feature and the corresponding product data of the product feature, specifically include:
Transfer the network address of at least one corresponding website of each name of product;
Accessed by network address to website, and obtain product feature corresponding with each name of product in website, and with institute
State the corresponding product data of product feature;
And/or
After the setting command for receiving each name of product, the corresponding setting window of each name of product is shown, for
User inputs product feature corresponding with name of product and product data in corresponding setting window;
Receive at least one product feature corresponding with each name of product and product data that setting window transmits.
7. wanting the described in any item data search methods of 2-6 according to right, which is characterized in that the classification bucket is stored in data
In library, specifically include:
It is that each classification bucket is encrypted using setting code, wherein the setting code of each classification bucket is identical or different number
Code;
Corresponding symbol code is matched for each encrypted classification bucket, wherein the symbol code and each encrypted class
The classification of other bucket is corresponding;
The classification that the key assignments to be found is determined using hash algorithm, according to the classification of the key assignments to be found from database
It is middle to search corresponding classification bucket to be found, it specifically includes:
The classification of the key assignments to be found is determined using hash algorithm, obtains the classification corresponding symbol generation of the key assignments to be found
Code searches corresponding classification bucket to be found according to corresponding symbol code from database, and using setting code to be found
Classification bucket is decrypted.
8. a kind of data search device based on key-value pair, which is characterized in that described device includes:
Acquiring unit, it is special according to the product to be found for obtaining the corresponding product feature to be found of name of product to be found
Sign determines key assignments to be found, wherein each name of product to be found corresponds at least one product feature to be found, each to be found
Product feature corresponds to a key assignments to be found;
Unit is searched, for determining the classification of the key assignments to be found, according to the classification of the key assignments to be found from database
Search corresponding classification bucket to be found;
The search unit is also used to search the key assignments to be found from the classification bucket to be found using hash algorithm corresponding
Key-value pair to be found, wherein be stored at least one key-value pair in each classification bucket;
Output unit, for searching target product number corresponding with the product feature to be found according to the key-value pair to be found
According to and corresponding target output interface, the target product data are exported by the target output interface, wherein every
The corresponding output interface of a key-value pair.
9. a kind of computer equipment, including memory and processor, the memory are stored with computer program, feature exists
In the processor realizes the number described in any one of claims 1 to 7 based on key-value pair when executing the computer program
The step of according to lookup method.
10. a kind of computer storage medium, is stored thereon with computer program, which is characterized in that the computer program is located
The step of reason device realizes the data search method described in any one of claims 1 to 7 based on key-value pair when executing.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811288856.8A CN109558423A (en) | 2018-10-31 | 2018-10-31 | A kind of data search method based on key-value pair, device and equipment |
PCT/CN2019/073952 WO2020087796A1 (en) | 2018-10-31 | 2019-01-30 | Key-value pair based data search method and device, and computer apparatus |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811288856.8A CN109558423A (en) | 2018-10-31 | 2018-10-31 | A kind of data search method based on key-value pair, device and equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109558423A true CN109558423A (en) | 2019-04-02 |
Family
ID=65865749
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811288856.8A Pending CN109558423A (en) | 2018-10-31 | 2018-10-31 | A kind of data search method based on key-value pair, device and equipment |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN109558423A (en) |
WO (1) | WO2020087796A1 (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111582991A (en) * | 2020-05-13 | 2020-08-25 | 中国银行股份有限公司 | Product information recommendation method and device |
CN112685612A (en) * | 2020-12-31 | 2021-04-20 | 武汉思普崚技术有限公司 | Feature code searching and matching method, device and storage medium |
CN112905982A (en) * | 2021-01-19 | 2021-06-04 | 青岛至心传媒有限公司 | Internet-based E-commerce platform intrusion detection method and monitoring system |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102194002A (en) * | 2011-05-25 | 2011-09-21 | 中兴通讯股份有限公司 | Table entry adding, deleting and searching method of hash table and hash table storage device |
CN102402394A (en) * | 2010-09-13 | 2012-04-04 | 腾讯科技(深圳)有限公司 | Hash algorithm-based data storage method and device |
WO2012163091A1 (en) * | 2011-06-02 | 2012-12-06 | 中兴通讯股份有限公司 | Data location, reorganization method and device |
WO2016184029A1 (en) * | 2015-05-18 | 2016-11-24 | 深圳市中兴微电子技术有限公司 | Storage and lookup methods and apparatuses supporting hash lookup and routing lookup, and storage medium |
WO2018099107A1 (en) * | 2016-12-02 | 2018-06-07 | 深圳市中兴微电子技术有限公司 | Hash table management method and device, and computer storage medium |
CN108681577A (en) * | 2018-05-08 | 2018-10-19 | 亳州中药材商品交易中心有限公司 | A kind of novel library structure data index method |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8504521B2 (en) * | 2005-07-28 | 2013-08-06 | Gopivotal, Inc. | Distributed data management system |
CN100561937C (en) * | 2006-06-15 | 2009-11-18 | 华为技术有限公司 | A kind of method and device of realizing network flow load sharing |
US10255309B2 (en) * | 2014-11-25 | 2019-04-09 | Sap Se | Versioned insert only hash table for in-memory columnar stores |
CN106294402A (en) * | 2015-05-21 | 2017-01-04 | 阿里巴巴集团控股有限公司 | The data search method of a kind of heterogeneous data source and device thereof |
-
2018
- 2018-10-31 CN CN201811288856.8A patent/CN109558423A/en active Pending
-
2019
- 2019-01-30 WO PCT/CN2019/073952 patent/WO2020087796A1/en active Application Filing
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102402394A (en) * | 2010-09-13 | 2012-04-04 | 腾讯科技(深圳)有限公司 | Hash algorithm-based data storage method and device |
CN102194002A (en) * | 2011-05-25 | 2011-09-21 | 中兴通讯股份有限公司 | Table entry adding, deleting and searching method of hash table and hash table storage device |
WO2012163091A1 (en) * | 2011-06-02 | 2012-12-06 | 中兴通讯股份有限公司 | Data location, reorganization method and device |
WO2016184029A1 (en) * | 2015-05-18 | 2016-11-24 | 深圳市中兴微电子技术有限公司 | Storage and lookup methods and apparatuses supporting hash lookup and routing lookup, and storage medium |
WO2018099107A1 (en) * | 2016-12-02 | 2018-06-07 | 深圳市中兴微电子技术有限公司 | Hash table management method and device, and computer storage medium |
CN108681577A (en) * | 2018-05-08 | 2018-10-19 | 亳州中药材商品交易中心有限公司 | A kind of novel library structure data index method |
Non-Patent Citations (1)
Title |
---|
刘舱强;邓昌胜;余谅;: "基于哈希表的最长前缀匹配算法改进", 微计算机信息, no. 30 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111582991A (en) * | 2020-05-13 | 2020-08-25 | 中国银行股份有限公司 | Product information recommendation method and device |
CN111582991B (en) * | 2020-05-13 | 2023-09-01 | 中国银行股份有限公司 | Product information recommendation method and device |
CN112685612A (en) * | 2020-12-31 | 2021-04-20 | 武汉思普崚技术有限公司 | Feature code searching and matching method, device and storage medium |
CN112905982A (en) * | 2021-01-19 | 2021-06-04 | 青岛至心传媒有限公司 | Internet-based E-commerce platform intrusion detection method and monitoring system |
Also Published As
Publication number | Publication date |
---|---|
WO2020087796A1 (en) | 2020-05-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11093543B2 (en) | Masking restrictive access control system | |
CN111859470B (en) | Business data chaining method and device | |
CN109558423A (en) | A kind of data search method based on key-value pair, device and equipment | |
CN104657396A (en) | Data migration method and device | |
CN108563958A (en) | Role-security update method, device, computer equipment and storage medium | |
CN109981322A (en) | The method and apparatus of cloud resource management based on label | |
CN105721629A (en) | User identifier matching method and device | |
CN107240029A (en) | A kind of data processing method and device | |
CN107465687A (en) | A kind of implementation method of authority configuration, device and terminal | |
CN107800781A (en) | A kind of configuration data processing method and device | |
CN111177481B (en) | User identifier mapping method and device | |
CN108733802A (en) | Identification code generates and analytic method, device, storage medium and electronic equipment | |
CN108154024A (en) | A kind of data retrieval method, device and electronic equipment | |
CN110874365B (en) | Information query method and related equipment thereof | |
CN111045928A (en) | Interface data testing method, device, terminal and storage medium | |
CN108537057A (en) | Method and apparatus for handling photograph album browse request | |
CN113238999A (en) | Data sharing method and device, electronic equipment and computer readable storage medium | |
CN111225005B (en) | Push content generation method and device, electronic equipment and computer storage medium | |
CN109547317B (en) | Method and device for establishing connection tunnel | |
CN112948593A (en) | Knowledge graph generation method, device, equipment and medium | |
CN107545004A (en) | The method, apparatus and search engine system of a kind of search | |
CN113051418A (en) | Image source tracking method and device, storage medium and electronic equipment | |
CN111181903A (en) | Information acquisition method and apparatus, storage medium, and electronic apparatus | |
JP2020091594A (en) | Design information retrieval device, design information retrieval method and program | |
CN107908434A (en) | The method for customizing and device of web application items based on multi-tenant |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
REG | Reference to a national code |
Ref country code: HK Ref legal event code: DE Ref document number: 40002531 Country of ref document: HK |
|
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |