CN106919682A - A kind of search associational word implementation method based on redis technologies - Google Patents

A kind of search associational word implementation method based on redis technologies Download PDF

Info

Publication number
CN106919682A
CN106919682A CN201710118409.7A CN201710118409A CN106919682A CN 106919682 A CN106919682 A CN 106919682A CN 201710118409 A CN201710118409 A CN 201710118409A CN 106919682 A CN106919682 A CN 106919682A
Authority
CN
China
Prior art keywords
search
keyword
index
word
associational word
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
Application number
CN201710118409.7A
Other languages
Chinese (zh)
Inventor
王清霞
刘宁
周国辉
姜林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Plastic Technology Co Ltd
Original Assignee
Beijing Plastic Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Plastic Technology Co Ltd filed Critical Beijing Plastic Technology Co Ltd
Priority to CN201710118409.7A priority Critical patent/CN106919682A/en
Publication of CN106919682A publication Critical patent/CN106919682A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/951Indexing; Web crawling techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/02Input arrangements using manually operated switches, e.g. using keyboards or dials
    • G06F3/023Arrangements for converting discrete items of information into a coded form, e.g. arrangements for interpreting keyboard generated codes as alphanumeric codes, operand codes or instruction codes
    • G06F3/0233Character input methods
    • G06F3/0237Character input methods using prediction or retrieval techniques

Abstract

The invention discloses a kind of search associational word implementation method based on redis technologies, the method mainly includes:Search keyword pretreatment, establishment index, setting search intention weight, the displaying of associational word result.Wherein described establishment index predominantly points to the index of search intention, creates the index that keyword prefix points to keyword using solrJ establishment keywords.According to embodiments of the present invention, can be when user scans for, by analyzing the character string of user input, Dynamic recommendation keyword so that user quickly finds required keyword, so as to improve Consumer's Experience.

Description

A kind of search associational word implementation method based on redis technologies
Technical field
The present invention relates to Computer Applied Technology field, more particularly to a kind of search associational word reality based on redis technologies Existing method.
Background technology
At present, for a website, either portal website or electric business website, search box suffers from important Status, its presence be in order to allow user faster, the more easily desired thing of removal search oneself.
Search associational word is widely used in major doors and electric business website, searches for intelligent prompt function, can be with User is helped to find what oneself was wanted as early as possible.When user input want search initial character or wherein by comprising character when, search Rope combobox just occurs the entry for being available for user to select, and user can select entry therein to complete this time search, it is to avoid The whole character of user input, improves Consumer's Experience.
Search associational word function has by analyzing user inputs character string, Dynamic recommendation keyword in personalized search Critically important effect.
Existing search associational word functional realiey, such as, like " % keywords % " in database is realized, but only Entry comprising keyword can just hit, if a middle plus space, this method is just helpless, and if it is desired to life Middle result carries out relevancy ranking, and this method cannot also be realized.
Therefore, for existing method Shortcomings, the present invention proposes that a kind of search associational word based on redis technologies is realized Method, enables to user to be quickly found out search keyword, can more meet the demand of user.
The content of the invention
In view of this, it is a primary object of the present invention to provide a kind of method of the search associational word based on redis technologies, During user input search keyword, system provides the recommended keywords of search.
To reach above-mentioned purpose, the technical proposal of the invention is realized in this way:
A, search keyword pretreatment;
B, establishment index;
C, setting search intention weight;
The displaying of D, associational word.
Wherein described processing of step A process is:It is divided into following several situations, word for the association of a search keyword Related, complete input, phonetic, initial, word prefix.Judge whether keyword is empty, if length is 1, if also special Different character, if contain space.
Wherein described step B mainly includes following two flows:
B1, the index that keyword sensing search intention is created using solrJ
Segmenter first is used to search keyword(Such as, IKAnalyzer segmenter)Word segmentation processing is carried out, Redis is added to orderly Set (sorted set), it should be noted that:When being added in Redis, the value of score is set to 0, and these characters will According to sequencing sequence naturally.
In addition, search associational word function, requirement of real-time is higher, it is necessary to continually requested database, the present invention Can memory database redis high and fireballing store.Redis employed in it is KV type databases, and inquiry is all Based on key, key values must have uniqueness.
B2, the index that keyword prefix sensing keyword is created using solrJ
The index of the various prefixes of search keyword is created, this keyword is found by the input of user first, and then pass through Keyword finds search intention, so needing to set up word prefix and phonetic prefix to an index of keyword.Wherein institute The phonetic prefix stated is changed using pinyin4j, and keyword possesses how many prefix, will set up how many ordered sets Key, in store value set in each key.
Wherein described step C primary operationals are as follows:
Redis ordered sets are used when creating index, what the set corresponding to so each key was ordered, and often Value in one set has score values, i.e., sorted by score.
Further, wherein step D operations are as follows:When search, matching is gone in the input according to user to user Keyword more than searching times, shows TopN associational word.Mainly realized by two methods:
D1, one getSuggestProductName (SolrQuery params, String sellerCode) method of establishment, The method association is trade name, is not single word, finally returns to a List<String>Association's word list, wherein institute The params for stating is the search |input paramete of user, and sellerCode is index database burst.
D2, establishment one getSuggestLxc (SolrQuery params, String sellerCode) method, the party Method can according to phonetic, first letter of pinyin associate, association out be phrase, be no longer trade name, finally return to a List< String>Association's word list, wherein search |input parametes of the described params for user, sellerCode is index database point Piece.
The method of search associational word provided by the present invention, with advantages below:
1)User when scanning for, by analyzing the character string of user input, Dynamic recommendation keyword so that user is faster Find required keyword;
2)User can select entry therein to complete this time search, it is to avoid the whole character of user input, improve use Experience at family.
Brief description of the drawings
Fig. 1 is the schematic flow sheet of search associational word implementation method of the present invention based on redis technologies;
Fig. 2 is the application scenarios schematic diagram of search associational word implementation method of the present invention based on redis technologies;
Fig. 3 is association's result displaying schematic diagram of search associational word implementation method of the present invention based on redis technologies.
Specific embodiment
It is below in conjunction with the accompanying drawings and of the invention to enable the above objects, features and advantages of the present invention more obvious understandable Embodiment the search associational word implementation method based on redis technologies of the invention is described in further detail.
During user input is searched for, system provides the recommended keywords of search, and the mode of realization passes through redis 5 kinds of data structures in ordered set(zset).These heat are searched during word deposits into Redis.Exactly the instruction to be operated is deposited It is put into a queue, finally this queue is thrown away to service end and goes to perform, is thus effectively reduced unnecessary network Transmission, while also improving execution speed.
With reference to Fig. 2, the method for the search associational word, specifically comprising following flow:
Step 201:Search associational word pretreatment;Judge whether keyword is empty, if length is 1, if also spcial character, Whether space is contained.
Step 202:First each word is splitted out, in depositing into redis;Segmenter is used to search keyword(Such as, IKAnalyzer segmenter)Word segmentation processing is carried out, Redis ordered sets (sorted set) are added to, notes being added to redis When score be both configured to 0, these characters will be according to sequencing sequence naturally.
Step 203:Create the index that keyword points to search intention;The index of the various prefixes of search keyword is created, it is first First pass through the input of user to find this keyword, and then search intention is found by keyword, so needing to set up word Prefix and phonetic prefix are indexed to one of keyword.Wherein described phonetic prefix is increased income class libraries using Java(Such as, Pinyin4j technologies)Changed, keyword possesses how many prefix, how many ordered set key will be set up, in each key All in store value set.
Step 204:The weight of search intention is set;Create index when use redis ordered sets, so each What the set corresponding to key was ordered, and each set in value have score values, i.e., arranged by score Sequence.
Step 205:Search associational word displaying;The keyword more than matching searching times, displaying are removed in input according to user TopN associational word.Mainly realized by two methods:If the incoming parameter of user is lxcProductName, step is performed Rapid 206, if the incoming parameter of user is lxc, perform step 207.
Step 206:Create getSuggestProductName (SolrQuery a params, String SellerCode) method, the method association is trade name, is not single word, finally returns to a List<String> Association's word list, wherein search |input parametes of the described params for user, sellerCode is index database burst.
Step 207:Create getSuggestLxc (SolrQuery params, a String sellerCode) side Method, the method can according to phonetic, first letter of pinyin associate, association out be phrase, be no longer trade name, finally return to one Individual List<String>Association's word list, wherein search |input parametes of the described params for user, sellerCode is rope Draw storehouse burst.
It should be noted that:User is clicked on after search, and either new keyword or existing keyword, right first Keyword is pre-processed, and is then processed with zincrby orders in redis, if there is, fraction adds 1, or just creates Build the member that fraction is 1.Limiting user can not search for null key, and the storage of this keyword or fraction are being added one Afterwards, inquired about by solr full-text searches, search associational word result is recommended in preferably displaying.
The present invention mainly employs following technology to solve search association word problem, carries out letter to these technologies below It is single to introduce.
1)Pinyin4j technologies.Pinyin4j is one and supports to increase income the Java that Chinese is transformed into phonetic class libraries, can Its corresponding phonetic is obtained according to Chinese character, and the form of phonetic can be customized.Support simplified form of Chinese Character and Chinese-traditional word Symbol, support is transformed into the Chinese phonetic alphabet, supports polyphone, you can to obtain a various pronunciations for Chinese character, support various words Symbol string output format.The present invention mainly uses pinyin4j technologies when processing user input keyword.
2)Redis technologies.Redis be it is a increase income, high performance key-value storage(key-value store).It is normal It is referred to as a data structure server(data structure server).The key assignments of Redis can include character string (strings)Type, while it also includes Hash(hashes), list(lists), set(sets)And ordered set (sorted sets)Etc. data type.For these data types, atomic operation can be performed.Redis is employed in internal memory (in-memory)Data set(dataset)Mode.Meanwhile, Redis supports the persistence of data, and you can be when one sections Between data set is dumped on disk(snapshot), or add each operational order in daily record afterbody(append only file,aof).The main ordered set used in 5 kinds of data structures of the invention, the member of each ordered set associates One scoring, this scores for the member in ordered set to be arranged by minimum best result of assigning to, and is used primarily in search association Word memory module.
3)IKAanlyzer participle techniques.The present invention is mainly used when user input keyword is pre-processed IKAanlyzer participle techniques.
4)SolrJ technologies.SolrJ is the Java client of solr, for accessing solr index databases.It provide addition, The functions such as deletion, inquiry, optimization.The present invention creates index to operate index database using solrJ.
With reference to Fig. 1, search associational word embodiment of the invention is as follows.
The several typical application scenarios of the method are described below:
Application scenarios one:
Present invention search associational word method is applied and shows page, user's search steel scrap in certain waste plastic regeneration website homepage search box Iron, when input " useless " word, combobox can represent search association word list, as shown in Figure 3.
Application scenarios two:
Search associational word implementation method based on redis technologies of the invention, user in search commercial articles, when user input " modeling " is closed When key word, search frame system provides drop-down list, for the keyword required for user's selection.System dynamically provides association Word result:
{"resultCode":1,"resultMessage":"","params":{"keyWord":"","num":10},
"associateKeyword":[{"keyWord":" plastics " }, { " keyWord ":" plastic-steel door and window " },
{"keyWord":" plastic floor " }, { " keyWord ":" plastic cement " }, { " keyWord ":" plastic material " },
{"keyWord":" plastic-steel " }, { " keyWord ":" plastic-steel section bar ", }, { " keyWord ":" plastic cement race track " },
{"keyWord":" molding powder " }, { " keyWord ":" plastic pipe " }, { " keyWord ":" plastic sheeting " }] }
The above, only presently preferred embodiments of the present invention is not intended to limit the scope of the present invention.
The technical staff in the field can be understood that, for convenience of description and succinctly, foregoing description is The specific work process of system, device and unit, may be referred to the corresponding process in preceding method embodiment, will not be repeated here.
In several embodiments provided by the present invention, it should be understood that disclosed system, apparatus and method, can be with Realize by another way.For example, it is described above to device embodiment be only schematical, for example, the unit Division, only a kind of division of logic function can have other dividing mode when actually realizing, such as multiple units or group Part can be combined or be desirably integrated into another system, or some features can be ignored, or not performed.It is another, it is shown or The coupling each other for discussing or direct-coupling or communication connection can be the indirect couplings of device or unit by some interfaces Close or communicate to connect, can be electrical, mechanical or other forms.
The unit as separating component explanation can be or can also be physically separate, be shown as unit Part can be or may not be physical location, you can with positioned at a place, or multiple nets can also be distributed to On network unit.Some or all of unit therein can be according to the actual needs selected to realize the mesh of this embodiment scheme 's.
In addition, during each functional unit in each embodiment of the invention can be integrated in a processing unit, it is also possible to It is that unit is individually physically present, it is also possible to which two or more units are integrated in a unit.Above-mentioned integrated list Unit can both be realized in the form of hardware, can be realized in the form of SFU software functional unit.
It should be noted that one of ordinary skill in the art will appreciate that whole or portion in realizing above-described embodiment method Split flow, can be by computer program to instruct the hardware of correlation to complete, and described program can be stored in a computer In read/write memory medium, the program is upon execution, it may include such as the flow of the embodiment of above-mentioned each method.Wherein, it is described Storage medium can be magnetic disc, CD, read-only memory(Read-Only Memory, ROM)Or random access memory (Random Access Memory, RAM)Deng.
The search associational word implementation method based on redis technologies provided by the present invention is described in detail above, Specific embodiment used herein is set forth to principle of the invention and implementation method, and the explanation of above example is It is used to help understand the method for the present invention and its core concept;Simultaneously for those of ordinary skill in the art, according to the present invention Thought, will change in specific embodiments and applications, in sum, this specification content should not be understood It is limitation of the present invention.

Claims (7)

1. it is a kind of based on redis technologies search associational word implementation method, it is characterised in that the method mainly includes:
A, search keyword pretreatment;
B, establishment index;
C, setting search intention weight;
D, the displaying of associational word result.
2. it is according to claim 1 based on redis technologies search associational word implementation method, it is characterised in that it is described Step A, specially:Judge whether keyword is empty, if length is 1, if also spcial character, if contain space.
3. it is according to claim 1 based on redis technologies search associational word implementation method, it is characterised in that it is described Step B, specifically includes:
B1, the index that keyword sensing search intention is created using solrJ;
B2, the index that keyword prefix sensing keyword is created using solrJ.
4. it is according to claim 1 based on redis technologies search associational word implementation method, it is characterised in that it is described Step C, specially:Redis ordered sets are used when creating index, so set corresponding to each key is ordered , and each set in value have score values, i.e., sorted by score.
5. it is according to claim 1 based on redis technologies search associational word implementation method, it is characterised in that it is described Step D, specially:The displaying of associational word result mainly includes:Association goes out commodity word, association and goes out trade name.
6. associational word result displaying according to claim 5, it is characterised in that described step D mainly includes two kinds of sides Method, specially:
D1, one getSuggestProductName (SolrQuery params, String sellerCode) method of establishment, The method association is trade name, is not single word, finally returns to a List<String>Association's word list, wherein institute The params for stating is the search |input paramete of user, and sellerCode is index database burst;
D2, one getSuggestLxc (SolrQuery params, String sellerCode) method of establishment, the method can According to phonetic, first letter of pinyin associate, association out be phrase, be no longer trade name, finally return to a List< String>Association's word list, wherein search |input parametes of the described params for user, sellerCode is index database point Piece.
7. associational word result displaying according to claim 6, it is characterised in that also include before described step D:It is right User input parameter SolrQuery is packaged, and field must be index in wherein bf, use the formula for setting SolrQuery.set (" bf ", " abs (i1) ^40 ") is operated come the score to associational word.
CN201710118409.7A 2017-03-01 2017-03-01 A kind of search associational word implementation method based on redis technologies Pending CN106919682A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710118409.7A CN106919682A (en) 2017-03-01 2017-03-01 A kind of search associational word implementation method based on redis technologies

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710118409.7A CN106919682A (en) 2017-03-01 2017-03-01 A kind of search associational word implementation method based on redis technologies

Publications (1)

Publication Number Publication Date
CN106919682A true CN106919682A (en) 2017-07-04

Family

ID=59454402

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710118409.7A Pending CN106919682A (en) 2017-03-01 2017-03-01 A kind of search associational word implementation method based on redis technologies

Country Status (1)

Country Link
CN (1) CN106919682A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107870679A (en) * 2017-10-11 2018-04-03 北京京东尚科信息技术有限公司 Multitone word processing method and system
CN108062373A (en) * 2017-12-12 2018-05-22 焦点科技股份有限公司 A kind of method of the keyword drop-down association with error correction
CN108446316A (en) * 2018-02-07 2018-08-24 北京三快在线科技有限公司 Recommendation method, apparatus, electronic equipment and the storage medium of associational word
CN108920507A (en) * 2018-05-29 2018-11-30 宇龙计算机通信科技(深圳)有限公司 Automatic search method, device, terminal and computer readable storage medium
CN109582847A (en) * 2018-11-23 2019-04-05 咪咕视讯科技有限公司 A kind of information processing method and device, storage medium
CN109871380A (en) * 2019-01-14 2019-06-11 深圳市东信时代信息技术有限公司 A kind of crowd's packet application method and system based on Redis
CN111653328A (en) * 2020-06-04 2020-09-11 医渡云(北京)技术有限公司 Medical record information pushing method and device, storage medium and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102479230A (en) * 2010-11-29 2012-05-30 北京四维图新科技股份有限公司 Method and device for extracting geographical feature words
US20140019482A1 (en) * 2012-07-11 2014-01-16 Electronics And Telecommunications Research Institute Apparatus and method for searching for personalized content based on user's comment
CN106202294A (en) * 2016-07-01 2016-12-07 北京奇虎科技有限公司 The related news computational methods merged based on key word and topic model and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102479230A (en) * 2010-11-29 2012-05-30 北京四维图新科技股份有限公司 Method and device for extracting geographical feature words
US20140019482A1 (en) * 2012-07-11 2014-01-16 Electronics And Telecommunications Research Institute Apparatus and method for searching for personalized content based on user's comment
CN106202294A (en) * 2016-07-01 2016-12-07 北京奇虎科技有限公司 The related news computational methods merged based on key word and topic model and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
HUI_JING_880210: "solr高效自动联想方法", 《HTTPS://WWW.ITEYE.COM/BLOG/HUI-JING-880210-2172310》 *
JICKY-17: "solr5使用suggest模块实现搜索联想", 《HTTPS://BLOG.CSDN.NET/U014527058/ARTICLE/DETAILS/54924963》 *

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107870679A (en) * 2017-10-11 2018-04-03 北京京东尚科信息技术有限公司 Multitone word processing method and system
CN107870679B (en) * 2017-10-11 2021-11-09 北京京东尚科信息技术有限公司 Polyphone processing method and system
CN108062373A (en) * 2017-12-12 2018-05-22 焦点科技股份有限公司 A kind of method of the keyword drop-down association with error correction
CN108446316A (en) * 2018-02-07 2018-08-24 北京三快在线科技有限公司 Recommendation method, apparatus, electronic equipment and the storage medium of associational word
CN108920507A (en) * 2018-05-29 2018-11-30 宇龙计算机通信科技(深圳)有限公司 Automatic search method, device, terminal and computer readable storage medium
CN109582847A (en) * 2018-11-23 2019-04-05 咪咕视讯科技有限公司 A kind of information processing method and device, storage medium
CN109582847B (en) * 2018-11-23 2021-08-24 咪咕视讯科技有限公司 Information processing method and device and storage medium
CN109871380A (en) * 2019-01-14 2019-06-11 深圳市东信时代信息技术有限公司 A kind of crowd's packet application method and system based on Redis
CN109871380B (en) * 2019-01-14 2022-11-11 深圳市东信时代信息技术有限公司 Crowd pack application method and system based on Redis
CN111653328A (en) * 2020-06-04 2020-09-11 医渡云(北京)技术有限公司 Medical record information pushing method and device, storage medium and electronic equipment
CN111653328B (en) * 2020-06-04 2023-03-21 医渡云(北京)技术有限公司 Medical record information pushing method and device, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
CN106919682A (en) A kind of search associational word implementation method based on redis technologies
KR101190230B1 (en) Phrase identification in an information retrieval system
US9928296B2 (en) Search lexicon expansion
US9619571B2 (en) Method for searching related entities through entity co-occurrence
US20150220547A1 (en) Suggesting and refining user input based on original user input
US8296279B1 (en) Identifying results through substring searching
EP2798540A1 (en) Extracting search-focused key n-grams and/or phrases for relevance rankings in searches
US9465862B2 (en) Methods, systems, and computer program products for integrated world wide web query classification
WO2007016133A2 (en) Processor for fast contextual matching
WO2010014082A1 (en) Method and apparatus for relating datasets by using semantic vectors and keyword analyses
US20110264997A1 (en) Scalable Incremental Semantic Entity and Relatedness Extraction from Unstructured Text
CN108875065B (en) Indonesia news webpage recommendation method based on content
KR100847376B1 (en) Method and apparatus for searching information using automatic query creation
CN105912662A (en) Coreseek-based vertical search engine research and optimization method
CN105404677B (en) A kind of search method based on tree structure
WO2015084757A1 (en) Systems and methods for processing data stored in a database
CN102915381B (en) Visual network retrieval based on multi-dimensional semantic presents system and presents control method
WO2012091541A1 (en) A semantic web constructor system and a method thereof
US20170124090A1 (en) Method of discovering and exploring feature knowledge
US20160085760A1 (en) Method for in-loop human validation of disambiguated features
Xu et al. Top-k string auto-completion with synonyms
CN103164491B (en) The method and apparatus of a kind of data processing and retrieval
Goyal et al. Concept based query recommendation
Bhatia et al. Context sensitive entity linking of search queries in enterprise knowledge graphs
JP2012104051A (en) Document index creating device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20170704

WD01 Invention patent application deemed withdrawn after publication