CN115114504A - A data search method and device - Google Patents
A data search method and device Download PDFInfo
- Publication number
- CN115114504A CN115114504A CN202110304731.5A CN202110304731A CN115114504A CN 115114504 A CN115114504 A CN 115114504A CN 202110304731 A CN202110304731 A CN 202110304731A CN 115114504 A CN115114504 A CN 115114504A
- Authority
- CN
- China
- Prior art keywords
- search
- search keyword
- predicted
- keyword
- data
- 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
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/953—Querying, e.g. by the use of web search engines
- G06F16/9532—Query formulation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/953—Querying, e.g. by the use of web search engines
- G06F16/9535—Search customisation based on user profiles and personalisation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/953—Querying, e.g. by the use of web search engines
- G06F16/9538—Presentation of query results
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本发明实施例公开的数据搜索方法包括:响应于在输入目标搜索关键词的过程中的片段输入操作,获取第一搜索关键词片段;将第一搜索关键词片段发送至服务器;响应于目标搜索关键词的输入操作获取目标搜索关键词,并将目标搜索关键词发送至服务器;接收并显示服务器发送的搜索数据,搜索数据为服务器通过在服务器的存储器中查找与目标第一预测搜索关键词对应的搜索数据得到的;目标第一预测搜索关键词对应的搜索数据,是服务器基于第一预测搜索关键词进行数据搜索得到的;第一预测搜索关键词是服务器基于第一搜索关键词片段进行预测得到的,且第一预测搜索关键词包括第一搜索关键词片段,提升了数据搜索的搜索速率。
The data search method disclosed in the embodiment of the present invention includes: in response to a segment input operation in the process of inputting a target search keyword, obtaining a first search keyword segment; sending the first search keyword segment to a server; in response to the target search The input operation of the keyword obtains the target search keyword, and sends the target search keyword to the server; receives and displays the search data sent by the server, the search data is that the server searches the memory of the server and corresponds to the target first predicted search keyword The search data corresponding to the target first predicted search keyword is obtained by the server performing data search based on the first predicted search keyword; the first predicted search keyword is predicted by the server based on the first search keyword segment obtained, and the first predicted search keyword includes the first search keyword segment, which improves the search rate of data search.
Description
技术领域technical field
本申请涉及计算机技术领域,尤其涉及一种数据搜索方法及装置。The present application relates to the field of computer technology, and in particular, to a data search method and device.
背景技术Background technique
随着计算机技术的蓬勃发展,人们足不出户便可获取全球各地信息。近年来,人们的需求也从“足不出户获取信息”变成了“足不出户,且快速地获取信息”。然而,传统的数据搜索方式,通常是在用户完成目标搜索关键词的完整输入并触发搜索按钮之后,才由客户端将该目标搜索关键词发送至服务器,服务器在基于目标搜索关键词完成数据搜索之后,可以将搜索到的搜索数据发送给客户端,以便客户端显示该搜索数据,导致搜索数据的搜索时间段较长。因此,如何提高数据搜索的搜索速率成了当下研究的热点话题。With the rapid development of computer technology, people can obtain information from all over the world without leaving home. In recent years, people's needs have also changed from "getting information without leaving home" to "getting information quickly without leaving home". However, in the traditional data search method, the client sends the target search keyword to the server usually after the user completes the input of the target search keyword and triggers the search button, and the server completes the data search based on the target search keyword. Afterwards, the searched search data can be sent to the client so that the client can display the searched data, resulting in a longer search time period for the searched data. Therefore, how to improve the search rate of data search has become a hot topic of current research.
发明内容SUMMARY OF THE INVENTION
本发明实施例提供了一种数据搜索方法及装置,可提高数据搜索的搜索速率。Embodiments of the present invention provide a data search method and device, which can improve the search rate of data search.
一方面,本发明实施例提供了一种数据搜索方法,包括:On the one hand, an embodiment of the present invention provides a data search method, including:
响应于在输入目标搜索关键词的过程中的片段输入操作,获取第一搜索关键词片段,其中,所述目标搜索关键词包括所述第一搜索关键词片段;In response to a fragment input operation in the process of inputting the target search keyword, a first search keyword fragment is obtained, wherein the target search keyword includes the first search keyword fragment;
将所述第一搜索关键词片段发送至服务器;sending the first search keyword segment to a server;
响应于所述目标搜索关键词的输入操作,获取所述目标搜索关键词,并将所述目标搜索关键词发送至所述服务器;In response to an input operation of the target search keyword, acquiring the target search keyword, and sending the target search keyword to the server;
接收并显示所述服务器发送的所述搜索数据,所述搜索数据为所述服务器通过在服务器的存储器中查找与目标第一预测搜索关键词对应的搜索数据得到的;所述目标第一预测搜索关键词对应的搜索数据,是所述服务器基于第一预测搜索关键词进行数据搜索得到的,且所述目标第一预测搜索关键词对应的搜索数据和所述第一预测搜索关键词对应存储在所述服务器的存储器中;所述目标第一预测搜索关键词为所述服务器的存储器中与所述目标搜索关键词相同的第一预测搜索关键词;所述第一预测搜索关键词是服务器基于第一搜索关键词片段进行预测得到的,且所述第一预测搜索关键词包括所述第一搜索关键词片段;所述第一搜索关键词片段位于所述第一预测搜索关键词中除所述第一搜索关键词片段以外的字符的前面。Receive and display the search data sent by the server, where the search data is obtained by the server by looking up the search data corresponding to the target first predicted search keyword in the memory of the server; the target first predicted search The search data corresponding to the keyword is obtained by the server performing data search based on the first predicted search keyword, and the search data corresponding to the target first predicted search keyword and the first predicted search keyword are stored correspondingly in the in the memory of the server; the target first predicted search keyword is the same first predicted search keyword as the target search keyword in the server's memory; the first predicted search keyword is the server based on The first search keyword segment is predicted, and the first predicted search keyword includes the first search keyword segment; the first search keyword segment is located in the first predicted search keyword except for before the characters other than the first search keyword segment.
一方面,本发明实施例提供了另一种数据搜索方法,包括:On the one hand, an embodiment of the present invention provides another data search method, including:
接收客户端发送的第一搜索关键词片段,并基于所述第一搜索关键词片段进行预测,得到第一预测搜索关键词,所述第一预测搜索关键词包括所述第一搜索关键词片段,且所述第一搜索关键词片段位于所述第一预测搜索关键词中除所述第一搜索关键词片段以外的字符的前面;Receive the first search keyword segment sent by the client, and perform prediction based on the first search keyword segment to obtain a first predicted search keyword, where the first predicted search keyword includes the first search keyword segment , and the first search keyword segment is located in front of the characters other than the first search keyword segment in the first predicted search keyword;
根据所述第一预测搜索关键词进行数据搜索,得到搜索数据,并将所述搜索数据和所述第一预测搜索关键词对应存储至所述服务器的存储器中;Perform data search according to the first predicted search keyword to obtain search data, and store the search data and the first predicted search keyword in the memory of the server correspondingly;
接收所述客户端发送的目标搜索关键词,所述目标搜索关键词是所述客户端响应于所述目标搜索关键词的输入操作获取到的,所述目标搜索关键词包括所述第一搜索关键词片段;Receive a target search keyword sent by the client, where the target search keyword is obtained by the client in response to an input operation of the target search keyword, and the target search keyword includes the first search keyword Keyword Fragments;
若所述服务器的存储器中存在与所述目标搜索关键词相同的目标第一预测搜索关键词,则从所述服务器的存储器中查找与所述目标第一预测搜索关键词对应的搜索数据,并将所述与所述目标第一预测搜索关键词对应的搜索数据发送至所述客户端。If there is a target first predicted search keyword that is the same as the target search keyword in the memory of the server, search for the search data corresponding to the target first predicted search keyword from the memory of the server, and Sending the search data corresponding to the target first predicted search keyword to the client.
一方面,本发明实施例提供了一种数据搜索装置,包括:On the one hand, an embodiment of the present invention provides a data search device, including:
获取单元,用于响应于在输入目标搜索关键词的过程中的片段输入操作,获取第一搜索关键词片段,其中,所述目标搜索关键词包括所述第一搜索关键词片段;an obtaining unit, configured to obtain a first search keyword fragment in response to a fragment input operation in the process of inputting a target search keyword, wherein the target search keyword includes the first search keyword fragment;
第一发送单元,用于将所述第一搜索关键词片段发送至服务器;a first sending unit, configured to send the first search keyword segment to a server;
所述获取单元,还用于响应于所述目标搜索关键词的输入操作,获取所述目标搜索关键词,并将所述目标搜索关键词发送至所述服务器;The obtaining unit is further configured to obtain the target search keyword in response to an input operation of the target search keyword, and send the target search keyword to the server;
第一接收单元,用于接收并显示所述服务器发送的所述搜索数据,所述搜索数据为所述服务器通过在服务器的存储器中查找与目标第一预测搜索关键词对应的搜索数据得到的;所述目标第一预测搜索关键词对应的搜索数据,是所述服务器基于第一预测搜索关键词进行数据搜索得到的,且所述目标第一预测搜索关键词对应的搜索数据和所述第一预测搜索关键词对应存储在所述服务器的存储器中;所述目标第一预测搜索关键词为所述服务器的存储器中与所述目标搜索关键词相同的第一预测搜索关键词;所述第一预测搜索关键词是服务器基于第一搜索关键词片段进行预测得到的,且所述第一预测搜索关键词包括所述第一搜索关键词片段;所述第一搜索关键词片段位于所述第一预测搜索关键词中除所述第一搜索关键词片段以外的字符的前面。a first receiving unit, configured to receive and display the search data sent by the server, where the search data is obtained by the server by searching for search data corresponding to the target first predicted search keyword in the memory of the server; The search data corresponding to the target first predicted search keyword is obtained by the server performing a data search based on the first predicted search keyword, and the search data corresponding to the target first predicted search keyword is the same as the first predicted search keyword. The predicted search keyword is correspondingly stored in the memory of the server; the target first predicted search keyword is the same first predicted search keyword as the target search keyword in the memory of the server; the first predicted search keyword is the same as the target search keyword. The predicted search keyword is predicted by the server based on the first search keyword segment, and the first predicted search keyword includes the first search keyword segment; the first search keyword segment is located in the first search keyword segment. Predicting the front of characters in the search keyword other than the first search keyword segment.
一方面,本发明实施例提供了又一种数据搜索装置,包括:On the one hand, an embodiment of the present invention provides another data search apparatus, including:
第二接收单元,用于接收客户端发送的第一搜索关键词片段;a second receiving unit, configured to receive the first search keyword segment sent by the client;
处理单元,用于基于所述第一搜索关键词片段进行预测,得到第一预测搜索关键词,所述第一预测搜索关键词包括所述第一搜索关键词片段,且所述第一搜索关键词片段位于所述第一预测搜索关键词中除所述第一搜索关键词片段以外的字符的前面;A processing unit, configured to perform prediction based on the first search keyword segment to obtain a first predicted search keyword, where the first predicted search keyword includes the first search keyword segment, and the first search key The word fragment is located in front of the characters other than the first search keyword fragment in the first predicted search keyword;
所述处理单元,还用于根据所述第一预测搜索关键词进行数据搜索,得到搜索数据,并将所述搜索数据和所述第一预测搜索关键词对应存储至所述服务器的存储器中;The processing unit is further configured to perform data search according to the first predicted search keyword, obtain search data, and store the search data and the first predicted search keyword in the memory of the server correspondingly;
所述第二接收单元,还用于接收所述客户端发送的目标搜索关键词,所述目标搜索关键词是所述客户端响应于所述目标搜索关键词的输入操作获取到的,所述目标搜索关键词包括所述第一搜索关键词片段;The second receiving unit is further configured to receive a target search keyword sent by the client, where the target search keyword is obtained by the client in response to an input operation of the target search keyword, the The target search keyword includes the first search keyword segment;
第二发送单元,用于在所述服务器的存储器中存在与所述目标搜索关键词相同的目标第一预测搜索关键词时,从所述服务器的存储器中查找与所述目标第一预测搜索关键词对应的搜索数据,并将所述与所述目标第一预测搜索关键词对应的搜索数据发送至所述客户端。A second sending unit, configured to search the memory of the server for the target first predicted search key that is the same as the target first predicted search keyword when there is a target first predicted search keyword that is the same as the target search keyword in the memory of the server search data corresponding to the word, and send the search data corresponding to the target first predicted search keyword to the client.
一方面,本发明实施例提供了一种终端,包括:On the one hand, an embodiment of the present invention provides a terminal, including:
处理器,适于实现一条或多条计算机程序;a processor, adapted to implement one or more computer programs;
计算机存储介质,所述计算机存储介质存储有一条或多条计算机程序,所述一条或多条计算机程序适于由所述处理器加载并执行:A computer storage medium storing one or more computer programs adapted to be loaded and executed by the processor:
响应于在输入目标搜索关键词的过程中的片段输入操作,获取第一搜索关键词片段,其中,所述目标搜索关键词包括所述第一搜索关键词片段;将所述第一搜索关键词片段发送至服务器;响应于所述目标搜索关键词的输入操作,获取所述目标搜索关键词,并将所述目标搜索关键词发送至所述服务器;接收并显示所述服务器发送的所述搜索数据,所述搜索数据为所述服务器通过在服务器的存储器中查找与目标第一预测搜索关键词对应的搜索数据得到的;所述目标第一预测搜索关键词对应的搜索数据,是所述服务器基于第一预测搜索关键词进行数据搜索得到的,且所述目标第一预测搜索关键词对应的搜索数据和所述第一预测搜索关键词对应存储在所述服务器的存储器中;所述目标第一预测搜索关键词为所述服务器的存储器中与所述目标搜索关键词相同的第一预测搜索关键词;所述第一预测搜索关键词是服务器基于第一搜索关键词片段进行预测得到的,且所述第一预测搜索关键词包括所述第一搜索关键词片段;所述第一搜索关键词片段位于所述第一预测搜索关键词中除所述第一搜索关键词片段以外的字符的前面。In response to a fragment input operation in the process of inputting the target search keyword, a first search keyword fragment is obtained, wherein the target search keyword includes the first search keyword fragment; The segment is sent to the server; in response to the input operation of the target search keyword, the target search keyword is acquired, and the target search keyword is sent to the server; the search sent by the server is received and displayed data, the search data is obtained by the server by looking up the search data corresponding to the target first predicted search keyword in the memory of the server; the search data corresponding to the target first predicted search keyword is the server The search data corresponding to the target first predicted search keyword and the first predicted search keyword are correspondingly stored in the memory of the server, obtained by performing data search based on the first predicted search keyword; A predicted search keyword is the first predicted search keyword in the memory of the server that is the same as the target search keyword; the first predicted search keyword is predicted by the server based on the first search keyword segment, And the first predicted search keyword includes the first search keyword segment; the first search keyword segment is located in the first predicted search keyword except for the first search keyword segment. Front.
一方面,本发明实施例提供了一种服务器,包括:On the one hand, an embodiment of the present invention provides a server, including:
处理器,适于实现一条或多条计算机程序;a processor, adapted to implement one or more computer programs;
计算机存储介质,所述计算机存储介质存储有一条或多条计算机程序,所述一条或多条计算机程序适于由所述处理器加载并执行:A computer storage medium storing one or more computer programs adapted to be loaded and executed by the processor:
接收客户端发送的第一搜索关键词片段,并基于所述第一搜索关键词片段进行预测,得到第一预测搜索关键词,所述第一预测搜索关键词包括所述第一搜索关键词片段,且所述第一搜索关键词片段位于所述第一预测搜索关键词中除所述第一搜索关键词片段以外的字符的前面;根据所述第一预测搜索关键词进行数据搜索,得到搜索数据,并将所述搜索数据和所述第一预测搜索关键词对应存储至所述服务器的存储器中;接收所述客户端发送的目标搜索关键词,所述目标搜索关键词是所述客户端响应于所述目标搜索关键词的输入操作获取到的,所述目标搜索关键词包括所述第一搜索关键词片段;若所述服务器的存储器中存在与所述目标搜索关键词相同的目标第一预测搜索关键词,则从所述服务器的存储器中查找与所述目标第一预测搜索关键词对应的搜索数据,并将所述与所述目标第一预测搜索关键词对应的搜索数据发送至所述客户端。Receive the first search keyword segment sent by the client, and perform prediction based on the first search keyword segment to obtain a first predicted search keyword, where the first predicted search keyword includes the first search keyword segment , and the first search keyword segment is located in front of the characters other than the first search keyword segment in the first predicted search keyword; data search is performed according to the first predicted search keyword, and a search result is obtained. data, and store the search data and the first predicted search keyword in the memory of the server correspondingly; receive the target search keyword sent by the client, and the target search keyword is the client Obtained in response to the input operation of the target search keyword, the target search keyword includes the first search keyword segment; if there is a target first search keyword that is the same as the target search keyword in the memory of the server Once a predicted search keyword is found, the search data corresponding to the target first predicted search keyword is searched from the memory of the server, and the search data corresponding to the target first predicted search keyword is sent to the client.
一方面,本发明实施例提供了一种计算机存储介质,所述计算机存储介质存储有一条或多条计算机程序,所述一条或多条计算机程序适于由所述终端的处理器加载并执行:In one aspect, an embodiment of the present invention provides a computer storage medium, where the computer storage medium stores one or more computer programs, and the one or more computer programs are adapted to be loaded and executed by the processor of the terminal:
响应于在输入目标搜索关键词的过程中的片段输入操作,获取第一搜索关键词片段,其中,所述目标搜索关键词包括所述第一搜索关键词片段;将所述第一搜索关键词片段发送至服务器;响应于所述目标搜索关键词的输入操作,获取所述目标搜索关键词,并将所述目标搜索关键词发送至所述服务器;接收并显示所述服务器发送的所述搜索数据,所述搜索数据为所述服务器通过在服务器的存储器中查找与目标第一预测搜索关键词对应的搜索数据得到的;所述目标第一预测搜索关键词对应的搜索数据,是所述服务器基于第一预测搜索关键词进行数据搜索得到的,且所述目标第一预测搜索关键词对应的搜索数据和所述第一预测搜索关键词对应存储在所述服务器的存储器中;所述目标第一预测搜索关键词为所述服务器的存储器中与所述目标搜索关键词相同的第一预测搜索关键词;所述第一预测搜索关键词是服务器基于第一搜索关键词片段进行预测得到的,且所述第一预测搜索关键词包括所述第一搜索关键词片段;所述第一搜索关键词片段位于所述第一预测搜索关键词中除所述第一搜索关键词片段以外的字符的前面。In response to a fragment input operation in the process of inputting the target search keyword, a first search keyword fragment is obtained, wherein the target search keyword includes the first search keyword fragment; The segment is sent to the server; in response to the input operation of the target search keyword, the target search keyword is acquired, and the target search keyword is sent to the server; the search sent by the server is received and displayed data, the search data is obtained by the server by looking up the search data corresponding to the target first predicted search keyword in the memory of the server; the search data corresponding to the target first predicted search keyword is the server The search data corresponding to the target first predicted search keyword and the first predicted search keyword are correspondingly stored in the memory of the server, obtained by performing data search based on the first predicted search keyword; A predicted search keyword is the first predicted search keyword in the memory of the server that is the same as the target search keyword; the first predicted search keyword is predicted by the server based on the first search keyword segment, And the first predicted search keyword includes the first search keyword segment; the first search keyword segment is located in the first predicted search keyword except for the first search keyword segment. Front.
一方面,本发明实施例提供了又一种计算机存储介质,所述计算机存储介质存储有一条或多条计算机程序,所述一条或多条计算机程序适于由所述服务器的处理器加载并执行:In one aspect, an embodiment of the present invention provides yet another computer storage medium, where the computer storage medium stores one or more computer programs, and the one or more computer programs are adapted to be loaded and executed by the processor of the server :
接收客户端发送的第一搜索关键词片段,并基于所述第一搜索关键词片段进行预测,得到第一预测搜索关键词,所述第一预测搜索关键词包括所述第一搜索关键词片段,且所述第一搜索关键词片段位于所述第一预测搜索关键词中除所述第一搜索关键词片段以外的字符的前面;根据所述第一预测搜索关键词进行数据搜索,得到搜索数据,并将所述搜索数据和所述第一预测搜索关键词对应存储至所述服务器的存储器中;接收所述客户端发送的目标搜索关键词,所述目标搜索关键词是所述客户端响应于所述目标搜索关键词的输入操作获取到的,所述目标搜索关键词包括所述第一搜索关键词片段;若所述服务器的存储器中存在与所述目标搜索关键词相同的目标第一预测搜索关键词,则从所述服务器的存储器中查找与所述目标第一预测搜索关键词对应的搜索数据,并将所述与所述目标第一预测搜索关键词对应的搜索数据发送至所述客户端。Receive the first search keyword segment sent by the client, and perform prediction based on the first search keyword segment to obtain a first predicted search keyword, where the first predicted search keyword includes the first search keyword segment , and the first search keyword segment is located in front of the characters other than the first search keyword segment in the first predicted search keyword; data search is performed according to the first predicted search keyword, and a search result is obtained. data, and store the search data and the first predicted search keyword in the memory of the server correspondingly; receive the target search keyword sent by the client, and the target search keyword is the client Obtained in response to the input operation of the target search keyword, the target search keyword includes the first search keyword segment; if there is a target first search keyword that is the same as the target search keyword in the memory of the server Once a predicted search keyword is found, the search data corresponding to the target first predicted search keyword is searched from the memory of the server, and the search data corresponding to the target first predicted search keyword is sent to the client.
一方面,本发明实施例提供了一种计算机程序产品或计算机程序,该计算机程序产品包括计算机程序,该计算机程序存储在计算机存储介质中,客户端的处理器从计算机存储介质中读取该计算机程序,处理器执行该计算机程序,使得终端执行:On the one hand, an embodiment of the present invention provides a computer program product or a computer program, the computer program product includes a computer program, the computer program is stored in a computer storage medium, and a processor of a client reads the computer program from the computer storage medium , the processor executes the computer program, causing the terminal to execute:
响应于在输入目标搜索关键词的过程中的片段输入操作,获取第一搜索关键词片段,其中,所述目标搜索关键词包括所述第一搜索关键词片段;将所述第一搜索关键词片段发送至服务器;响应于所述目标搜索关键词的输入操作,获取所述目标搜索关键词,并将所述目标搜索关键词发送至所述服务器;接收并显示所述服务器发送的所述搜索数据,所述搜索数据为所述服务器通过在服务器的存储器中查找与目标第一预测搜索关键词对应的搜索数据得到的;所述目标第一预测搜索关键词对应的搜索数据,是所述服务器基于第一预测搜索关键词进行数据搜索得到的,且所述目标第一预测搜索关键词对应的搜索数据和所述第一预测搜索关键词对应存储在所述服务器的存储器中;所述目标第一预测搜索关键词为所述服务器的存储器中与所述目标搜索关键词相同的第一预测搜索关键词;所述第一预测搜索关键词是服务器基于第一搜索关键词片段进行预测得到的,且所述第一预测搜索关键词包括所述第一搜索关键词片段;所述第一搜索关键词片段位于所述第一预测搜索关键词中除所述第一搜索关键词片段以外的字符的前面。In response to a fragment input operation in the process of inputting the target search keyword, a first search keyword fragment is obtained, wherein the target search keyword includes the first search keyword fragment; The segment is sent to the server; in response to the input operation of the target search keyword, the target search keyword is acquired, and the target search keyword is sent to the server; the search sent by the server is received and displayed data, the search data is obtained by the server by looking up the search data corresponding to the target first predicted search keyword in the memory of the server; the search data corresponding to the target first predicted search keyword is the server The search data corresponding to the target first predicted search keyword and the first predicted search keyword are correspondingly stored in the memory of the server, obtained by performing data search based on the first predicted search keyword; A predicted search keyword is the first predicted search keyword in the memory of the server that is the same as the target search keyword; the first predicted search keyword is predicted by the server based on the first search keyword segment, And the first predicted search keyword includes the first search keyword segment; the first search keyword segment is located in the first predicted search keyword except for the first search keyword segment. Front.
一方面,本发明实施例提供了又一种计算机程序产品或计算机程序,该计算机程序产品包括计算机程序,该计算机程序存储在计算机存储介质中,客户端的处理器从计算机存储介质中读取该计算机程序,处理器执行该计算机程序,使得服务器执行:On the one hand, an embodiment of the present invention provides another computer program product or computer program, the computer program product includes a computer program, and the computer program is stored in a computer storage medium, and the processor of the client reads the computer from the computer storage medium. A program, the processor executing the computer program, causes the server to execute:
接收客户端发送的第一搜索关键词片段,并基于所述第一搜索关键词片段进行预测,得到第一预测搜索关键词,所述第一预测搜索关键词包括所述第一搜索关键词片段,且所述第一搜索关键词片段位于所述第一预测搜索关键词中除所述第一搜索关键词片段以外的字符的前面;根据所述第一预测搜索关键词进行数据搜索,得到搜索数据,并将所述搜索数据和所述第一预测搜索关键词对应存储至所述服务器的存储器中;接收所述客户端发送的目标搜索关键词,所述目标搜索关键词是所述客户端响应于所述目标搜索关键词的输入操作获取到的,所述目标搜索关键词包括所述第一搜索关键词片段;若所述服务器的存储器中存在与所述目标搜索关键词相同的目标第一预测搜索关键词,则从所述服务器的存储器中查找与所述目标第一预测搜索关键词对应的搜索数据,并将所述与所述目标第一预测搜索关键词对应的搜索数据发送至所述客户端。Receive the first search keyword segment sent by the client, and perform prediction based on the first search keyword segment to obtain a first predicted search keyword, where the first predicted search keyword includes the first search keyword segment , and the first search keyword segment is located in front of the characters other than the first search keyword segment in the first predicted search keyword; data search is performed according to the first predicted search keyword, and a search result is obtained. data, and store the search data and the first predicted search keyword in the memory of the server correspondingly; receive the target search keyword sent by the client, and the target search keyword is the client Obtained in response to the input operation of the target search keyword, the target search keyword includes the first search keyword segment; if there is a target first search keyword that is the same as the target search keyword in the memory of the server Once a predicted search keyword is found, the search data corresponding to the target first predicted search keyword is searched from the memory of the server, and the search data corresponding to the target first predicted search keyword is sent to the client.
本发明实施例通过获取用户在输入目标搜索关键词的过程中产生的第一搜索关键词片段,并基于第一搜索关键词片段进行关键词预测,得到第一预测搜索关键词;然后基于第一预测关键词进行数据搜索,得到对应的搜索数据,并将该搜索数据存储至服务器的存储器中,使得在用户输入了与第一预测搜索关键词相同的目标搜索关键词,并触发数据搜索操作之后,服务器可直接从存储器中获取搜索数据发送给用户所在客户端,极大地节省了服务器响应数据搜索的时间,进而提升了数据搜索的搜索速率。The embodiment of the present invention obtains the first predicted search keyword by acquiring the first search keyword segment generated by the user in the process of inputting the target search keyword, and performing keyword prediction based on the first search keyword segment; and then based on the first search keyword segment Perform data search on the predicted keywords, obtain corresponding search data, and store the search data in the memory of the server, so that after the user inputs the same target search keywords as the first predicted search keywords and triggers the data search operation , the server can directly obtain the search data from the memory and send it to the client where the user is located, which greatly saves the time for the server to respond to the data search, thereby improving the search rate of the data search.
附图说明Description of drawings
为了更清楚地说明本发明实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solutions of the embodiments of the present invention more clearly, the following briefly introduces the accompanying drawings used in the description of the embodiments. Obviously, the drawings in the following description are some embodiments of the present invention, which are of great significance to the art For those of ordinary skill, other drawings can also be obtained from these drawings without any creative effort.
图1a是本发明实施例提供的一种数据搜索场景示意图;1a is a schematic diagram of a data search scenario provided by an embodiment of the present invention;
图1b是本发明实施例提供的一种数据搜索系统示意图;Fig. 1b is a schematic diagram of a data search system provided by an embodiment of the present invention;
图1c是本发明实施例提供的一种数据共享系统示意图;1c is a schematic diagram of a data sharing system provided by an embodiment of the present invention;
图1d是本发明实施例提供的一种区块链的架构示意图;Fig. 1d is a schematic diagram of the architecture of a blockchain provided by an embodiment of the present invention;
图1e是本发明实施例提供的一种区块链生成的流程示意图;1e is a schematic flowchart of a blockchain generation provided by an embodiment of the present invention;
图2是本发明实施例提供的一种数据搜索方法的流程示意图;2 is a schematic flowchart of a data search method provided by an embodiment of the present invention;
图3是本发明实施例提供的一种关键词预测的流程示意图;3 is a schematic flowchart of a keyword prediction provided by an embodiment of the present invention;
图4是本发明实施例提供的又一种数据搜索方法的流程示意图;4 is a schematic flowchart of another data search method provided by an embodiment of the present invention;
图5是本发明实施例提供的又一种数据搜索方法的流程示意图;5 is a schematic flowchart of another data search method provided by an embodiment of the present invention;
图6是本发明实施例提供的一种数据搜索装置的结构示意图;6 is a schematic structural diagram of a data search apparatus provided by an embodiment of the present invention;
图7是本发明实施例提供的又一种数据搜索装置的结构示意图;7 is a schematic structural diagram of another data search apparatus provided by an embodiment of the present invention;
图8是本发明实施例提供的一种终端的结构示意图;FIG. 8 is a schematic structural diagram of a terminal provided by an embodiment of the present invention;
图9是本发明实施例提供的一种服务器的结构示意图。FIG. 9 is a schematic structural diagram of a server provided by an embodiment of the present invention.
具体实施方式Detailed ways
本发明实施例提供了一种数据搜索方法,该方法通过在用户输入目标搜索关键词且未触发搜索操作的过程中,对用户最终可能输入的关键词进行预测,得到预测关键词,并基于预测关键词进行搜索,得到该预测关键词对应的搜索数据。在得到搜索数据之后,将搜索数据和预测关键词对应存储至服务器的存储器,若目标搜索关键词和该预测关键词相同,则直接从服务器的存储器中查找并获取该预测关键词对应的搜索数据,有效减少了响应数据搜索的时长。An embodiment of the present invention provides a data search method, which obtains the predicted keywords by predicting the keywords that the user may finally input during the process that the user inputs the target search keywords without triggering the search operation, and obtains the predicted keywords based on the prediction. The keyword is searched to obtain the search data corresponding to the predicted keyword. After the search data is obtained, the search data and the predicted keyword are stored in the memory of the server. If the target search keyword is the same as the predicted keyword, the search data corresponding to the predicted keyword is directly searched and obtained from the memory of the server. , effectively reducing the time to respond to data searches.
其中,用户输入目标搜索关键词且用户未触发搜索操作的过程中,处于搜索框内的搜索关键词可被看做“搜索关键词片段”,举例来说,假设用户输入目标搜索关键词“电影A-最终章”需要分两次完成,如第一次输入“电影A”,第二次输入“-最终章”,以此完成目标搜索关键词“电影A-最终章”的输入。那么,当用户完成第一次输入后,可得到搜索关键词片段“电影A”,当用户完成第二次输入后,可得到搜索关键词片段“电影A-最终章”。因此,不难理解的是,预测关键词和目标搜索关键词中均包括搜索关键词片段。Among them, in the process that the user enters the target search keyword and the user does not trigger the search operation, the search keyword in the search box can be regarded as a "search keyword segment". For example, suppose the user enters the target search keyword "movie" A-final chapter" needs to be completed twice, for example, input "movie A" for the first time, and input "-final chapter" for the second time, so as to complete the input of the target search keyword "movie A-final chapter". Then, when the user completes the first input, the search keyword segment "movie A" can be obtained, and when the user completes the second input, the search keyword segment "movie A-final chapter" can be obtained. Therefore, it is not difficult to understand that both the predicted keyword and the target search keyword include search keyword segments.
在一个实施例中,本发明实施例提供的数据搜索方法可应用于多种数据搜索场景中,尤其可应用于个性化搜索场景,如:搜索数据中需包含用户个人行为、好友互动数据或用户地址相关信息的场景。举例来说,本发明实施例提供的方法可在执行数据查询操作时,结合发起数据查询请求的客户端对应的客户端标识进行数据查询,以得到跟该客户端对应的用户画像相关的搜索数据。示例性地,可参见图1a所示,在微信搜一搜的个性化搜索场景下,在用户点击“搜索”按钮之前,且在搜索框中输入“XX电影”的过程中,该方法可基于“XX电影”和该用户对应的客户端的用户画像两个方面进行进行关键词预测以及预测关键词对应搜索数据的获取。具体地,该方法在执行数据搜索时,不仅搜索该“XX电影”的信息,还搜索与该用户相关的互动信息(图1a中的“好友互动”信息是与每个用户朋友实际参与“XX电影”主题下的互动情况相关的信息)。基于此,可以理解,当用户点击“搜索”按钮后,所得到的搜索数据中不止包括“XX电影”对应的电影信息,还包括与发起查询请求的客户端的用户画像关联的数据,如:图1a中“朋友互动”的相关数据。In one embodiment, the data search method provided by the embodiment of the present invention can be applied to various data search scenarios, especially to personalized search scenarios. For example, the search data needs to include user personal behavior, friend interaction data or user Scenarios for address-related information. For example, the method provided by the embodiment of the present invention can perform data query in combination with the client identifier corresponding to the client that initiates the data query request when performing the data query operation, so as to obtain search data related to the user portrait corresponding to the client. . Illustratively, as shown in Figure 1a, in the personalized search scenario of WeChat Souyisou, before the user clicks the "Search" button, and in the process of entering "XX Movie" in the search box, the method can be based on The keyword prediction and the acquisition of the search data corresponding to the predicted keywords are carried out in terms of "XX Movie" and the user portrait of the client corresponding to the user. Specifically, when performing a data search, the method searches not only the information of the "XX movie", but also the interaction information related to the user (the "friend interaction" information in Fig. information related to interactions under the topic “Movies”). Based on this, it can be understood that when the user clicks the "Search" button, the obtained search data includes not only the movie information corresponding to "XX Movie", but also the data associated with the user portrait of the client that initiated the query request, such as: Fig. Data related to "friend interactions" in 1a.
上述数据搜索方法可应用于如图1b所示的数据搜索系统中,如图1b所示,该数据搜索系统包括至少一个客户端10,服务器11。其中,客户端10可运行于终端中,该运行有客户端10的终端以及服务器可以通过有线或无线通信方式进行直接或间接地连接,本发明在此不做限制。其中,该终端包含但不限定于智能手机、智能音箱、平板电脑等,该服务器可以是独立的物理服务器,也可以是多个物理服务器构成的服务器集群或者分布式系统,还可以是提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务、内容分发网络(Content Delivery Network,CDN)、以及大数据和人工智能平台等基础云计算服务的云服务器。终端可以是智能手机、平板电脑、笔记本电脑、台式计算机、智能音箱、智能手表等,但并不局限于此。The above data search method can be applied to the data search system shown in FIG. 1 b . As shown in FIG. 1 b , the data search system includes at least one
在一个实施例中,本发明实施例还提供了一种数据共享系统,可参见图1c所示。数据共享系统是指用于进行节点与节点之间数据共享的系统,该数据共享系统中可包括多个节点12,多个节点12可以是指数据共享系统中各个客户端(如上述客户端10)。每个节点12在进行正常工作可以接收到输入信息,并基于接收到的输入信息维护该数据共享系统内的共享数据。为了保证数据共享系统内的信息互通,数据共享系统中的每个节点之间可以存在信息连接,节点之间可以通过上述信息连接进行信息传输。例如,当数据共享系统中的任意节点接收到输入信息时,数据共享系统中的其他节点便根据共识算法获取该输入信息,将该输入信息作为共享数据中的数据进行存储,使得数据共享系统中全部节点上存储的数据均一致。对于数据共享系统中的每个节点,均具有与其对应的节点标识,而且数据共享系统中的每个节点均可以存储有数据共享系统中其他节点的节点标识,以便后续根据其他节点的节点标识,将生成的区块广播至数据共享系统中的其他节点。每个节点中可维护一个如下表所示的节点标识列表,将节点名称和节点标识对应存储至该节点标识列表中。其中,节点标识可为IP(Internet Protocol,网络之间互联的协议)地址以及其他任一种能够用于标识该节点的信息,表1中仅以IP地址为例进行说明。In one embodiment, an embodiment of the present invention further provides a data sharing system, as shown in FIG. 1c. The data sharing system refers to a system for sharing data between nodes, the data sharing system may include a plurality of
表1Table 1
数据共享系统中的每个节点均存储一条相同的区块链。区块链由多个区块组成,可参见图1d,区块链由多个区块组成,创始块中包括区块头和区块主体,区块头中存储有输入信息特征值、版本号、时间戳和难度值,区块主体中存储有输入信息;创始块的下一区块以创始块为父区块,下一区块中同样包括区块头和区块主体,区块头中存储有当前区块的输入信息特征值、父区块的区块头特征值、版本号、时间戳和难度值,并以此类推,使得区块链中每个区块中存储的区块数据均与父区块中存储的区块数据存在关联,保证了区块中输入信息的安全性。Every node in the data sharing system stores an identical blockchain. The blockchain consists of multiple blocks, as shown in Figure 1d. The blockchain consists of multiple blocks. The founding block includes the block header and the block body. The block header stores the input information feature value, version number, time stamp and difficulty value, the input information is stored in the block body; the next block of the genesis block takes the genesis block as the parent block, the next block also includes the block header and the block body, and the block header stores the current area The input information feature value of the block, the block header feature value of the parent block, the version number, the timestamp and the difficulty value, and so on, so that the block data stored in each block in the blockchain is the same as the parent block. There is an association between the block data stored in the block, which ensures the security of the input information in the block.
在生成区块链中的各个区块时,参见图1e,区块链所在的节点在接收到输入信息时,对输入信息进行校验,完成校验后,将输入信息存储至内存池中,并更新其用于记录输入信息的哈希树;之后,将更新时间戳更新为接收到输入信息的时间,并尝试不同的随机数,多次进行特征值计算,使得计算得到的特征值可以满足下述公式:When generating each block in the blockchain, see Figure 1e. When the node where the blockchain is located receives the input information, it verifies the input information. After the verification is completed, the input information is stored in the memory pool. And update its hash tree used to record the input information; after that, update the update timestamp to the time when the input information was received, and try different random numbers, and perform the eigenvalue calculation multiple times, so that the calculated eigenvalue can satisfy the The following formula:
SHA256(SHA256(version+prev_hash+merkle_root+ntime+nbits+x))<TARGETSHA256(SHA256(version+prev_hash+merkle_root+ntime+nbits+x))<TARGET
其中,SHA256为计算特征值所用的特征值算法;version(版本号)为区块链中相关区块协议的版本信息;prev_hash为当前区块的父区块的区块头特征值;merkle_root为输入信息的特征值;ntime为更新时间戳的更新时间;nbits为当前难度,在一段时间内为定值,并在超出固定时间段后再次进行确定;x为随机数;TARGET为特征值阈值,该特征值阈值可以根据nbits确定得到。基于此,当计算得到满足上述公式的随机数时,便可将信息对应存储,生成区块头和区块主体,得到当前区块。随后,区块链所在节点根据数据共享系统中其他节点的节点标识,将新生成的区块分别发送给其所在的数据共享系统中的其他节点,由其他节点对新生成的区块进行校验,并在完成校验后将新生成的区块添加至其存储的区块链中。Among them, SHA256 is the eigenvalue algorithm used to calculate the eigenvalue; version (version number) is the version information of the relevant block protocol in the blockchain; prev_hash is the block header eigenvalue of the parent block of the current block; merkle_root is the input information The characteristic value of ; ntime is the update time of the update timestamp; nbits is the current difficulty, which is a fixed value within a period of time, and is determined again after a fixed period of time; x is a random number; TARGET is the characteristic value threshold, the characteristic value of The value threshold can be determined according to nbits. Based on this, when the random number satisfying the above formula is obtained by calculation, the information can be stored correspondingly, the block header and the block body can be generated, and the current block can be obtained. Subsequently, the node where the blockchain is located sends the newly generated block to other nodes in the data sharing system where it is located according to the node identifiers of other nodes in the data sharing system, and the newly generated block is verified by other nodes. , and add the newly generated block to its stored blockchain after verification is complete.
请参见图2,图2是本发明实施例提供的一种数据搜索方法的流程示意图,该方法可应用于客户端,如图2所示,该方法包括:Please refer to FIG. 2. FIG. 2 is a schematic flowchart of a data search method provided by an embodiment of the present invention. The method can be applied to a client. As shown in FIG. 2, the method includes:
S201,响应于在输入目标搜索关键词的过程中的片段输入操作,获取第一搜索关键词片段。S201, in response to a segment input operation in the process of inputting the target search keyword, obtain a first search keyword segment.
在一个实施例中,目标搜索关键词是通过至少两次片段输入操作实现输入的,目标搜索关键词包括第一搜索关键词片段。具体实施例中,片段输入操作可理解为:在未触发数据搜索操作之前,用户在搜索框内输入关键词这一操作。例如:用户使用拼音输入法,想要输入“电影A”进行数据搜索,那么用户输入拼音“dian ying”并选择汉字“电影”,以使输入框内出现“电影”二字这个操作,可称为“片段输入操作”,且“电影”即为第一搜索关键词片段。In one embodiment, the target search keyword is input through at least two segment input operations, and the target search keyword includes a first search keyword segment. In a specific embodiment, the segment input operation can be understood as an operation of the user inputting a keyword in the search box before the data search operation is triggered. For example: the user uses the pinyin input method and wants to input "movie A" for data search, then the user inputs the pinyin "dian ying" and selects the Chinese character "movie", so that the word "movie" appears in the input box. This operation can be called is "segment input operation", and "movie" is the first search keyword segment.
S202,将第一搜索关键词片段发送至服务器。S202: Send the first search keyword segment to the server.
在一个实施例中,客户端将第一搜索关键词片段发送至服务器后,服务器可以基于第一搜索关键词片段进行预测,得到第一预测搜索关键词,然后,服务器根据第一预测搜索关键词进行数据搜索,得到搜索数据,并将搜索数据和第一预测搜索关键词对应存储至服务器的存储器中。其中,第一预测搜索关键词包括第一搜索关键词片段,且该第一搜索关键词片段位于第一预测搜索关键词中除第一搜索关键词片段以外的字符的前面。示例性地,可参见图3所示,假设用户想要输入“XY电影3”进行数据搜索操作,且第一搜索关键词片段为“XY电影”。那么服务器根据第一搜索关键词片段预测得到的第一预测搜索关键词中“XY电影”一定在整个关键词的最前面,例如:第一预测关键词可以是:XY电影1、XY电影2、XY电影3,等等。可见,第一搜索关键词片段“XY电影”始终在第一预测关键词中除“XY电影”以外的字符的前面。In one embodiment, after the client sends the first search keyword segment to the server, the server may perform prediction based on the first search keyword segment to obtain the first predicted search keyword, and then the server may search for the keyword according to the first prediction Perform data search to obtain search data, and store the search data and the first predicted search keyword in the memory of the server correspondingly. The first predicted search keyword includes a first search keyword segment, and the first search keyword segment is located in front of characters other than the first search keyword segment in the first predicted search keyword. Illustratively, as shown in FIG. 3 , it is assumed that the user wants to input "XY movie 3" to perform a data search operation, and the first search keyword segment is "XY movie". Then, in the first predicted search keyword predicted by the server according to the first search keyword segment, "XY movie" must be at the front of the entire keyword. For example, the first predicted keyword can be: XY movie 1, XY movie 2, XY Movie 3, etc. It can be seen that the first search keyword segment "XY movie" always precedes characters other than "XY movie" in the first predicted keyword.
在又一个实施例中,第一预测关键词的数量至少为1个,当服务器得到至少1个第一预测搜索关键词之后,可根据每个第一预测搜索关键词进行数据搜索,并将搜索得到的数据与其对应的第一预测搜索关键词进行存储。示例性地,若服务器针对第一搜索关键词片段“XY电影”,得到的第一预测关键词有2个,分别为“XY电影1”和“XY电影2”,那么,服务器将基于“XY电影1”进行数据搜索,得到与“XY电影1”有关的数据A,并将该数据A和“XY电影1”进行对应存储至该服务器对应的存储器中;同理地,服务器还会基于“XY电影2”进行数据搜索,得到与““XY电影2”有关的数据B,并将数据B与“XY电影2”进行对应存储至该服务器的存储器中。In yet another embodiment, the number of first predicted keywords is at least one, and after the server obtains at least one first predicted search keyword, it may perform data search according to each first predicted search keyword, and search for The obtained data and its corresponding first predicted search keyword are stored. Exemplarily, if the server obtains two first predicted keywords for the first search keyword segment "XY movie", which are "XY movie 1" and "XY movie 2", then the server will Movie 1" performs data search to obtain data A related to "XY Movie 1", and stores the data A and "XY Movie 1" in the corresponding memory of the server; XY movie 2" performs data search to obtain data B related to "XY movie 2", and stores the data B and "XY movie 2" in the memory of the server.
S203,响应于目标搜索关键词的输入操作,获取目标搜索关键词,并将目标搜索关键词发送至服务器。S203, in response to the input operation of the target search keyword, obtain the target search keyword, and send the target search keyword to the server.
在一个实施例中,客户端将目标搜索关键词发送至服务器之后,服务器可在确定存储器中存在与目标搜索关键词相同的目标第一预测搜索关键词时,从存储器中查找与目标第一预测搜索关键词对应的搜索数据。其中,“目标关键词的输入操作”可理解为:用户在输入框内完成所需关键词的输入并触发数据搜索这一操作。举例来说,假设用户使用拼音输入法,想要输入“电影A-最终章”进行数据搜索,且输入框内已存在“电影A-”这一关键词片段,那么用户可继续输入拼音“zuizhong zhang”并选择汉字“最终章”,使得输入框内出现“电影A-最终章”之后,用户点击“搜索”按钮以触发数据搜索的操作,可称为“目标关键词的输入操作”,且“电影A-最终章”即为目标搜索关键词。In one embodiment, after the client sends the target search keyword to the server, the server may search the memory for the target first prediction search keyword that is the same as the target search keyword when it is determined that the target first predicted search keyword exists in the memory Search data corresponding to the search keyword. The "input operation of target keyword" can be understood as: the user completes the input of the required keyword in the input box and triggers the operation of data search. For example, if the user uses the Pinyin input method and wants to input "movie A-final chapter" for data search, and the keyword segment "movie A-" already exists in the input box, the user can continue to input the pinyin "zuizhong". zhang" and select the Chinese character "final chapter", so that after "movie A-final chapter" appears in the input box, the user clicks the "search" button to trigger the data search operation, which can be called "target keyword input operation", and "Movie A-Final Chapter" is the target search keyword.
在一个实施例中,服务器在确定存储器中存在与目标搜索关键词相同的目标第一预测搜索关键词后,从存储器中查找与目标第一预测搜索关键词对应的搜索数据,可以理解为:服务器确定存储器中与目标搜索关键词相同的搜索关键词后,从存储器中调取与该搜索关键词对应的缓存数据。示例性地,假设服务器已经基于“XY电影1”进行数据搜索,得到与“XY电影1”有关的数据A,并将该数据A和“XY电影1”进行对应存储至该服务器对应的存储器中,那么,当目标搜索关键词为“XY电影1”时,服务器可直接从存储器中调取“数据A”,而非通过服务器进行数据搜索获取“数据A”。In one embodiment, after determining that the target first predicted search keyword that is the same as the target search keyword exists in the memory, the server searches the memory for search data corresponding to the target first predicted search keyword, which can be understood as: the server After it is determined that the search keyword in the memory is the same as the target search keyword, the cached data corresponding to the search keyword is retrieved from the memory. Exemplarily, it is assumed that the server has performed a data search based on "XY Movie 1", obtains data A related to "XY Movie 1", and stores the data A and "XY Movie 1" in the corresponding memory of the server. , then, when the target search keyword is "XY Movie 1", the server can directly retrieve "Data A" from the memory, instead of obtaining "Data A" by performing data search on the server.
S204,接收并显示服务器发送的搜索数据。S204, receiving and displaying the search data sent by the server.
在服务器得到搜索数据之后,服务器会将该搜索数据发送给客户端,以使得客户端能够显示搜索数据。After the server obtains the search data, the server sends the search data to the client, so that the client can display the search data.
本发明实施例提供的数据搜索方法能够通过获取用户在输入目标搜索关键词的过程中产生的第一搜索关键词片段,并基于第一搜索关键词片段进行关键词预测,得到第一预测搜索关键词;然后基于第一预测关键词进行数据搜索,得到对应的搜索数据,并将该搜索数据存储至服务器的存储器中,使得在用户输入了与第一预测搜索关键词相同的目标搜索关键词,并触发数据搜索操作之后,服务器可直接从存储器中获取搜索数据发送给用户所在客户端,极大地节省了服务器响应数据搜索的时间,进而提升了数据搜索的搜索速率。The data search method provided by the embodiment of the present invention can obtain the first predicted search key by obtaining the first search keyword segment generated by the user in the process of inputting the target search keyword, and performing keyword prediction based on the first search keyword segment. Then perform data search based on the first predicted keyword to obtain corresponding search data, and store the search data in the memory of the server, so that when the user inputs the same target search keyword as the first predicted search keyword, After triggering the data search operation, the server can directly obtain the search data from the memory and send it to the client where the user is located, which greatly saves the time for the server to respond to the data search, thereby improving the search rate of the data search.
请参见图4,图4是本发明实施例提供的又一种数据搜索方法的流程示意图。如图4所示,该方法包括:Please refer to FIG. 4. FIG. 4 is a schematic flowchart of another data search method provided by an embodiment of the present invention. As shown in Figure 4, the method includes:
S401,客户端响应于在输入目标搜索关键词的过程中的片段输入操作,获取第一搜索关键词片段。S401, the client obtains a first search keyword segment in response to a segment input operation in the process of inputting the target search keyword.
在一个实施例中,步骤S401中的具体实施例可参见步骤S201所述,在此不再赘述。In one embodiment, for a specific embodiment in step S401, reference may be made to the description in step S201, and details are not repeated here.
S402,客户端发送第一搜索关键词片段至服务器。S402, the client sends the first search keyword segment to the server.
客户端将第一搜索关键词片段发送至服务器。The client sends the first search keyword segment to the server.
S403,服务器接收第一搜索关键词片段,并基于第一搜索关键词片段进行预测,得到第一预测搜索关键词。S403, the server receives the first search keyword segment, and performs prediction based on the first search keyword segment to obtain a first predicted search keyword.
在一个实施例中,服务器接收到第一搜索关键词片段之后,可在基于第一搜索关键词片段进行预测,得到预测搜索关键词时,获取客户端的用户画像。然后服务器再基于该第一搜索关键词片段进行预测,得到与用户画像匹配的第一预测搜索关键词。具体地,服务器可获取用户的搜索习惯或搜索偏好等,为该客户端的用户进行个性化搜索关键词预测,以得到与该客户端的用户联系更为紧密的第一预测搜索关键词,进而得到更多元的搜索数据。In one embodiment, after receiving the first search keyword segment, the server may obtain the user portrait of the client when the predicted search keyword is obtained by performing prediction based on the first search keyword segment. Then, the server performs prediction based on the first search keyword segment to obtain a first predicted search keyword matching the user portrait. Specifically, the server can obtain the user's search habits or search preferences, etc., and perform personalized search keyword prediction for the user of the client, so as to obtain the first predicted search keyword that is more closely related to the user of the client, and then obtain a more accurate search keyword. Diverse search data.
在一个实施例中,用户在输入目标搜索关键词的时候,一般是多次、且按序输入的。例如用户在输入“XY电影1”这几个字时,可能是先输入“XY”,再输入“电影1”,以形成最终的“XY电影1”。那么,服务器可以在基于第一搜索关键词片段进行预测之前,建立关键词索引,该关键词索引用于指示服务器基于第一搜索关键词片段索引得到第一预测搜索关键词。示例性地,服务器可采用Trie树(字典树)进行前缀索引,具体来说,服务器在接收到客户端响应于第一次片段输入得到的第一搜索关键词片段之后,可实时将第一搜索关键词片段在Trie树中进行前缀匹配,得到以第一搜索关键词片段为前缀的第一预测搜索关键词。其中,Trie树又称前缀树,是一种有序树,树中每个节点的子孙节点都有相同的前缀,把从根节点到某一节点路径上经过的字符连接起来,即为该节点对应的字符串。In one embodiment, when the user inputs the target search keyword, it is generally input multiple times and in sequence. For example, when the user inputs the words "XY Movie 1", he may first input "XY" and then "Movie 1" to form the final "XY Movie 1". Then, the server may establish a keyword index before performing prediction based on the first search keyword segment, where the keyword index is used to instruct the server to obtain the first predicted search keyword based on the first search keyword segment index. Exemplarily, the server may use a Trie tree (dictionary tree) for prefix indexing. Specifically, after receiving the first search keyword segment obtained by the client in response to the first segment input, the server may perform the first search keyword segment in real time. The keyword segments are prefix-matched in the Trie tree to obtain a first predicted search keyword prefixed with the first search keyword segment. Among them, the Trie tree, also known as the prefix tree, is an ordered tree. The descendant nodes of each node in the tree have the same prefix. The characters that pass through the path from the root node to a node are connected, that is, the node. the corresponding string.
举例来说,请参见图3所示,服务器通过Trie树对第一搜索关键词片段“XY电影”进行前缀预测的方式即为:服务器在Trie树中查找以“X→Y→电→影”这一序列为开始的路径,其中,X为根节点,且可看作Y的前缀(Y即为X的子孙节点),同理地,“Y”可看作“电”的前缀(“电”即为Y的子孙节点),...,以此类推,可通过“影”将“X→Y→电→影”这一路径进行延长,最终得到一条由根节点“X”至某一子孙节点的路径,然后将该路径上的所有字符连接起来,便可完成对第一搜索关键词片段“XY电影”的前缀预测,得到包括“XY电影”的第一预测搜索关键词(如“XY电影1”)。例如:针对图3中根节点“X”至子孙节点“2”这一路径,服务器将该路径上的所有字符连接起来即可得到“XY电影2”。For example, as shown in FIG. 3 , the way that the server performs prefix prediction on the first search keyword segment "XY movie" through the Trie tree is: the server searches the Trie tree with the words "X→Y→movie→movie" This sequence is the beginning of the path, where X is the root node, and can be regarded as the prefix of Y (Y is the descendant node of X). Similarly, "Y" can be regarded as the prefix of "electricity" ("electrical" "is the descendant node of Y), ..., and so on, the path "X→Y→movie→movie" can be extended through "shadow", and finally a path from the root node "X" to a certain The path of the descendant node, and then connect all characters on the path to complete the prefix prediction of the first search keyword segment "XY movie", and obtain the first predicted search keyword including "XY movie" (such as " XY Movie 1"). For example, for the path from the root node "X" to the descendant node "2" in Fig. 3, the server can obtain "XY movie 2" by connecting all characters on the path.
在另一个实施例中,服务器还可采用哈希索引或采用倒排索引的方式,实现基于第一搜索关键词片段预测得到第一预测搜索关键词,本发明实施例在此不做限制。其中,若服务器采用哈希索引的方式实现第一预测搜索关键词的预测,则服务器需要基于第一搜索关键词片段生成哈希函数。哈希函数可将键(可以理解为:第一搜索关键词片段)映射到数据(可理解为:第一预测搜索关键词)应该存放的槽(bucket,哈希表中用于保存数据的一个单元)所在位置。那么可以理解,服务器通过哈希函数可匹配第一搜索关键词片段到对应的包括第一搜索关键词片段的槽,然后服务器再根据槽得到对应的第一预测搜索关键词。若服务器采用倒排索引的方式实现第一预测搜索关键词的预测,则服务器会根据第一搜索关键词片段在索引中查找包括第一搜索关键词片段的关键词,以此得到第一预测搜索关键词。In another embodiment, the server may also use a hash index or an inverted index to predict and obtain the first predicted search keyword based on the first search keyword segment, which is not limited in this embodiment of the present invention. Wherein, if the server implements the prediction of the first predicted search keyword by means of a hash index, the server needs to generate a hash function based on the first search keyword segment. The hash function can map the key (which can be understood as: the first search keyword segment) to the slot (bucket, which is used to store data in the hash table) where the data (which can be understood as: the first predicted search keyword) should be stored. unit) location. Then it can be understood that the server can match the first search keyword segment to the corresponding slot including the first search keyword segment through the hash function, and then the server obtains the corresponding first predicted search keyword according to the slot. If the server implements the prediction of the first predicted search keyword by means of an inverted index, the server will search the index for keywords including the first search keyword fragment according to the first search keyword fragment, so as to obtain the first predicted search keyword Key words.
S404,服务器根据第一预测搜索关键词进行数据搜索,得到搜索数据,并将搜索数据和第一预测搜索关键词对应存储至服务器的存储器中。S404, the server performs data search according to the first predicted search keyword, obtains search data, and stores the search data and the first predicted search keyword in the memory of the server correspondingly.
在一个实施例中,第一预测搜索关键词的数量为至少两个。那么,服务器在根据第一预测搜索关键词进行数据搜索,得到搜索数据之前,还可获取各个第一预测搜索关键词与第一搜索关键词片段的长度比值,然后在该至少两个第一预测搜索关键词中确定出长度比值大于比值阈值的第一预测搜索关键词,再基于长度大于比值阈值的第一预测搜索关键词进行数据搜索。示例性地,比值阈值可以是2,即:当第一预测搜索关键词的长度为第一搜索关键词片段的长度的2倍或2倍以上时,服务器才基于第一预测搜索关键词进行数据搜索。In one embodiment, the number of the first predicted search keywords is at least two. Then, before the server performs data search according to the first predicted search keywords and obtains the search data, the server may also obtain the ratio of the length of each first predicted search keyword to the first search keyword segment, and then the at least two first predicted From the search keywords, a first predicted search keyword whose length ratio is greater than the ratio threshold is determined, and then data search is performed based on the first predicted search keyword whose length is greater than the ratio threshold. Exemplarily, the ratio threshold may be 2, that is, when the length of the first predicted search keyword is 2 times or more than the length of the first search keyword segment, the server will perform data analysis based on the first predicted search keyword. search.
举例来说,假设比值阈值是2,且第一搜索关键词片段为“好看的”,第一预测搜索关键词包括“好看的花”和“好看的电视剧”,那么,由于第一搜索关键词片段“好看的”的字符长度为3,第一预测搜索关键词“好看的花”字符长度为4,那么,他们的长度比值为因此服务器将忽略“好看的花”这一预测搜索关键词(即,不基于“好看的花”进行数据搜索);由于第一预测搜索关键词“好看的电视剧”的字符长度为6,它与“好看的”字符长度的长度比值为2(6/3=0.75),因此服务器将基于“好看的电视剧”这一预测搜索关键词进行数据搜索。不难理解的是,此方式可减少第一预测搜索关键词的数量,进而可减少数据搜索过程中不必要的数据搜索开销和数据存储空间开销。For example, assuming that the ratio threshold is 2, and the first search keyword segment is "beautiful", the first predicted search keywords include "beautiful flowers" and "beautiful TV series", then, since the first search keyword The character length of the fragment "beautiful" is 3, and the first predicted search keyword "beautiful flower" has a character length of 4. Then, their length ratio is Therefore, the server will ignore the predicted search keyword "beautiful flower" (that is, the data search will not be performed based on "beautiful flower"); since the character length of the first predicted search keyword "beautiful TV series" is 6, it is the same as The length ratio of the character length of "good-looking" is 2 (6/3=0.75), so the server will perform data search based on the predicted search keyword "good-looking TV series". It is not difficult to understand that this method can reduce the number of first predicted search keywords, thereby reducing unnecessary data search overhead and data storage space overhead in the data search process.
在又一个实施例中,由前述可知,服务器可基于客户端的用户画像和第一搜索关键词片段预测得到第一预测搜索关键词。基于此,服务器可基于第一预测搜索关键词进行数据搜索,得到与客户端的用户画像匹配的搜索数据,然后再将客户端的客户端标识和第一预测搜索关键词,以及与用户画像匹配的搜索数据对应存储至服务器的存储器中。In yet another embodiment, as can be seen from the foregoing, the server can predict and obtain the first predicted search keyword based on the user portrait of the client and the first search keyword segment. Based on this, the server can perform a data search based on the first predicted search keyword, obtain search data matching the user portrait of the client, and then combine the client identification of the client, the first predicted search keyword, and the search data matching the user portrait. The data is correspondingly stored in the memory of the server.
S405,客户端响应于目标搜索关键词的输入操作,获取目标搜索关键词,并发送目标搜索关键词至服务器。S405, the client obtains the target search keyword in response to the input operation of the target search keyword, and sends the target search keyword to the server.
在一个实施例中,由前述可知,目标搜索关键词是通过至少两次片段输入操作实现的,且该目标搜索关键词包括第一搜索关键词片段,服务器根据该第一搜索关键词片段可预测得到第一预测搜索关键词。那么可以理解,当只有1个第一预测搜索关键词时,该第一预测搜索关键词可能为目标搜索关键词;当至少有2个第一预测搜索关键词时,该至少2个第一预测搜索关键词中可能包括目标搜索关键词。In one embodiment, as can be seen from the foregoing, the target search keyword is implemented through at least two segment input operations, and the target search keyword includes a first search keyword segment, and the server can predict the first search keyword segment according to the first search keyword segment. Get the first predicted search keyword. Then it can be understood that when there is only one first predicted search keyword, the first predicted search keyword may be the target search keyword; when there are at least two first predicted search keywords, the at least two first predicted search keywords may be the target search keyword. The search keywords may include the target search keywords.
S406,若服务器的存储器中存在与目标搜索关键词相同的目标第一预测搜索关键词,服务器则从服务器的存储器中查找与目标第一预测搜索关键词对应的搜索数据。S406 , if there is a target first predicted search keyword that is the same as the target search keyword in the memory of the server, the server searches the memory of the server for search data corresponding to the target first predicted search keyword.
在一个实施例中,当服务器接收到目标搜索关键词之后,会在存储器中查找与目标搜索关键词相同的第一预测搜索关键词(即:查找目标第一预测搜索关键词),若存储器中存在与目标搜索关键词相同的目标第一预测搜索关键词,则在服务器的存储器中,查找与目标第一预测搜索关键词对应的搜索数据;若存储器中不存在与目标搜索关键词相同的目标第一预测搜索关键词,服务器则基于目标搜索关键词进行数据搜索,以得到目标搜索关键词对应的搜索数据。可选地,当服务器基于目标搜索关键词进行数据搜索,得到目标搜索关键词对应的搜索数据之后,还可将该目标搜索关键词对应的搜索数据存储至服务器的存储器中。In one embodiment, after receiving the target search keyword, the server will search the memory for the first predicted search keyword that is the same as the target search keyword (ie: search for the target first predicted search keyword). If there is a target first predicted search keyword that is the same as the target search keyword, search for the search data corresponding to the target first predicted search keyword in the memory of the server; if there is no target same as the target search keyword in the memory For the first predicted search keyword, the server performs data search based on the target search keyword to obtain search data corresponding to the target search keyword. Optionally, after the server performs data search based on the target search keyword and obtains search data corresponding to the target search keyword, the server may also store the search data corresponding to the target search keyword in the memory of the server.
在又一个实施例中,若存储器中存储的搜索数据为基于客户端标识和第一预测搜索关键词进行搜索得到的,则服务器可根据客户端的客户端标识和目标预测搜索关键词,从服务器的存储器中查找与目标预测搜索关键词和客户端标识对应的搜索数据。具体地,服务器可以客户端标识和目标搜索关键词为键查找缓存。其中,“缓存”可理解为临时数据存储的设备,可用于加快数据访问速度,缓存可以是存储器或者其他专用存储设备。In yet another embodiment, if the search data stored in the memory is obtained by searching based on the client identifier and the first predicted search keyword, the server may predict the search keyword according to the client identifier and target of the client, and retrieve the search keyword from the server's identifier. Search the memory for search data corresponding to the target predicted search keyword and the client identifier. Specifically, the server may look up the cache with the client identifier and the target search keyword as the key. Among them, "cache" can be understood as a device for temporary data storage, which can be used to speed up data access, and the cache can be a memory or other special storage device.
S407,服务器发送与目标第一预测搜索关键词对应的搜索数据至客户端。S407, the server sends search data corresponding to the target first predicted search keyword to the client.
在服务器得到目标搜索关键词对应的搜索数据之后,会将该搜索数据发送至客户端。After the server obtains the search data corresponding to the target search keyword, it will send the search data to the client.
S408,客户端接收并显示搜索数据。S408, the client receives and displays the search data.
本发明实施例提供的数据搜索方法能够通过获取用户在输入目标搜索关键词的过程中产生的第一搜索关键词片段,使得服务器可基于第一搜索关键词片段进行关键词预测,得到第一预测搜索关键词;然后服务器基于第一预测关键词进行数据搜索,得到对应的搜索数据,并将该搜索数据存储至服务器的存储器中,使得服务器实现在用户输入了与第一预测搜索关键词相同的目标搜索关键词,并触发数据搜索操作之后,服务器可直接从存储器中获取搜索数据发送给用户所在客户端,节省了服务器响应数据搜索的时间。本发明实施例提供的方法还通过基于客户端的用户画像进行个性化地搜索关键词预测,尽可能地保证了用户在输入目标搜索关键词之后可以通过存储器获取到搜索数据,提高了存储命中率,进而节省了服务器响应数据搜索的时间,在耗时要求严格的数据搜索场景下起了重要作用。The data search method provided by the embodiment of the present invention can obtain the first search keyword segment generated by the user in the process of inputting the target search keyword, so that the server can perform keyword prediction based on the first search keyword segment, and obtain the first prediction Search keywords; then the server performs data search based on the first predicted keywords, obtains corresponding search data, and stores the search data in the memory of the server, so that the server realizes that when the user inputs the same search keywords as the first predicted search keywords After the target searches for keywords and triggers the data search operation, the server can directly obtain the search data from the memory and send it to the client where the user is located, saving the time for the server to respond to the data search. The method provided by the embodiment of the present invention also performs personalized search keyword prediction based on the user portrait of the client, so as to ensure as much as possible that the user can obtain the search data through the memory after inputting the target search keyword, thereby improving the storage hit rate. This saves the time for the server to respond to data search, and plays an important role in data search scenarios with strict time-consuming requirements.
请参见图5,图5是本发明实施例提供的又一种数据搜索方法的流程示意图。如图5所示,该方法包括:Please refer to FIG. 5. FIG. 5 is a schematic flowchart of another data search method provided by an embodiment of the present invention. As shown in Figure 5, the method includes:
S501,客户端响应于在输入目标搜索关键词的过程中的第N次片段输入操作,获取第一搜索关键词片段。S501, the client acquires a first search keyword segment in response to the Nth segment input operation in the process of inputting the target search keyword.
在一个实施例中,由前述实施例可知,用户在输入目标搜索关键词的时候,一般是分多次进行,且按序输入的。那么,当输入目标搜索关键词需要用户执行M次输入操作时(M>N,且M为正整数,N为正整数),第一搜索关键词片段可以是客户端响应于第N次片段输入操作获取到的。In one embodiment, as can be seen from the foregoing embodiments, when the user inputs the target search keyword, the input is generally performed in multiple times and in sequence. Then, when inputting the target search keyword requires the user to perform M input operations (M>N, and M is a positive integer and N is a positive integer), the first search keyword segment may be the client's response to the Nth segment input. obtained by the operation.
S502,客户端发送第一搜索关键词片段至服务器。S502, the client sends the first search keyword segment to the server.
S503,服务器接收第一预测搜索关键词片段,并基于第一预测搜索关键词片段进行预测,得到第一预测搜索关键词。S503: The server receives the first predicted search keyword segment, and performs prediction based on the first predicted search keyword segment to obtain the first predicted search keyword.
在一个实施例中,步骤S502至步骤S503中的具体实施例可参见步骤S402至步骤S403所述,在此不再赘述。In one embodiment, for specific embodiments of steps S502 to S503, reference may be made to the descriptions of steps S402 to S403, and details are not repeated here.
S504,服务器根据第一预测搜索关键词进行数据搜索,得到搜索数据,并将搜索数据和第一预测搜索关键词对应存储至服务器的存储器中。S504, the server performs a data search according to the first predicted search keyword, obtains search data, and stores the search data and the first predicted search keyword in the memory of the server correspondingly.
在一个实施例中,第一预测搜索关键词的数量为至少一个,当服务器根据第一预测搜索关键词进行数据搜索时,还可将正在进行数据搜索的第一预测搜索关键词添加至关键词搜索列表,以使得该关键词搜索列表中包括第一预测搜索关键词中处于数据搜索状态的预测搜索关键词。可以理解,若关键词搜索列表中的预测搜索关键词A完成了数据搜索(即,结束了数据搜索状态),那么,服务器将把该预测搜索关键词A移出关键词搜索列表。举例来说,假设有第一预测搜索关键词1——好看的,第一预测搜索关键词2——好看的电影,以及第一预测搜索关键词3——好看的电视剧,且正在执行数据搜索的第一预测搜索关键词有“好看的”和“好看的电视剧”。那么,可以理解,此时关键词搜索列表中有“好看的”和“好看的电视剧”这两个预测搜索关键词。若“好看的”这一搜索关键词完成了数据搜索,那么,服务器将把“好看的”这一预测搜索关键词从搜索关键词列表中移除,移除后,关键词搜索列表中的预测搜索关键词将只有第一预测搜索关键词3(即:好看的电视剧)。In one embodiment, the number of the first predicted search keyword is at least one, and when the server performs data search according to the first predicted search keyword, the server may also add the first predicted search keyword that is being searched for data to the keyword The search list is made so that the predicted search keywords in the data search state among the first predicted search keywords are included in the keyword search list. It can be understood that, if the predicted search keyword A in the keyword search list completes the data search (ie, the data search state ends), then the server will remove the predicted search keyword A from the keyword search list. For example, suppose there is the first predicted search keyword 1 - good-looking, the first predicted search keyword 2 - good movies, and the first predicted search keyword 3 - good TV series, and a data search is being performed The first predicted search keywords are "good-looking" and "good-looking TV series." Then, it can be understood that there are two predicted search keywords "good-looking" and "good-looking TV series" in the keyword search list at this time. If the search keyword "good-looking" completes the data search, the server will remove the predicted search keyword "good-looking" from the search keyword list. The search keywords will only have the first predicted search keyword 3 (ie: a good TV series).
在又一个实施例中,服务器还可以在基于第一预测搜索关键词进行数据搜索,得到搜索数据之后,生成该搜索数据的存储有效期,该存储有效期用于限制该搜索数据的有效时间,超过该有效时间的搜索数据将不再被获取,或者超过该有效时间的搜索数据以及对应的第一预测搜索关键词将从存储器中移除。举例来说,假设第一预测搜索关键词“关键词A”对应的搜索数据为“数据A”时,若数据A的存储有效期已过(即:数据A已失效),那么,当用户需要获取“关键词A”的搜索数据时,将不再从存储器中获取,而是重新基于“关键词A”进行数据搜索,以得到“关键词A”对应的搜索数据。示例性地,存储有效期的形式可以为有效截止日期,即:服务器通过有效截止日期与当前日期进行对比,确定该搜索数据是否失效;存储有效期的形式也可以为有效时长,即:存储器定时对有效时长进行缩短,服务器通过判断有效时长是否为0,确定该搜索数据是否失效。例如:当预设存储有效期为10天时,若数据A是第N天被存储进存储器的,那么第N天的数据A对应的存储有效期即为10,第N+1天,存储有效期变为9。In yet another embodiment, the server may also generate a storage validity period of the search data after performing a data search based on the first predicted search keyword to obtain the search data, where the storage validity period is used to limit the validity period of the search data, beyond the The search data of the valid time will no longer be acquired, or the search data exceeding the valid time and the corresponding first predicted search keyword will be removed from the memory. For example, assuming that the search data corresponding to the first predicted search keyword "keyword A" is "data A", if the storage validity period of data A has expired (that is, data A has expired), then when the user needs to obtain When the search data of "keyword A" is not obtained from the memory, data search is performed based on "keyword A" again to obtain search data corresponding to "keyword A". Exemplarily, the storage validity period can be in the form of an effective expiration date, that is, the server determines whether the search data is invalid by comparing the effective expiration date with the current date; the storage validity period can also be in the form of an effective duration, that is: the memory is regularly valid for The duration is shortened, and the server determines whether the search data is invalid by judging whether the valid duration is 0. For example: when the preset storage validity period is 10 days, if data A is stored in the memory on the Nth day, the storage validity period corresponding to the data A on the Nth day is 10, and the storage validity period becomes 9 on the N+1th day. .
S505,客户端响应于在输入目标搜索关键词的过程中的第N+1次片段输入操作,获取第二搜索关键词片段。S505 , the client acquires a second search keyword segment in response to the N+1 th segment input operation in the process of inputting the target search keyword.
在一个实施例中,在用户输入目标搜索关键词的过程中,客户端还可得到第二搜索关键词片段,该第二搜索关键词片段是客户端响应于第N+1次片段输入操作获取到的。其中,N为正整数,第二搜索关键词片段包括第一搜索关键词片段,且第一搜索关键词片段位于第二搜索关键词片段中除第一搜索关键词片段以外的字符的前面。例如:在输入“好看的电视剧”这一目标搜索关键词的过程中,若用户先输入汉字“好看的”,再输入汉字“电视”,最后输入汉字“剧”,以完成“好看的电影”这一目标搜索关键词的输入,那么第一搜索关键词片段即为“好看的”,第二搜索关键词片段即为“好看的电视”(“好看的电视”包括“好看的”,且“好看的”三个字位于“电视”前面)。那么可以理解,具体实施例中,若用户在输入目标搜索关键词的过程中,对已处于搜索框中的关键词进行了删除操作,则删除字词后的关键词仍为第一搜索关键词片段。例如:用户第一次在搜索框内输入了“好看的电视”这一关键词作为第一搜索关键词片段,然后用户发现输入错误,于是删除了“电视”这一词语,那么,现在处于搜索框内的“好看的”这一关键词仍为第一搜索关键词片段,而不为第二搜索关键词片段,因为“好看的”这一搜索关键词片段不包括“好看的电视”这一搜索关键词片段。In one embodiment, in the process of the user inputting the target search keyword, the client terminal may also obtain a second search keyword segment, where the second search keyword segment is obtained by the client in response to the N+1th segment input operation arrived. Wherein, N is a positive integer, the second search keyword segment includes the first search keyword segment, and the first search keyword segment is located in front of characters other than the first search keyword segment in the second search keyword segment. For example: in the process of inputting the target search keyword "good-looking TV series", if the user first enters the Chinese character "good-looking", then the Chinese character "TV", and finally the Chinese character "drama" to complete the "good-looking movie" Entering this target search keyword, the first search keyword segment is "good-looking", and the second search keyword segment is "good-looking TV" ("good-looking TV" includes "good-looking", and "good-looking TV" includes "good-looking" and "good-looking TV". The words "beautiful" are placed in front of "TV"). Then it can be understood that, in the specific embodiment, if the user deletes the keyword already in the search box during the process of inputting the target search keyword, the keyword after the deleted word is still the first search keyword Fragment. For example: for the first time, the user entered the keyword "good-looking TV" in the search box as the first search keyword segment, and then the user found that the input was wrong, so he deleted the word "TV", then, now in the search The keyword "good-looking" in the box is still the first search keyword segment, not the second search keyword segment, because the "good-looking" search keyword segment does not include the "good-looking TV" segment. Search for keyword snippets.
S506,客户端发送第二搜索关键词片段至服务器。S506, the client sends the second search keyword segment to the server.
S507,服务器基于第二搜索关键词片段进行预测,得到第二预测搜索关键词,若服务器的存储器中存在第二预测关键词对应的搜索数据,则停止根据第二预测搜索关键词进行数据搜索。S507: The server performs prediction based on the second search keyword segment to obtain the second predicted search keyword. If there is search data corresponding to the second predicted keyword in the server's memory, the data search based on the second predicted search keyword is stopped.
在一个实施例中,当服务器接收到客户端发送的第二搜索关键词片段之后,可基于该第二搜索关键词片段进行预测,得到第二预测搜索关键词,并对第二预测搜索关键词进行筛选,然后服务器将基于筛选后的第二预测搜索关键词进行数据搜索。具体实施例中,若服务器的存储器中存在第二预测搜索关键词对应的搜索数据,则停止根据第二预测搜索关键词进行数据搜索;若服务器的存储器中不存在第二预测搜索关键词对应的搜索数据,服务器则根据第二预测搜索关键词进行数据搜索。举例来说,假设服务器的存储器中存在搜索关键词“好看的电影”对应的搜索数据A,若第二搜索关键词片段为“好看的”,且基于“好看的”预测得到的第二预测搜索关键词为“好看的电影”,那么服务器将不会基于“好看的电影”进行数据搜索,或者,服务器将在此次基于“好看的电影”这一关键词的数据搜索发起时,及时中断该数据搜索过程。In one embodiment, after receiving the second search keyword segment sent by the client, the server may perform prediction based on the second search keyword segment, obtain a second predicted search keyword, and analyze the second predicted search keyword After filtering, the server will perform data search based on the filtered second predicted search keywords. In a specific embodiment, if there is search data corresponding to the second predicted search keyword in the server's memory, the data search based on the second predicted search keyword is stopped; if there is no data corresponding to the second predicted search keyword in the server's memory To search data, the server performs data search according to the second predicted search keyword. For example, assuming that there is search data A corresponding to the search keyword "good-looking movie" in the server's memory, if the second search keyword segment is "good-looking", and the second predicted search based on the prediction of "good-looking" If the keyword is "good movie", the server will not perform data search based on "good movie", or the server will interrupt the data search based on the keyword "good movie" in time. Data search process.
在又一个实施例中,由前述可知,存储器中的搜索数据可对应一个存储有效期。基于此,若服务器的存储器中存在第二预测搜索关键词对应的搜索数据,则服务器还可对第二预测搜索关键词对应的搜索数据的存储有效期进行有效性验证;若该搜索数据的有效性验证失败,则服务器将重新根据第二预测搜索关键词进行数据搜索。可选地,在服务器完成根据第二预测搜索关键词的数据搜索之后,服务器还可将该第二预测搜索关键词,第二预测搜索关键词对应的搜索数据,以及该搜索数据的存储有效期进行对应存储。In yet another embodiment, as can be seen from the foregoing, the search data in the memory may correspond to a storage validity period. Based on this, if there is search data corresponding to the second predicted search keyword in the server's memory, the server can also verify the validity of the storage validity period of the search data corresponding to the second predicted search keyword; if the validity of the search data is valid If the verification fails, the server will perform data search again according to the second predicted search keyword. Optionally, after the server completes the data search based on the second predicted search keyword, the server may also perform the second predicted search keyword, the search data corresponding to the second predicted search keyword, and the storage validity period of the search data. corresponding storage.
在一个实施例中,服务器还可先获取上述关键词搜索列表,再基于第二预测搜索关键词进行数据搜索,得到搜索数据。具体地,若服务器的存储器中不存在第二预测搜索关键词对应的搜索数据,则在关键词列表中查找该第二预测搜索关键词,若关键词搜索列表中存在第二预测搜索关键词,则持续根据第二预测搜索关键词进行数据搜索;若服务器的存储器中不存在第二预测搜索关键词对应的搜索数据,且关键词搜索列表中也不存在该第二预测搜索关键词,则服务器将根据该第二预测搜索关键词进行数据搜索,得到第二预测搜索关键词对应的搜索数据。In one embodiment, the server may also obtain the above keyword search list first, and then perform data search based on the second predicted search keyword to obtain search data. Specifically, if the search data corresponding to the second predicted search keyword does not exist in the memory of the server, the second predicted search keyword is searched in the keyword list, and if the second predicted search keyword exists in the keyword search list, Then continue to perform data search according to the second predicted search keyword; if there is no search data corresponding to the second predicted search keyword in the server's memory, and the second predicted search keyword does not exist in the keyword search list, then the server The data search is performed according to the second predicted search keyword to obtain search data corresponding to the second predicted search keyword.
举例来说,假设服务器的存储器中仅存在搜索关键词“好看的电影”对应的搜索数据A,关键词搜索列表1中存在预测搜索关键词“好看的花”。若第二搜索关键词片段为“好看的”,且基于“好看的”预测得到的第二预测搜索关键词A为“好看的花”,第二预测搜索关键词B为“好看的电视剧”。那么,当服务器基于第二预测搜索关键词(即“好看的花”)进行数据搜索之前,会在存储器中查找有无“好看的花”对应的搜索数据,由于此时存储器中不存在“好看的花”对应的搜索数据,因此服务器将在关键词搜索列表中查找“好看的花”这一预测搜索关键词,又由于关键词搜索列表1中存在“好看的花”(即:基于“好看的花”的数据搜索正在进行),于是服务器将不会再次基于“好看的花”进行数据搜索,而是等待服务器完成对“好看的花”的数据搜索;同理地,当服务器基于第二预测搜索关键词(即“好看的电视剧”)进行数据搜索之前,会在存储器中查找有无“好看的电视剧”对应的搜索数据,由于存储器中不存在“好看的电视剧”对应的搜索数据,因此服务器将在关键词搜索列表中查找“好看的电视剧”这一预测搜索关键词,由于关键词搜索列表1中也不存在“好看的电视剧”,于是服务器将基于“好看的电视剧”进行数据搜索。For example, it is assumed that only the search data A corresponding to the search keyword "good-looking movie" exists in the memory of the server, and the predicted search keyword "good-looking flower" exists in the keyword search list 1. If the second search keyword segment is "good-looking", and the second predicted search keyword A obtained based on the "good-looking" prediction is "good-looking flowers", the second predicted search keyword B is "good-looking TV series". Then, before the server performs data search based on the second predicted search keyword (that is, "beautiful flower"), it will look for the search data corresponding to "beautiful flower" in the memory, because there is no "beautiful flower" in the memory at this time. The search data corresponding to the "flower", the server will look for the predicted search keyword "beautiful flower" in the keyword search list, and because there is a "beautiful flower" in the keyword search list 1 (ie: based on "beautiful flower" The data search for "good-looking flowers" is in progress), so the server will not perform data search based on "good-looking flowers" again, but waits for the server to complete the data search for "good-looking flowers"; Before performing data search by predicting the search keyword (that is, "good-looking TV series"), it will look for the search data corresponding to "good-looking TV series" in the memory. Since there is no search data corresponding to "good-looking TV series" in the memory, so The server will look for the predicted search keyword "good TV series" in the keyword search list. Since there is no "good TV series" in the keyword search list 1, the server will perform data search based on "good TV series".
S508,客户端响应于目标搜索关键词的输入操作,获取目标搜索关键词,并发送目标搜索关键词至服务器。S508, the client obtains the target search keyword in response to the input operation of the target search keyword, and sends the target search keyword to the server.
在一个实施例中,当第二搜索关键词片段是客户端响应于第N+1(N为正整数)次片段输入操作获取到的时,目标搜索关键词则是通过至少N+1次片段输入操作实现输入的,即:目标搜索关键词为第二搜索关键词片段,或,目标搜索关键词是基于第二搜索关键词片段继续输入关键词得到的。例如:若第一搜索关键词片段为“好看的”,第二搜索关键词片段为“好看的电视”,那么目标搜索关键词可能为“好看的电视”(第二搜索关键词片段),或者在第二搜索关键词片段的基础上,继续执行片段输入操作,输入“XX”后得到的“好看的电视XX”。In one embodiment, when the second search keyword segment is obtained by the client in response to the N+1th (N is a positive integer) segment input operation, the target search keyword is obtained through at least N+1 segments The input operation realizes the input, that is, the target search keyword is the second search keyword segment, or the target search keyword is obtained by continuing to input keywords based on the second search keyword segment. For example: if the first search keyword segment is "good-looking" and the second search keyword segment is "good-looking TV", then the target search keyword may be "good-looking TV" (the second search keyword fragment), or On the basis of the second search keyword segment, continue to perform the segment input operation, and obtain "good-looking TV XX" after inputting "XX".
S509,若服务器的存储器中存在与目标搜索关键词相同的目标第二预测搜索关键词,服务器则从服务器的存储器中查找与目标第二预测搜索关键词对应的搜索数据。S509: If there is a target second predicted search keyword that is the same as the target search keyword in the memory of the server, the server searches the memory of the server for search data corresponding to the target second predicted search keyword.
本发明实施例中的步骤S509的具体实施方式可参见步骤S406所述,在此不再赘述。For a specific implementation manner of step S509 in this embodiment of the present invention, reference may be made to the description of step S406, and details are not described herein again.
S510,若服务器的存储器中不存在与目标搜索关键词相同的目标第二预测搜索关键词,且关键词搜索列表中也不存在与目标搜索关键词相同的预测搜索关键词,服务器则基于目标搜索关键词进行数据搜索,得到目标搜索关键词对应的搜索数据。S510, if the target second predicted search keyword that is the same as the target search keyword does not exist in the memory of the server, and the predicted search keyword that is the same as the target search keyword does not exist in the keyword search list, the server searches based on the target search keyword. The keyword performs data search to obtain search data corresponding to the target search keyword.
在一个实施例中,当服务器的存储器中不存在与目标搜索关键词相同的第二搜索关键词时,服务器将获取关键词搜索列表,并在关键词搜索列表中查找目标搜索关键词对应的预测搜索关键词,若该关键词搜索列表中也不存在该目标搜索关键词,服务器则基于目标搜索关键词进行数据搜索,以得到目标搜索关键词对应的搜索数据。In one embodiment, when there is no second search keyword that is the same as the target search keyword in the server's memory, the server will obtain a keyword search list, and search the keyword search list for the prediction corresponding to the target search keyword Search keywords. If the target search keyword does not exist in the keyword search list, the server performs data search based on the target search keyword to obtain search data corresponding to the target search keyword.
S511,服务器发送与目标搜索关键词对应的搜索数据至客户端。S511, the server sends search data corresponding to the target search keyword to the client.
S512,客户端接收并显示搜索数据。S512, the client receives and displays the search data.
在一个实施例中,本发明实施例中的步骤S511至步骤S512的具体实施例可参见步骤S407至步骤S408所述,在此不再赘述。In one embodiment, for specific embodiments of steps S511 to S512 in this embodiment of the present invention, reference may be made to the descriptions of steps S407 to S408, and details are not described herein again.
本发明实施例提供的数据搜索方法不仅通过在用户输入目标搜索关键词的过程中,获取搜索关键词片段(第一搜索关键词片段或第二搜索关键词片段)并基于搜索关键词片段对目标搜索关键词进行预测,然后根据预测得到的预测搜索关键词进行数据搜索并存储搜索数据,使得当用户输入的目标搜索关键词为预测搜索关键词中任意一个时,可直接从服务器的存储器中查找该目标搜索关键词对应的搜索数据,节省了服务器响应数据搜索的时间,同时还通过为存储器中的预测搜索关键词对应的搜索数据设置了存储有效期,超过存储有效期的搜索数据将不再被存储,保证了用户接收到的搜索数据的时效性。The data search method provided by the embodiment of the present invention not only obtains a search keyword segment (a first search keyword segment or a second search keyword segment) during the process of the user inputting a target search keyword, and searches the target keyword based on the search keyword segment Search keywords for prediction, and then perform data search according to the predicted predicted search keywords and store the search data, so that when the target search keyword input by the user is any of the predicted search keywords, it can be directly searched from the server's memory. The search data corresponding to the target search keyword saves the time for the server to respond to the data search. At the same time, the storage validity period is set for the search data corresponding to the predicted search keyword in the memory, and the search data that exceeds the storage validity period will no longer be stored. , which ensures the timeliness of the search data received by the user.
基于上述数据搜索方法实施例的描述,本发明实施例还公开了一种数据搜索装置,该数据搜索装置可以是运行于上述所提及的客户端中的一个计算机程序(包括程序代码)。该数据搜索装置可以执行图2所示的方法、图4所示的方法中的步骤S401、步骤S402、步骤S405和步骤S408,以及可执行图5所示的方法中的步骤S501、步骤S502、步骤S505、步骤S506、步骤S508和步骤S512。请参见图6,所述数据搜索装置可以包括:获取单元601,第一发送单元602和第一接收单元603。Based on the description of the above data search method embodiments, the embodiments of the present invention further disclose a data search apparatus, which may be a computer program (including program code) running in the above-mentioned client. The data searching apparatus can execute the method shown in FIG. 2, steps S401, S402, S405 and S408 in the method shown in FIG. Step S505, Step S506, Step S508 and Step S512. Referring to FIG. 6 , the data searching apparatus may include: an obtaining
获取单元601,用于响应于在输入目标搜索关键词的过程中的片段输入操作,获取第一搜索关键词片段,其中,所述目标搜索关键词包括所述第一搜索关键词片段;An obtaining
第一发送单元602,用于将所述第一搜索关键词片段发送至服务器;a
所述获取单元601,还用于响应于所述目标搜索关键词的输入操作,获取所述目标搜索关键词,并将所述目标搜索关键词发送至所述服务器;The obtaining
第一接收单元603,用于接收并显示所述服务器发送的所述搜索数据,所述搜索数据为所述服务器通过在服务器的存储器中查找与目标第一预测搜索关键词对应的搜索数据得到的;所述目标第一预测搜索关键词对应的搜索数据,是所述服务器基于第一预测搜索关键词进行数据搜索得到的,且所述目标第一预测搜索关键词对应的搜索数据和所述第一预测搜索关键词对应存储在所述服务器的存储器中;所述目标第一预测搜索关键词为所述服务器的存储器中与所述目标搜索关键词相同的第一预测搜索关键词;所述第一预测搜索关键词是服务器基于第一搜索关键词片段进行预测得到的,且所述第一预测搜索关键词包括所述第一搜索关键词片段;所述第一搜索关键词片段位于所述第一预测搜索关键词中除所述第一搜索关键词片段以外的字符的前面。The
根据本发明的一个实施例,图2所示的方法所涉及的各个步骤、图4所示的方法中的步骤S401、步骤S402、步骤S405和步骤S408,以及可执行图5所示的方法中的步骤S501、步骤S502、步骤S505、步骤S506、步骤S508和步骤S512,可以是由图6所示的数据搜索装置中的各个单元来执行的。例如,图2所示的步骤S201和步骤S203均可由图6所示的数据搜索装置中的获取单元601来执行,步骤S202可由图6所示的数据搜索装置中的第一发送单元602来执行,步骤S204可由图6所示的数据搜索装置中的第一接收单元603来执行;再如,图4所示的步骤S401和步骤S405均可由图6所示的数据搜索装置中的获取单元601来执行,步骤S402可由图6所示的数据搜索装置中的第一发送单元602来执行,步骤S408可由图6所示的数据搜索装置中的第一接收单元603来执行;再如,图5所示的步骤S501、步骤S505和步骤S508均可由图6所示的数据搜索装置中的获取单元601来执行,步骤S502和步骤S506均可由图6所示的数据搜索装置中的第一发送单元602来执行,步骤S512可由图6所示的数据搜索装置中的第一接收单元603来执行。According to an embodiment of the present invention, each step involved in the method shown in FIG. 2 , step S401 , step S402 , step S405 and step S408 in the method shown in FIG. The step S501, step S502, step S505, step S506, step S508 and step S512 of the above may be performed by each unit in the data search apparatus shown in FIG. 6 . For example, both steps S201 and S203 shown in FIG. 2 can be performed by the acquiring
根据本发明的另一个实施例,图6所示的数据搜索装置中的各个单元是基于逻辑功能划分的,上述各个单元可以分别或全部合并为一个或若干个另外的单元来构成,或者其中的某个(些)单元还可以再拆分为功能上更小的多个单元来构成,这可以实现同样的操作,而不影响本发明的实施例的技术效果的实现。在本发明的其它实施例中,上述数据搜索装置也可以包括其它单元,在实际应用中,这些功能也可以由其它单元协助实现,并且可以由多个单元协作实现。According to another embodiment of the present invention, each unit in the data search apparatus shown in FIG. 6 is divided based on logical functions, and each of the above-mentioned units may be respectively or all combined into one or several other units to form, or one of A certain unit(s) may be further divided into multiple units with smaller functions to form, which can realize the same operation without affecting the realization of the technical effect of the embodiments of the present invention. In other embodiments of the present invention, the above data searching apparatus may also include other units, and in practical applications, these functions may also be implemented with the assistance of other units, and may be implemented by cooperation of multiple units.
根据本发明的另一个实施例,可以通过在包括中央处理单元(CPU)、随机存取存储介质(RAM)、只读存储介质(ROM)等处理元件和存储元件的例如计算机的通用终端上运行能够执行如图2或图4所示的方法中的步骤S401、步骤S402、步骤S405和步骤S408,以及可执行图5所示的方法中的步骤S501、步骤S502、步骤S505、步骤S506、步骤S508和步骤S512所示方法所涉及的各步骤的计算机程序(包括程序代码),来构造如图6中所示的数据搜索装置,以及来实现本发明实施例的数据搜索方法。所述计算机程序可以记载于例如计算机存储介质上,并通过计算机存储介质装载于上述终端中,并在其中运行。According to another embodiment of the present invention, it can be run on a general-purpose terminal such as a computer by including processing elements such as a central processing unit (CPU), random access storage medium (RAM), read-only storage medium (ROM), etc. and storage elements Step S401, Step S402, Step S405 and Step S408 in the method shown in FIG. 2 or FIG. 4 can be performed, and Step S501, Step S502, Step S505, Step S506, Step S506 in the method shown in FIG. 5 can be performed. The computer programs (including program codes) involved in each step of the method shown in step S508 and step S512 are used to construct the data search apparatus shown in FIG. 6 and to implement the data search method of the embodiment of the present invention. The computer program can be recorded on, for example, a computer storage medium, loaded into the above-mentioned terminal through the computer storage medium, and executed therein.
本发明实施例提供的数据搜索装置能够通过获取并发送用户在输入目标搜索关键词的过程中产生的第一搜索关键词片段至服务器,使得服务器能基于第一搜索关键词片段进行关键词预测,得到第一预测搜索关键词;以及使得服务器基于第一预测关键词进行数据搜索,得到对应的搜索数据和使得服务器将该搜索数据存储至服务器的存储器中。实现了在用户输入了与第一预测搜索关键词相同的目标搜索关键词,并触发数据搜索操作之后,服务器可直接从存储器中获取搜索数据发送给用户所在客户端,极大地节省了服务器响应数据搜索的时间,进而提升了数据搜索的搜索速率。The data search device provided by the embodiment of the present invention can obtain and send the first search keyword segment generated by the user in the process of inputting the target search keyword to the server, so that the server can perform keyword prediction based on the first search keyword segment, obtaining a first predicted search keyword; and causing the server to perform a data search based on the first predicted keyword, obtaining corresponding search data, and causing the server to store the search data in the memory of the server. It is realized that after the user enters the same target search keyword as the first predicted search keyword and triggers the data search operation, the server can directly obtain the search data from the memory and send it to the client where the user is located, which greatly saves the server response data. Search time, and then improve the search rate of data search.
基于上述数据搜索方法实施例的描述,本发明实施例还公开了另一种数据搜索装置,该数据搜索装置可以是运行于上述所提及的服务器中的一个计算机程序(包括程序代码)。该数据搜索装置可以执行图4所示的方法中的步骤S403、步骤S404和、步骤S406和步骤S407,以及可执行图5所示的方法中的步骤S503、步骤S504、步骤S507和步骤S509至步骤S511。请参见图7,所述数据搜索装置可以包括:第二接收单元701,处理单元702,第二发送单元703。Based on the description of the above data search method embodiments, the embodiments of the present invention further disclose another data search apparatus, which may be a computer program (including program code) running in the above-mentioned server. The data searching apparatus can perform steps S403, S404 and S406 and S407 in the method shown in FIG. 4, and can perform steps S503, S504, S507 and S509 to Step S511. Referring to FIG. 7 , the data searching apparatus may include: a
第二接收单元701,用于接收客户端发送的第一搜索关键词片段;A
处理单元702,用于基于所述第一搜索关键词片段进行预测,得到第一预测搜索关键词,所述第一预测搜索关键词包括所述第一搜索关键词片段,且所述第一搜索关键词片段位于所述第一预测搜索关键词中除所述第一搜索关键词片段以外的字符的前面;A
所述处理单元702,还用于根据所述第一预测搜索关键词进行数据搜索,得到搜索数据,并将所述搜索数据和所述第一预测搜索关键词对应存储至所述服务器的存储器中;The
所述第二接收单元701,还用于接收所述客户端发送的目标搜索关键词,所述目标搜索关键词是所述客户端响应于所述目标搜索关键词的输入操作获取到的,所述目标搜索关键词包括所述第一搜索关键词片段;The
第二发送单元703,用于在所述服务器的存储器中存在与所述目标搜索关键词相同的目标第一预测搜索关键词时,从所述服务器的存储器中查找与所述目标第一预测搜索关键词对应的搜索数据,并将所述与所述目标第一预测搜索关键词对应的搜索数据发送至所述客户端。The
在一种实施方式中,所述第一预测搜索关键词的数量为至少两个;所述根据所述第一预测搜索关键词进行数据搜索,得到搜索数据之前,所述处理单元702还用于执行:In an embodiment, the number of the first predicted search keywords is at least two; before the data search is performed according to the first predicted search keywords to obtain search data, the
获取各个所述第一预测搜索关键词与所述第一搜索关键词片段的长度比值;obtaining the length ratio of each of the first predicted search keywords and the first search keyword segments;
在所述至少两个第一预测搜索关键词中确定长度比值大于比值阈值的第一预测搜索关键词;determining, among the at least two first predicted search keywords, a first predicted search keyword whose length ratio is greater than a ratio threshold;
所述处理单元702根据所述第一预测搜索关键词进行数据搜索时,具体执行:When performing data search according to the first predicted search keyword, the
根据长度比值大于比值阈值的第一预测搜索关键词进行数据搜索。Data search is performed according to the first predicted search keyword whose length ratio is greater than the ratio threshold.
在又一种实施方式中,所述第一搜索关键词片段是所述客户端响应于在输入目标搜索关键词的过程中的第N次片段输入操作获取到的,所述目标搜索关键词是通过至少N+1次片段输入操作实现输入的,N为正整数;所述处理单元702将所述搜索数据和所述第一预测搜索关键词对应存储至所述服务器的存储器中之后,还用于执行:In yet another embodiment, the first search keyword segment is obtained by the client in response to the Nth segment input operation in the process of inputting the target search keyword, and the target search keyword is If the input is achieved through at least N+1 segment input operations, N is a positive integer; after the
接收所述客户端发送的第二搜索关键词片段,其中,所述第二搜索关键词片段是所述客户端响应于第N+1次片段输入操作获取到的,所述第二搜索关键词片段包括所述第一搜索关键词片段,且所述第一搜索关键词片段位于所述第二搜索关键词片段中除所述第一搜索关键词片段以外的字符的前面;Receive a second search keyword segment sent by the client, wherein the second search keyword segment is obtained by the client in response to the N+1th segment input operation, and the second search keyword The fragment includes the first search keyword fragment, and the first search keyword fragment is located in front of characters other than the first search keyword fragment in the second search keyword fragment;
基于所述第二搜索关键词片段进行预测,得到第二预测搜索关键词;Predicting based on the second search keyword segment to obtain a second predicted search keyword;
若所述服务器的存储器中存在所述第二预测搜索关键词对应的搜索数据,则停止根据所述第二预测搜索关键词进行数据搜索。If there is search data corresponding to the second predicted search keyword in the memory of the server, the data search according to the second predicted search keyword is stopped.
在又一种实施方式中,所述第一预测搜索关键词的数量为至少一个;所述处理单元702基于所述第一搜索关键词片段进行预测,得到第一预测搜索关键词之后,还用于执行:In yet another embodiment, the number of the first predicted search keyword is at least one; the
获取关键词搜索列表,所述关键词搜索列表包括所述第一预测搜索关键词中处于数据搜索状态的预测搜索关键词;obtaining a keyword search list, where the keyword search list includes predicted search keywords in a data search state among the first predicted search keywords;
所述处理单元702基于所述第二搜索关键词片段进行预测,得到第二预测搜索关键词之后,还用于执行:The
若所述服务器的存储器中不存在所述第二预测搜索关键词对应的搜索数据,且所述关键词搜索列表中存在所述第二预测搜索关键词,则持续根据所述第二预测搜索关键词进行数据搜索;If the search data corresponding to the second predicted search keyword does not exist in the memory of the server, and the second predicted search keyword exists in the keyword search list, continue to search for the key according to the second predicted keyword word for data search;
若所述服务器的存储器中不存在所述第二预测搜索关键词对应的搜索数据,且所述关键词搜索列表中不存在所述第二预测搜索关键词,则根据所述第二预测搜索关键词进行数据搜索,得到所述第二预测搜索关键词对应的搜索数据。If the search data corresponding to the second predicted search keyword does not exist in the memory of the server, and the second predicted search keyword does not exist in the keyword search list, search the key according to the second prediction Searching data for the second predicted search keyword is performed to obtain search data corresponding to the second predicted search keyword.
在又一种实施方式中,所述处理单元702将所述搜索数据和所述第一预测搜索关键词对应存储至所述服务器的存储器中,具体执行:In yet another embodiment, the
生成所述搜索数据的存储有效期;generating a storage validity period for the search data;
所述处理单元702基于所述第二搜索关键词片段进行预测,得到第二预测搜索关键词之后,还用于执行:The
若所述服务器的存储器中存在所述第二预测搜索关键词对应的搜索数据,则对所述第二预测搜索关键词对应的搜索数据的存储有效期进行有效性验证;If there is search data corresponding to the second predicted search keyword in the memory of the server, verify the validity of the storage validity period of the search data corresponding to the second predicted search keyword;
若有效性验证失败,则重新根据所述第二预测搜索关键词进行数据搜索。If the validity verification fails, the data search is performed again according to the second predicted search keyword.
在又一种实施方式中,所述处理单元702基于所述搜索关键词片段进行预测,得到预测搜索关键词,具体用于执行:In yet another embodiment, the
获取所述客户端的用户画像;obtaining the user portrait of the client;
基于所述搜索关键词片段进行预测,得到与所述用户画像匹配的第一预测搜索关键词。Prediction is performed based on the search keyword segment, and a first predicted search keyword matching the user portrait is obtained.
在又一种实施方式中,所述处理单元702根据所述预测搜索关键词进行数据搜索,得到搜索数据,并将所述搜索数据和所述预测搜索关键词对应存储至所述服务器的存储器中,具体用于执行:In yet another embodiment, the
基于所述第一预测搜索关键词进行数据搜索,得到与所述客户端的用户画像匹配的搜索数据;Perform data search based on the first predicted search keyword to obtain search data matching the user portrait of the client;
将所述客户端的客户端标识和所述第一预测搜索关键词,以及所述与用户画像匹配的搜索数据对应存储至所述服务器的存储器中。The client identifier of the client, the first predicted search keyword, and the search data matching the user portrait are stored in the memory of the server correspondingly.
在又一种实施方式中,若所述服务器的存储器中存在与所述目标搜索关键词相同的目标预测搜索关键词,则所述处理单元702执行从所述服务器的存储器中查找与所述目标预测搜索关键词对应的搜索数据时,具体用于执行:In yet another embodiment, if there is a target predicted search keyword that is the same as the target search keyword in the memory of the server, the
根据所述客户端标识和所述目标预测搜索关键词,从所述服务器的存储器中查找与所述目标预测搜索关键词和所述客户端标识对应的搜索数据。According to the client identification and the target predicted search keyword, search data corresponding to the target predicted search keyword and the client identification from the memory of the server.
根据本发明的一个实施例,图4所示的数据搜索方法中的步骤S403、步骤S404和、步骤S406和步骤S407,以及可执行图5所示的方法中的步骤S503、步骤S504、步骤S507和步骤S509至步骤S511,可以是由图7所示的数据搜索装置中的各个单元来执行的。例如,图4中的步骤S403可由图7所示的数据搜索装置的第二接收单元701来执行,步骤S403、步骤S404和步骤S406均可由图7所示的数据搜索装置的处理单元702来执行,步骤S407可由图7所示的数据搜索装置的第二发送单元703来执行;再如,图5所示的数据搜索方法中的步骤S503可由图7所示的数据搜索装置的第二接收单元701来执行,步骤S504、步骤S507、步骤S509和步骤S510均可由图7所示的数据搜索装置的处理单元702来执行,步骤S511可由图7所示的数据搜索装置的第二发送单元703来执行。According to an embodiment of the present invention, steps S403, S404 and S406, and S407 in the data search method shown in FIG. 4, and steps S503, S504, and S507 in the method shown in FIG. 5 can be performed. And steps S509 to S511 may be performed by each unit in the data search apparatus shown in FIG. 7 . For example, step S403 in FIG. 4 can be executed by the
根据本发明的另一个实施例,图7所示的数据搜索装置中的各个单元是基于逻辑功能划分的,上述各个单元可以分别或全部合并为一个或若干个另外的单元来构成,或者其中的某个(些)单元还可以再拆分为功能上更小的多个单元来构成,这可以实现同样的操作,而不影响本发明的实施例的技术效果的实现。在本发明的其它实施例中,上述数据搜索装置也可以包括其它单元,在实际应用中,这些功能也可以由其它单元协助实现,并且可以由多个单元协作实现。According to another embodiment of the present invention, each unit in the data search apparatus shown in FIG. 7 is divided based on logical functions, and each of the above-mentioned units may be respectively or all combined into one or several other units to form, or one of the above A certain unit(s) may be further divided into multiple units with smaller functions to form, which can realize the same operation without affecting the realization of the technical effect of the embodiments of the present invention. In other embodiments of the present invention, the above data searching apparatus may also include other units, and in practical applications, these functions may also be implemented with the assistance of other units, and may be implemented by cooperation of multiple units.
根据本发明的另一个实施例,可以通过在包括中央处理单元(CPU)、随机存取存储介质(RAM)、只读存储介质(ROM)等处理元件和存储元件的服务器上运行,能够执行如图4所示的方法中的步骤S403、步骤S404和、步骤S406和步骤S407,以及可执行图5所示的方法中的步骤S503、步骤S504、步骤S507和步骤S509至步骤S511所涉及的各步骤的计算机程序(包括程序代码),来构造如图7中所示的数据搜索装置,以及来实现本发明实施例的数据搜索方法。所述计算机程序可以记载于例如计算机存储介质上,并通过计算机存储介质装载于上述服务器中,并在其中运行。According to another embodiment of the present invention, by running on a server including processing elements and storage elements such as a central processing unit (CPU), random access storage medium (RAM), read only storage medium (ROM), and storage elements, such as Steps S403, S404 and S406 and S407 in the method shown in FIG. 4, and steps S503, S504, S507, and S509 to S511 in the method shown in FIG. 5 can be performed. The computer program (including program code) of the steps is used to construct the data search apparatus as shown in FIG. 7, and to realize the data search method of the embodiment of the present invention. The computer program can be recorded on, for example, a computer storage medium, loaded into the above-mentioned server via the computer storage medium, and executed there.
本发明实施例提供的数据搜索装置能够通过第二接收单元接收客户端发送的用户在输入目标搜索关键词的过程中产生的第一搜索关键词片段,并采用处理单元基于第一搜索关键词片段进行关键词预测,得到第一预测搜索关键词;以及基于第一预测关键词进行数据搜索,得到对应的搜索数据,将该搜索数据存储至服务器的存储器中,实现了在接收到用户输入的与第一预测搜索关键词相同的目标搜索关键词之后,第二发送单元直接从存储器中获取搜索数据发送给用户所在客户端,极大地节省了服务器响应数据搜索的时间,进而提升了数据搜索的搜索速率。The data search apparatus provided by the embodiment of the present invention can receive, through the second receiving unit, the first search keyword segment generated by the user in the process of inputting the target search keyword and sent by the client, and use a processing unit based on the first search keyword segment Perform keyword prediction to obtain a first predicted search keyword; and perform a data search based on the first predicted keyword to obtain corresponding search data, and store the search data in the memory of the server, so as to realize that after receiving the user input and After the first predicting the target search keyword with the same search keyword, the second sending unit directly obtains the search data from the memory and sends it to the client where the user is located, which greatly saves the time for the server to respond to the data search, thereby improving the search for data search. rate.
基于上述方法实施例以及装置实施例的描述,本发明实施例还提供了一种终端。请参见图8,该终端包括处理器801、输入接口802、输出接口803以及计算机存储介质804,且终端内的处理器801、输入接口802、输出接口803以及计算机存储介质804可通过总线或其他方式连接。Based on the descriptions of the foregoing method embodiments and apparatus embodiments, an embodiment of the present invention further provides a terminal. 8, the terminal includes a
所述计算机存储介质804是终端中的记忆设备,用于存放程序和数据。可以理解的是,此处的计算机存储介质804既可以包括终端中的内置存储介质,当然也可以包括终端所支持的扩展存储介质。计算机存储介质804提供存储空间,该存储空间存储了终端的操作系统。并且,在该存储空间中还存放了适于被处理器801加载并执行的一条或多条的计算机程序。需要说明的是,此处的计算机存储介质可以是高速RAM存储器,也可以是非不稳定的存储器(non-volatile memory),例如至少一个磁盘存储器;可选的,还可以是至少一个位于远离前述处理器的计算机存储介质。所述处理器801(或称CPU(Central Processing Unit,中央处理器))是终端的计算核心以及控制核心,其适于实现一条或多条计算机程序,具体适于加载并执行一条或多条计算机程序从而实现相应方法流程或相应功能。The
在一个实施例中,终端可以执行上述实施例中客户端所执行的步骤,即可由处理器801加载并执行计算机存储介质804中存放的一条或多条计算机程序,以实现上述有关图2所示的方法和图4所示的方法中的步骤S401、步骤S402、步骤S405和步骤S408,以及图5所示的方法中的步骤S501、步骤S502、步骤S505、步骤S506、步骤S508和步骤S512。具体实现中,计算机存储介质804中的一条或多条计算机程序由处理器801加载并执行:In one embodiment, the terminal may perform the steps performed by the client in the foregoing embodiment, that is, the
响应于在输入目标搜索关键词的过程中的片段输入操作,获取第一搜索关键词片段,其中,所述目标搜索关键词包括所述第一搜索关键词片段;将所述第一搜索关键词片段发送至服务器;响应于所述目标搜索关键词的输入操作,获取所述目标搜索关键词,并将所述目标搜索关键词发送至所述服务器;接收并显示所述服务器发送的所述搜索数据,所述搜索数据为所述服务器通过在服务器的存储器中查找与目标第一预测搜索关键词对应的搜索数据得到的;所述目标第一预测搜索关键词对应的搜索数据,是所述服务器基于第一预测搜索关键词进行数据搜索得到的,且所述目标第一预测搜索关键词对应的搜索数据和所述第一预测搜索关键词对应存储在所述服务器的存储器中;所述目标第一预测搜索关键词为所述服务器的存储器中与所述目标搜索关键词相同的第一预测搜索关键词;所述第一预测搜索关键词是服务器基于第一搜索关键词片段进行预测得到的,且所述第一预测搜索关键词包括所述第一搜索关键词片段;所述第一搜索关键词片段位于所述第一预测搜索关键词中除所述第一搜索关键词片段以外的字符的前面。In response to a fragment input operation in the process of inputting the target search keyword, a first search keyword fragment is obtained, wherein the target search keyword includes the first search keyword fragment; The segment is sent to the server; in response to the input operation of the target search keyword, the target search keyword is acquired, and the target search keyword is sent to the server; the search sent by the server is received and displayed data, the search data is obtained by the server by looking up the search data corresponding to the target first predicted search keyword in the memory of the server; the search data corresponding to the target first predicted search keyword is the server The search data corresponding to the target first predicted search keyword and the first predicted search keyword are correspondingly stored in the memory of the server, obtained by performing data search based on the first predicted search keyword; A predicted search keyword is the first predicted search keyword in the memory of the server that is the same as the target search keyword; the first predicted search keyword is predicted by the server based on the first search keyword segment, And the first predicted search keyword includes the first search keyword segment; the first search keyword segment is located in the first predicted search keyword except for the first search keyword segment. Front.
在本发明实施例中,终端通过获取并发送用户在输入目标搜索关键词的过程中产生的第一搜索关键词片段至服务器,使得服务器能基于第一搜索关键词片段进行关键词预测,得到第一预测搜索关键词;以及使得服务器基于第一预测关键词进行数据搜索,得到对应的搜索数据和使得服务器将该搜索数据存储至服务器的存储器中。实现了在用户输入了与第一预测搜索关键词相同的目标搜索关键词,并触发数据搜索操作之后,服务器可直接从存储器中获取搜索数据发送给用户所在客户端,极大地节省了服务器响应数据搜索的时间,进而提升了数据搜索的搜索速率。In the embodiment of the present invention, the terminal obtains and sends the first search keyword segment generated by the user in the process of inputting the target search keyword to the server, so that the server can perform keyword prediction based on the first search keyword segment, and obtain the first search keyword segment. a predicted search keyword; and causing the server to perform a data search based on the first predicted keyword, obtaining corresponding search data, and causing the server to store the search data in the memory of the server. It is realized that after the user enters the same target search keyword as the first predicted search keyword and triggers the data search operation, the server can directly obtain the search data from the memory and send it to the client where the user is located, which greatly saves the server response data. Search time, and then improve the search rate of data search.
基于上述方法实施例以及装置实施例的描述,本发明实施例提供了一种服务器。请参见图9,该服务器包括处理器901、输入接口902、输出接口903以及计算机存储介质904,且服务器内的处理器901、输入接口902、输出接口903以及计算机存储介质904可通过总线或其他方式连接。Based on the descriptions of the foregoing method embodiments and apparatus embodiments, the embodiments of the present invention provide a server. 9, the server includes a
所述计算机存储介质904是服务器中的记忆设备,用于存放程序和数据。可以理解的是,此处的计算机存储介质904既可以包括服务器中的内置存储介质,当然也可以包括服务器所支持的扩展存储介质。计算机存储介质904提供存储空间,该存储空间存储了服务器的操作系统。并且,在该存储空间中还存放了适于被处理器901加载并执行的一条或多条的计算机程序。需要说明的是,此处的计算机存储介质可以是高速RAM存储器,也可以是非不稳定的存储器(non-volatile memory),例如至少一个磁盘存储器;可选的,还可以是至少一个位于远离前述处理器的计算机存储介质。所述处理器901(或称CPU(CentralProcessing Unit,中央处理器))是服务器的计算核心以及控制核心,其适于实现一条或多条计算机程序,具体适于加载并执行一条或多条计算机程序从而实现相应方法流程或相应功能。The
在一个实施例中,服务器可以执行上述实施例中服务器所执行的步骤,即可由处理器901加载并执行计算机存储介质904中存放的一条或多条计算机程序,以实现上述有关图4所示的方法中的步骤S403、步骤S404和、步骤S406和步骤S407,以及有关图5所示的方法中的步骤S503、步骤S504、步骤S507和步骤S509至步骤S511。具体实现中,计算机存储介质904中的一条或多条计算机程序由处理器901加载并执行:In one embodiment, the server may perform the steps performed by the server in the foregoing embodiment, that is, the
接收客户端发送的第一搜索关键词片段,并基于所述第一搜索关键词片段进行预测,得到第一预测搜索关键词,所述第一预测搜索关键词包括所述第一搜索关键词片段,且所述第一搜索关键词片段位于所述第一预测搜索关键词中除所述第一搜索关键词片段以外的字符的前面;根据所述第一预测搜索关键词进行数据搜索,得到搜索数据,并将所述搜索数据和所述第一预测搜索关键词对应存储至所述服务器的存储器中;接收所述客户端发送的目标搜索关键词,所述目标搜索关键词是所述客户端响应于所述目标搜索关键词的输入操作获取到的,所述目标搜索关键词包括所述第一搜索关键词片段;若所述服务器的存储器中存在与所述目标搜索关键词相同的目标第一预测搜索关键词,则从所述服务器的存储器中查找与所述目标第一预测搜索关键词对应的搜索数据,并将所述与所述目标第一预测搜索关键词对应的搜索数据发送至所述客户端。Receive the first search keyword segment sent by the client, and perform prediction based on the first search keyword segment to obtain a first predicted search keyword, where the first predicted search keyword includes the first search keyword segment , and the first search keyword segment is located in front of the characters other than the first search keyword segment in the first predicted search keyword; data search is performed according to the first predicted search keyword, and a search result is obtained. data, and store the search data and the first predicted search keyword in the memory of the server correspondingly; receive the target search keyword sent by the client, and the target search keyword is the client Obtained in response to the input operation of the target search keyword, the target search keyword includes the first search keyword segment; if there is a target first search keyword that is the same as the target search keyword in the memory of the server Once a predicted search keyword is found, the search data corresponding to the target first predicted search keyword is searched from the memory of the server, and the search data corresponding to the target first predicted search keyword is sent to the client.
在一种实施方式中,所述第一预测搜索关键词的数量为至少两个;所述处理器901根据所述第一预测搜索关键词进行数据搜索,得到搜索数据之前,还用于执行:In one embodiment, the number of the first predicted search keywords is at least two; the
获取各个所述第一预测搜索关键词与所述第一搜索关键词片段的长度比值;obtaining the length ratio of each of the first predicted search keywords and the first search keyword segments;
在所述至少两个第一预测搜索关键词中确定长度比值大于比值阈值的第一预测搜索关键词;determining, among the at least two first predicted search keywords, a first predicted search keyword whose length ratio is greater than a ratio threshold;
所述处理器901根据所述第一预测搜索关键词进行数据搜索,具体执行:The
根据长度比值大于比值阈值的第一预测搜索关键词进行数据搜索。Data search is performed according to the first predicted search keyword whose length ratio is greater than the ratio threshold.
在又一种实施方式中,所述第一搜索关键词片段是所述客户端响应于在输入目标搜索关键词的过程中的第N次片段输入操作获取到的,所述目标搜索关键词是通过至少N+1次片段输入操作实现输入的,N为正整数;所述处理器901将所述搜索数据和所述第一预测搜索关键词对应存储至所述服务器的存储器中之后,所述处理器901还用于执行:In yet another embodiment, the first search keyword segment is obtained by the client in response to the Nth segment input operation in the process of inputting the target search keyword, and the target search keyword is If the input is achieved through at least N+1 segment input operations, N is a positive integer; after the
接收所述客户端发送的第二搜索关键词片段,其中,所述第二搜索关键词片段是所述客户端响应于第N+1次片段输入操作获取到的,所述第二搜索关键词片段包括所述第一搜索关键词片段,且所述第一搜索关键词片段位于所述第二搜索关键词片段中除所述第一搜索关键词片段以外的字符的前面;Receive a second search keyword segment sent by the client, wherein the second search keyword segment is obtained by the client in response to the N+1th segment input operation, and the second search keyword The fragment includes the first search keyword fragment, and the first search keyword fragment is located in front of characters other than the first search keyword fragment in the second search keyword fragment;
基于所述第二搜索关键词片段进行预测,得到第二预测搜索关键词;Predicting based on the second search keyword segment to obtain a second predicted search keyword;
若所述服务器的存储器中存在所述第二预测搜索关键词对应的搜索数据,则停止根据所述第二预测搜索关键词进行数据搜索。If there is search data corresponding to the second predicted search keyword in the memory of the server, the data search according to the second predicted search keyword is stopped.
在又一种实施方式中,所述第一预测搜索关键词的数量为至少一个;所述处理器901基于所述第一搜索关键词片段进行预测,得到第一预测搜索关键词之后,还用于执行:In yet another embodiment, the number of the first predicted search keyword is at least one; the
获取关键词搜索列表,所述关键词搜索列表包括所述第一预测搜索关键词中处于数据搜索状态的预测搜索关键词;obtaining a keyword search list, where the keyword search list includes predicted search keywords in a data search state among the first predicted search keywords;
所述处理器901基于所述第二搜索关键词片段进行预测,得到第二预测搜索关键词之后,还用于执行:The
若所述服务器的存储器中不存在所述第二预测搜索关键词对应的搜索数据,且所述关键词搜索列表中存在所述第二预测搜索关键词,则持续根据所述第二预测搜索关键词进行数据搜索;If the search data corresponding to the second predicted search keyword does not exist in the memory of the server, and the second predicted search keyword exists in the keyword search list, continue to search for the key according to the second predicted keyword word for data search;
若所述服务器的存储器中不存在所述第二预测搜索关键词对应的搜索数据,且所述关键词搜索列表中不存在所述第二预测搜索关键词,则根据所述第二预测搜索关键词进行数据搜索,得到所述第二预测搜索关键词对应的搜索数据。If the search data corresponding to the second predicted search keyword does not exist in the memory of the server, and the second predicted search keyword does not exist in the keyword search list, search the key according to the second prediction Searching data for the second predicted search keyword is performed to obtain search data corresponding to the second predicted search keyword.
在又一种实施方式中,所述处理器901将所述搜索数据和所述第一预测搜索关键词对应存储至所述服务器的存储器中,具体执行:In yet another embodiment, the
生成所述搜索数据的存储有效期;generating a storage validity period for the search data;
所述处理器901基于所述第二搜索关键词片段进行预测,得到第二预测搜索关键词之后,还用于执行:The
若所述服务器的存储器中存在所述第二预测搜索关键词对应的搜索数据,则对所述第二预测搜索关键词对应的搜索数据的存储有效期进行有效性验证;If there is search data corresponding to the second predicted search keyword in the memory of the server, verify the validity of the storage validity period of the search data corresponding to the second predicted search keyword;
若有效性验证失败,则重新根据所述第二预测搜索关键词进行数据搜索。If the validity verification fails, the data search is performed again according to the second predicted search keyword.
在又一种实施方式中,所述处理器901基于所述搜索关键词片段进行预测,得到预测搜索关键词,具体执行:In yet another embodiment, the
获取所述客户端的用户画像;obtaining the user portrait of the client;
基于所述搜索关键词片段进行预测,得到与所述用户画像匹配的第一预测搜索关键词。Prediction is performed based on the search keyword segment, and a first predicted search keyword matching the user portrait is obtained.
在又一种实施方式中,所述处理器901执行所述根据所述预测搜索关键词进行数据搜索,得到搜索数据,并将所述搜索数据和所述预测搜索关键词对应存储至所述服务器的存储器中,具体执行:In yet another embodiment, the
基于所述第一预测搜索关键词进行数据搜索,得到与所述客户端的用户画像匹配的搜索数据;Perform data search based on the first predicted search keyword to obtain search data matching the user portrait of the client;
将所述客户端的客户端标识和所述第一预测搜索关键词,以及所述与用户画像匹配的搜索数据对应存储至所述服务器的存储器中。The client identifier of the client, the first predicted search keyword, and the search data matching the user portrait are stored in the memory of the server correspondingly.
在又一种实施方式中,若所述服务器的存储器中存在与所述目标搜索关键词相同的目标预测搜索关键词,则所述处理器901从所述服务器的存储器中查找与所述目标预测搜索关键词对应的搜索数据,具体执行:In yet another embodiment, if there is a target prediction search keyword that is the same as the target search keyword in the memory of the server, the
根据所述客户端标识和所述目标预测搜索关键词,从所述服务器的存储器中查找与所述目标预测搜索关键词和所述客户端标识对应的搜索数据。According to the client identification and the target predicted search keyword, search data corresponding to the target predicted search keyword and the client identification from the memory of the server.
在本发明实施例中,服务器能够通过处理器接收客户端发送的用户在输入目标搜索关键词的过程中产生的第一搜索关键词片段,并采用处理单元基于第一搜索关键词片段进行关键词预测,得到第一预测搜索关键词;以及通过处理器基于第一预测关键词进行数据搜索,得到对应的搜索数据,将该搜索数据存储至服务器的存储器中,实现了在接收到用户输入的与第一预测搜索关键词相同的目标搜索关键词之后,第二发送单元直接从存储器中获取搜索数据发送给用户所在客户端,极大地节省了服务器响应数据搜索的时间,进而提升了数据搜索的搜索速率。In the embodiment of the present invention, the server can receive, through the processor, the first search keyword segment generated by the user in the process of inputting the target search keyword and sent by the client, and use the processing unit to perform keyword search based on the first search keyword segment Predict to obtain the first predicted search keyword; and perform a data search based on the first predicted keyword by the processor to obtain corresponding search data, and store the search data in the memory of the server, so as to realize that after receiving the user input and the After the first predicting the target search keyword with the same search keyword, the second sending unit directly obtains the search data from the memory and sends it to the client where the user is located, which greatly saves the time for the server to respond to the data search, thereby improving the search for data search. rate.
本发明实施例还提供了一种计算机存储介质,该计算机存储介质中存储了上述数据搜索方法的计算机程序,当一个或多个处理器加载并执行该计算机程序,可以实现实施例中对数据搜索方法的描述,在此不再赘述。对采用相同方法的有益效果的描述,在此不再赘述。可以理解的是,计算机程序可以被部署在一个或多个能够相互通信的设备上执行。An embodiment of the present invention also provides a computer storage medium, in which a computer program for the above data search method is stored. When one or more processors load and execute the computer program, the data search method in the embodiment can be implemented. The description of the method will not be repeated here. The description of the beneficial effects of using the same method will not be repeated here. It will be appreciated that a computer program may be deployed and executed on one or more devices capable of communicating with each other.
需要说明的是,根据本发明的一个方面,还提供了一种计算机程序产品或计算机程序,该计算机程序产品包括计算机程序,该计算机程序存储在计算机可读存储介质中。终端中的处理器从计算机可读存储介质读取该计算机程序,处理器执行该计算机程序,使得该终端执行:It should be noted that, according to an aspect of the present invention, there is also provided a computer program product or a computer program, where the computer program product includes a computer program, and the computer program is stored in a computer-readable storage medium. The processor in the terminal reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the terminal executes:
响应于在输入目标搜索关键词的过程中的片段输入操作,获取第一搜索关键词片段,其中,所述目标搜索关键词是通过至少两次片段输入操作实现输入的,所述目标搜索关键词包括所述第一搜索关键词片段;将所述第一搜索关键词片段发送至服务器;响应于所述目标搜索关键词的输入操作,获取所述目标搜索关键词,并将所述目标搜索关键词发送至所述服务器;接收并显示所述服务器发送的所述搜索数据,所述搜索数据为所述服务器通过在服务器的存储器中查找与目标第一预测搜索关键词对应的搜索数据得到的;所述目标第一预测搜索关键词对应的搜索数据,是所述服务器基于第一预测搜索关键词进行数据搜索得到的,且所述目标第一预测搜索关键词对应的搜索数据和所述第一预测搜索关键词对应存储在所述服务器的存储器中;所述目标第一预测搜索关键词为所述服务器的存储器中与所述目标搜索关键词相同的第一预测搜索关键词;所述第一预测搜索关键词是服务器基于第一搜索关键词片段进行预测得到的,且所述第一预测搜索关键词包括所述第一搜索关键词片段;所述第一搜索关键词片段位于所述第一预测搜索关键词中除所述第一搜索关键词片段以外的字符的前面。In response to a fragment input operation in the process of inputting a target search keyword, a first search keyword fragment is obtained, wherein the target search keyword is input through at least two fragment input operations, and the target search keyword is input through at least two fragment input operations. Including the first search keyword segment; sending the first search keyword segment to the server; in response to the input operation of the target search keyword, acquiring the target search keyword, and sending the target search keyword sending the word to the server; receiving and displaying the search data sent by the server, the search data obtained by the server by searching the search data corresponding to the target first predicted search keyword in the memory of the server; The search data corresponding to the target first predicted search keyword is obtained by the server performing data search based on the first predicted search keyword, and the search data corresponding to the target first predicted search keyword and the first predicted search keyword are obtained. The predicted search keyword is correspondingly stored in the memory of the server; the target first predicted search keyword is the same first predicted search keyword as the target search keyword in the memory of the server; the first predicted search keyword is the same as the target search keyword. The predicted search keyword is predicted by the server based on the first search keyword segment, and the first predicted search keyword includes the first search keyword segment; the first search keyword segment is located in the first search keyword segment. Predicting the front of characters in the search keyword other than the first search keyword segment.
根据本发明的另一个方面,还提供了又一种计算机程序产品或计算机程序,该计算机程序产品包括计算机程序,该计算机程序存储在计算机可读存储介质中。服务器中的处理器从计算机可读存储介质读取该计算机程序,处理器执行该计算机程序,使得该服务器执行:According to another aspect of the present invention, there is also provided yet another computer program product or computer program, the computer program product comprising a computer program, the computer program being stored in a computer-readable storage medium. The processor in the server reads the computer program from the computer-readable storage medium, the processor executes the computer program, causing the server to execute:
接收客户端发送的第一搜索关键词片段,并基于所述第一搜索关键词片段进行预测,得到第一预测搜索关键词,所述第一预测搜索关键词包括所述第一搜索关键词片段,且所述第一搜索关键词片段位于所述第一预测搜索关键词中除所述第一搜索关键词片段以外的字符的前面;根据所述第一预测搜索关键词进行数据搜索,得到搜索数据,并将所述搜索数据和所述第一预测搜索关键词对应存储至所述服务器的存储器中;接收所述客户端发送的目标搜索关键词,所述目标搜索关键词是所述客户端响应于所述目标搜索关键词的输入操作获取到的,所述目标搜索关键词包括所述第一搜索关键词片段;若所述服务器的存储器中存在与所述目标搜索关键词相同的目标第一预测搜索关键词,则从所述服务器的存储器中查找与所述目标第一预测搜索关键词对应的搜索数据,并将所述与所述目标第一预测搜索关键词对应的搜索数据发送至所述客户端。Receive the first search keyword segment sent by the client, and perform prediction based on the first search keyword segment to obtain a first predicted search keyword, where the first predicted search keyword includes the first search keyword segment , and the first search keyword segment is located in front of the characters other than the first search keyword segment in the first predicted search keyword; data search is performed according to the first predicted search keyword, and a search result is obtained. data, and store the search data and the first predicted search keyword in the memory of the server correspondingly; receive the target search keyword sent by the client, and the target search keyword is the client Obtained in response to the input operation of the target search keyword, the target search keyword includes the first search keyword segment; if there is a target first search keyword that is the same as the target search keyword in the memory of the server Once a predicted search keyword is found, the search data corresponding to the target first predicted search keyword is searched from the memory of the server, and the search data corresponding to the target first predicted search keyword is sent to the client.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序相关的硬件来完成,所述的计算机程序可存储于一计算机存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的计算机存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(RandomAccess Memory,RAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by hardware related to computer programs. The computer programs can be stored in a computer storage medium, and when the computer programs are executed , which may include the processes of the above-mentioned method embodiments. The computer storage medium may be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM) or the like.
以上所揭露的仅为本发明的局部实施例而已,当然不能以此来限定本发明之权利范围,本领域普通技术人员可以理解实现上述实施例的全部或局部流程,并依本发明权利要求所作的等同变化,仍属于发明所涵盖的范围。The above disclosure is only a partial embodiment of the present invention, and of course, it cannot limit the scope of the right of the present invention. Those of ordinary skill in the art can understand the whole or part of the process of realizing the above embodiment, and make according to the claims of the present invention. The equivalent changes of the invention still belong to the scope covered by the invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110304731.5A CN115114504A (en) | 2021-03-22 | 2021-03-22 | A data search method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110304731.5A CN115114504A (en) | 2021-03-22 | 2021-03-22 | A data search method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115114504A true CN115114504A (en) | 2022-09-27 |
Family
ID=83323413
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110304731.5A Pending CN115114504A (en) | 2021-03-22 | 2021-03-22 | A data search method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115114504A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117520686A (en) * | 2023-11-20 | 2024-02-06 | 广州方舟信息科技有限公司 | Search preloading method, device, electronic equipment and storage medium |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050283468A1 (en) * | 2004-06-22 | 2005-12-22 | Kamvar Sepandar D | Anticipated query generation and processing in a search engine |
CN101194256A (en) * | 2004-11-12 | 2008-06-04 | 谷歌公司 | Method and system for autocompletion for languages having ideographs and phonetic characters |
CN101261637A (en) * | 2007-03-08 | 2008-09-10 | 国际商业机器公司 | System and method of searching key word for determining event happening |
CN103064853A (en) * | 2011-10-20 | 2013-04-24 | 北京百度网讯科技有限公司 | Search suggestion generation method, device and system |
CN103631826A (en) * | 2012-08-28 | 2014-03-12 | 深圳市世纪光速信息技术有限公司 | Search method and search device |
CN107291772A (en) * | 2016-04-11 | 2017-10-24 | 北京搜狗科技发展有限公司 | One kind search access method, device and electronic equipment |
CN109690531A (en) * | 2016-09-19 | 2019-04-26 | 电子湾有限公司 | Prediction-based instant search |
CN110046298A (en) * | 2019-04-24 | 2019-07-23 | 中国人民解放军国防科技大学 | Query word recommendation method, apparatus, terminal device, and computer-readable medium |
CN110851722A (en) * | 2019-11-12 | 2020-02-28 | 腾讯云计算(北京)有限责任公司 | Dictionary tree-based search processing method, device, device and storage medium |
-
2021
- 2021-03-22 CN CN202110304731.5A patent/CN115114504A/en active Pending
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050283468A1 (en) * | 2004-06-22 | 2005-12-22 | Kamvar Sepandar D | Anticipated query generation and processing in a search engine |
CN101194256A (en) * | 2004-11-12 | 2008-06-04 | 谷歌公司 | Method and system for autocompletion for languages having ideographs and phonetic characters |
CN101261637A (en) * | 2007-03-08 | 2008-09-10 | 国际商业机器公司 | System and method of searching key word for determining event happening |
CN103064853A (en) * | 2011-10-20 | 2013-04-24 | 北京百度网讯科技有限公司 | Search suggestion generation method, device and system |
CN103631826A (en) * | 2012-08-28 | 2014-03-12 | 深圳市世纪光速信息技术有限公司 | Search method and search device |
CN107291772A (en) * | 2016-04-11 | 2017-10-24 | 北京搜狗科技发展有限公司 | One kind search access method, device and electronic equipment |
CN109690531A (en) * | 2016-09-19 | 2019-04-26 | 电子湾有限公司 | Prediction-based instant search |
CN110046298A (en) * | 2019-04-24 | 2019-07-23 | 中国人民解放军国防科技大学 | Query word recommendation method, apparatus, terminal device, and computer-readable medium |
CN110851722A (en) * | 2019-11-12 | 2020-02-28 | 腾讯云计算(北京)有限责任公司 | Dictionary tree-based search processing method, device, device and storage medium |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117520686A (en) * | 2023-11-20 | 2024-02-06 | 广州方舟信息科技有限公司 | Search preloading method, device, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
AU2016382908B2 (en) | Short link processing method, device and server | |
US9544355B2 (en) | Methods and apparatus for realizing short URL service | |
US9641468B2 (en) | Method, server, client, and system for releasing instant messaging key-value data | |
WO2016023357A1 (en) | Webpage access method and apparatus, and router | |
WO2017092351A1 (en) | Cache data update method and device | |
US9723052B2 (en) | Utilizing content via personal clouds | |
WO2017114206A1 (en) | Method and device for processing short link, and short link server | |
CN103348344A (en) | Compound statement indexing for graph data | |
TWI652586B (en) | Group search method and device based on social network | |
CN113407662B (en) | Sensitive word recognition method, system and computer readable storage medium | |
WO2015074459A1 (en) | Method and apparatus for opening webpage, invoking client, and creating light app | |
US20170155712A1 (en) | Method and device for updating cache data | |
CN106534268B (en) | Data sharing method and device | |
US20170134364A1 (en) | Note update method and device | |
CN106933817B (en) | Content query method, device and system based on B/S structure | |
WO2025190229A2 (en) | Search method and apparatus, and device and storage medium | |
CN115098810A (en) | Page data caching method and related equipment thereof | |
CN110020272B (en) | Caching method, device and computer storage medium | |
KR102158389B1 (en) | Operating method of node considering packet characteristics in content centric network and the node | |
CN115114504A (en) | A data search method and device | |
CN103957252B (en) | The journal obtaining method and its system of cloud stocking system | |
CN105610596B (en) | Resource directory management method and network terminal | |
CN103793459B (en) | A method and device for opening a web page | |
CN107153674B (en) | A method and system for displaying live room information | |
CN114860469B (en) | Data acquisition method, device, computer equipment and storage medium |
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 |