Search method, search device, electronic device and storage medium
By predicting the target resources associated with the input keywords in real time on the client and pre-rendering, the problem of slow search response speed in the prior art is solved, and a fast response and low-latency search experience is achieved.
Patent Information
- Application Number
- CN202011020714.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-25
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2040-09-25
AI Technical Summary
Among the existing search methods, the search response speed is slow. Users need to wait for the user to enter a search command before initiating a search request to the server, resulting in a delay in response.
After receiving the keyword entered by the user, the client predicts the target keyword or target page with high correlation with the keyword in real time, and pre-renders the server when returning the resource, loads the target resource in advance, and reduces the waiting time. .
By loading the resources of the search result page or target page in advance, the search response speed is significantly improved and the user's waiting time is reduced.
Smart Images

Figure CN112100481B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, in particular to the field of search technology, and specifically to a search method, a search device, an electronic device and a storage medium. Background Art
[0002] At present, when users search on the Internet, they usually enter keywords in the search box and initiate a search command (such as clicking a search button or pressing the Enter key), and then initiate a search request to the server. After receiving the resources of the search result page returned by the server, the client renders the page according to the resources of the search result page returned by the server. In the existing search method, the search response speed is slow. Summary of the invention
[0003] The present application provides a search method, a search device, an electronic device, a storage medium and a computer program product.
[0004] According to a first aspect, the present application provides a search method, comprising:
[0005] receiving a first keyword input by a user;
[0006] If the correlation between the first keyword and the target keyword or the target page meets the preset condition, then receiving the target resource sent by the server; the target resource is the resource of the search result page corresponding to the target keyword or the resource of the target page;
[0007] In the process of the server returning the target resource, pre-rendering the returned resource in the target container;
[0008] If a first search instruction input by a user is detected, the resources in the target container are output in response to the first search instruction; the first search instruction is an instruction for searching the target keyword or the target page.
[0009] According to a second aspect, the present application provides a search device, including:
[0010] A first receiving module, used for receiving a first keyword input by a user;
[0011] A second receiving module is used to receive the target resource sent by the server if the correlation between the first keyword and the target keyword or the target page meets the preset condition; the target resource is the resource of the search result page corresponding to the target keyword or the resource of the target page;
[0012] A first pre-rendering module, configured to pre-render the returned resource in a target container during the process of the server returning the target resource;
[0013] The first output module is used to output the resources in the target container in response to a first search instruction if a first search instruction input by a user is detected; the first search instruction is an instruction for searching the target keyword or the target page.
[0014] According to a third aspect, the present application provides an electronic device, including:
[0015] at least one processor; and
[0016] a memory communicatively connected to at least one processor; wherein,
[0017] The memory stores instructions that can be executed by at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform any method in the first aspect.
[0018] According to a fourth aspect, the present application provides a non-transitory computer-readable storage medium storing computer instructions, where the computer instructions are used to cause a computer to execute any one of the methods in the first aspect.
[0019] According to a fifth aspect, the present application provides a computer program product, comprising a computer program, wherein the computer program implements any one of the methods in the first aspect when executed by a processor.
[0020] According to the technology of the present application, during the process of a user inputting a keyword, if the correlation between the current keyword and the target keyword or the target page meets the preset conditions, the client can receive the resources of the search result page corresponding to the target keyword sent by the server, or the resources of the target page, and pre-render the above resources returned by the server in the target container. In this way, when the user inputs a search instruction for the target keyword or the target page, the resources in the target container can be quickly output, so that the user can quickly obtain the search result page or the target page corresponding to the target keyword. Compared with the prior art, the present application can improve the response speed of the search.
[0021] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present application.
[0023] Figure 1 is a flowchart of a search method according to the first embodiment of the present application;
[0024] Figure 2is a schematic diagram of the structure of the client and the server according to the first embodiment of the present application;
[0025] Figure 3 to Figure 4 is an example of a search method according to the first embodiment of the present application;
[0026] Figure 5 is a schematic structural diagram of a search device according to a second embodiment of the present application;
[0027] Figure 6 It is a block diagram of an electronic device used to implement the search method of an embodiment of the present application. DETAILED DESCRIPTION
[0028] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0029] First embodiment
[0030] like Figure 1 As shown, the present application embodiment provides a search method, comprising the following steps:
[0031] Step 101: Receive a first keyword input by a user.
[0032] The "keywords" involved in this application, such as the first keyword mentioned above and the target keyword, second keyword, etc. in the following text, can be understood as the content entered by the user in the search box during a search process. When the user enters the search command, the keyword in the current search box becomes the search term, query term or query. Here, a search process can be understood as the entire process from the user starting to enter keywords in the search box to the user entering the search command and displaying the search results page.
[0033] The search method of the embodiment of the present application can be implemented through a client with a search function, such as a mobile phone, a tablet, a personal computer (Personal Computer, PC for short), etc.
[0034] Generally, in a search process, the process of a user inputting keywords is a dynamic process, and the process of different users inputting keywords varies from person to person. In a search process, a user may input keywords multiple times, that is, input the search command after inputting keywords multiple times; or input keywords once, that is, input the search command after inputting keywords once. For example, if a user wants to search for "Li Bai's homesickness poems", the user can enter "Li Bai's", "homesickness", "poems" in the search box in sequence. The user can also enter "Li Bai", "of", "homesickness", "poems" in the search box in sequence. The user can also enter "Li Bai's homesickness poems" in the search box, and so on.
[0035] The first keyword input by the user can be any keyword input by the user, can be the first keyword input by the user, that is, the keyword input for the first time, can be the first keyword input by the user with a clear meaning, or can be a keyword with other meanings, which will not be described in detail.
[0036] In the embodiment of the present application, the user may input keywords through voice input or text input.
[0037] Step 102: If the correlation between the first keyword and the target keyword or the target page meets the preset condition, the target resource sent by the server is received; the target resource is the resource of the search result page corresponding to the target keyword or the resource of the target page.
[0038] In the prior art, the client will initiate a search request to the server only after the user enters a search command, such as clicking a search button or clicking the enter key. Different from the prior art, in the embodiment of the present application, when the user enters a keyword, the client can send a search request to the server in real time.
[0039] In an embodiment of the present application, during the process of a user inputting a keyword, the client or server can predict in real time and dynamically whether there is a target keyword or target page whose correlation with the first keyword meets a preset condition. The correlation between the target keyword or target page and the first keyword meets the preset condition, which can be understood as the possibility that the user searches for the target keyword or target page when the user inputs the first keyword. In view of this, if the client can obtain the corresponding resources from the server in advance, without having to wait until the user actually searches for the target keyword or target page to request the corresponding resources from the server, the search response speed can be greatly improved.
[0040] Therefore, after the user inputs the first keyword, if it is predicted that there is a target keyword whose association with the first keyword meets the preset conditions, the client can receive the resources of the search result page corresponding to the target keyword sent by the server (i.e., the target resource). If it is predicted that there is a target page whose association with the first keyword meets the preset conditions, the client can receive the resources of the target page sent by the server (i.e., the target resource).
[0041] For example, after the user enters "Li Bai's", the client or server can predict that "Li Bai's poems", "Li Bai's poems about the moon", "Li Bai's poems about homesickness" and other target keywords whose relevance meets the preset conditions, and the server can send the resources of the search result pages corresponding to these target keywords to the client in advance. For another example, after the user enters "Spring Festival Gala", the client or server can predict that pages such as "Spring Festival Gala Send Blessings" and "Spring Festival Gala Grab Red Packets" are target pages whose relevance meets the preset conditions, and the server can send the resources of these target pages to the client in advance.
[0042] In the case where there are multiple target keywords or target pages whose associations meet the preset conditions, the server can send the resources of the search result page or the target page corresponding to all or part of the target keywords to the client, or it can send the resources of the search result page or the target page corresponding to one of the target keywords (such as the one with the highest association) to the client.
[0043] Step 103: When the server returns the target resource, pre-render the returned resource in the target container.
[0044] In this step, when the server returns the target resource, the returned resource can be pre-rendered in the target container, and the pre-rendered resource is loaded into the target container. The target container can be a container pre-created by the client, which can be used to store the pre-rendered resource.
[0045] In the case where there are multiple target keywords or target pages whose associations meet the preset conditions, if the server sends the resources of the search result page or the target page corresponding to the multiple target keywords to the client, there can be multiple target containers, and each target container loads the resource of the search result page or the target page corresponding to one target keyword.
[0046] It can be seen that through the above process, the client obtains the resources of the search result page or the target page corresponding to the target keyword from the server in advance, and stores these resources locally through pre-rendering.
[0047] It should be noted that the container involved in the embodiment of the present application can be understood as a pre-rendering container. The container involved in the embodiment of the present application can be a container for loading web pages, a container for loading mini-programs, or a container for loading structured data.
[0048] Step 104: If a first search instruction input by the user is detected, then in response to the first search instruction, the resources in the target container are output; the first search instruction is an instruction to search for the target keyword or the target page.
[0049] In this step, when the search instruction for the target keyword input by the user (i.e., the first search instruction) is detected, since the resources of the search result page corresponding to the target keyword have been pre-loaded in the target container, the client can simply output the resources in the target container. Alternatively, when the search instruction for the target page input by the user (i.e., the first search instruction) is detected, since the resources of the target page have been pre-loaded in the target container, the client can simply output the resources in the target container. It should be noted that the opening instruction of the target page can also be understood as a search instruction. For example, if an entrance or link to enter the target page is set in a certain page, then the user clicking on the entrance or link can be regarded as the user entering the search instruction for the target page.
[0050] Here, the specific process of outputting the resources in the container may be as follows: when a search instruction input by the user is detected, the container switches from the background to the foreground, and forms a page with the pre-rendered resources in the container and displays it to the user.
[0051] In order to implement the above search process, Figure 2 As shown, an input processing module, a logic and parameter processing module and a pre-rendering container management module can be set in the client, and a search service module and a prediction module can be set in the server. Among them, the input processing module can be used to monitor the content input by the user and pass the content input by the user to the logic and parameter processing module; the pre-rendering container management module can be used to create, release or reuse pre-rendering containers; the logic and parameter processing module can be used to achieve: (1) assembling search request parameters according to the keywords input by the user; (2) calling the pre-rendering container management module to load the resources of the corresponding search result page; (3) when the user determines the search behavior, the resources in the container corresponding to the current keyword are output. The prediction module can be used to predict the target page that can be opened later or the target keyword that the user may search for based on the keyword currently input by the user; the search service module can be used to provide search-related service capabilities.
[0052] It should be noted that the prediction module can also be set in the client.
[0053] In an embodiment of the present application, during the process of a user inputting a keyword, if the correlation between the current keyword and the target keyword or the target page meets a preset condition, the client can receive the resources of the search result page corresponding to the target keyword sent by the server, or the resources of the target page, and pre-render the above resources returned by the server in the target container. In this way, when the user inputs a search instruction for the target keyword or the target page, the resources in the target container can be quickly output, so that the user can quickly obtain the search result page or the target page corresponding to the target keyword. Compared with the prior art, the present application can improve the response speed of the search and reduce the waiting time of the user.
[0054] Optionally, after receiving the first keyword input by the user, the method further includes:
[0055] Sending a first search request for the first keyword to the server;
[0056] In the process of the server returning resources of the first search result page, the returned resources are pre-rendered in the first container; the first search result page is the search result page corresponding to the first keyword.
[0057] In this implementation, after receiving the first keyword input by the user, the client may send a first search request for the first keyword to the server. After receiving the first search request sent by the client, the server may return the resources of the corresponding search result page, that is, the resources of the first search result page, to the client. The client may receive the resources of the first search result page returned by the server, and in the process of the server returning the resources of the first search result page, the returned resources may be pre-rendered in the first container, and the pre-rendered resources are loaded into the first container. The first container may be a container pre-created by the client, which may be used to store pre-rendered resources.
[0058] Through the above process, when the user inputs a keyword, the client obtains the resources of the search result page of the current keyword from the server in advance, and stores the resources of the search result page locally through pre-rendering. Therefore, when the user inputs a search request for the first keyword, the client can directly output the resources in the first container, which improves the search response speed and reduces the user's waiting time.
[0059] Optionally, after receiving the first keyword input by the user, the method further includes:
[0060] If it is detected that the user changes the current keyword to a second keyword, sending a second search request for the second keyword to the server;
[0061] In the process of the server returning the resources of the second search result page, the returned resources are pre-rendered in the second container; the second search result page is the search result page corresponding to the second keyword.
[0062] As mentioned above, during a search, the process of users inputting keywords is usually a dynamic process. Therefore, after entering the first keyword, the user may change the keyword. There are many ways to change the keyword, which can be to add new content based on the current keyword, or to modify part of the content of the current keyword, or to replace the current keyword with a new keyword, and so on.
[0063] For example, if the user enters the keyword "Li Bai's", the current keyword is "Li Bai's". If the user enters the keyword "homesickness", the user changes the current keyword "Li Bai's" to the second keyword "Li Bai's homesickness". For another example, if the user enters the keyword "Li Bai's", the current keyword is "Li Bai's". If the user changes the keyword "Li Bai's" to "Du Fu's", the second keyword is "Du Fu's". For another example, if the user enters the keyword "Li Bai", the current keyword is "Li Bai". If the user changes the "Bai" in the keyword "Li Bai" to "Bai", the second keyword is "Li Bai".
[0064] In this step, no matter which keyword input method the user adopts, during a search process, each time the user enters a new keyword, the client can initiate a new search request (i.e., the second search request) to the server in real time for the current keyword (i.e., the second keyword). For example, if the user enters "Li Bai's", "homesickness", and "poem" in sequence, when the user enters "Li Bai's", the client initiates a search request for "Li Bai's" to the server, and when the user enters "homesickness" again, the client initiates a search request for "Li Bai's homesickness" to the server, and when the user enters "poem" again, the client initiates a search request for "Li Bai's homesickness poems" to the server.
[0065] In this step, the client can receive the resources of the new search result page (i.e., the second search result page) returned by the server. In the process of the server returning the resources of the second search result page, the returned resources can be pre-rendered in the second container, and the pre-rendered resources are loaded into the second container. The second container can be a container pre-created by the client, which can be used to store the pre-rendered resources.
[0066] It can be seen that through the above process, during the keyword input process, the client can dynamically and real-time obtain resources of different search result pages from the server in advance, and store the resources of different search result pages in different containers locally through pre-rendering.
[0067] It should be noted that the second keyword is not limited to the keyword input by the user for the nth time. It can be the keyword input for the second time, or the third time or even more times. Each changed keyword can be understood as the second keyword.
[0068] In order to more clearly understand the dynamic and real-time search method involved in the keyword input process, the following is an example in which a user enters "Li Bai's", "homesickness", and "poem" in the search box in sequence.
[0069] The user enters "Li Bai's" in the search box, and the client initiates a search request for "Li Bai's" to the server. The server returns the resources of search result page A1 to the client. The client receives the resources of search result page A1 returned by the server, and pre-renders the resources of search result page A1 in container a1. The pre-rendered resource B1 is loaded into container a1. The user continues to enter "homesickness" in the search box, and the client initiates a search request for "Li Bai's homesickness" to the server. The server returns the resources of search result page A2 to the client. The client receives the resources of search result page A2 returned by the server, and pre-renders the resources of search result page A2 in container a2. The pre-rendered resource B2 is loaded into container a2. The user continues to enter "poetry" in the search box, and the client initiates a search request for "Li Bai's homesickness poems" to the server. The server returns the resources of search result page A3 to the client. The client receives the resources of search result page A3 returned by the server, and pre-renders the resources of search result page A3 in container a3. The pre-rendered resource B3 is loaded into container a3.
[0070] Through the above process, the client dynamically and in real time obtains the resources of the search result page corresponding to the current keyword, and pre-renders the resources of the search result page in different containers, so that the pre-rendered resources can be loaded in different containers, thereby realizing that the client pre-uploads the resources of the search result page from the server to the local.
[0071] Optionally, the method further includes:
[0072] If a second search instruction input by the user is detected, the resources in the container corresponding to the current keyword are output in response to the second search instruction.
[0073] The above-mentioned second search instruction is a search instruction for the current keyword, and the current keyword is not the target keyword. That is to say, the search target of the above-mentioned second search instruction is different from the search target of the first search instruction. The second search instruction is not a search instruction for the target keyword or target page, but a search instruction for the current keyword.
[0074] In this implementation, when a second search instruction input by the user is detected, since the resources of the search result page corresponding to the current keyword have been pre-loaded in the corresponding container, the client only needs to output the resources in the container corresponding to the current keyword, so that the user can quickly obtain the search result page corresponding to the current keyword.
[0075] Two implementation methods for predicting target keywords or target pages are provided below.
[0076] Optionally, if the correlation between the first keyword and the target keyword or the target page satisfies a preset condition, receiving the target resource sent by the server includes:
[0077] After the server receives the first search request, if the server predicts a target keyword or a target page whose association with the first keyword meets a preset condition, the server receives a target resource sent by the server based on the prediction.
[0078] In this implementation, if the client initiates a search request for the first keyword (i.e., the first search request) to the server after receiving the first keyword input by the user, then, after receiving the search request, the server can predict whether there is a target keyword or target page whose association with the first keyword meets the preset conditions. When the server predicts a target keyword whose association with the first keyword meets the preset conditions, the server can send the resource of the search result page corresponding to the target keyword (i.e., the target resource) to the client; when the server predicts a target page whose association with the first keyword meets the preset conditions, the server can send the resource of the target page (i.e., the target resource) to the client.
[0079] After receiving the search request, in addition to implementing the above-mentioned prediction and sending the target resources after the prediction, the server can also implement the process of returning the resources of the search result page corresponding to the first keyword (i.e., the first search result page). These two processes can be implemented simultaneously or one after the other.
[0080] Since the server has powerful big data computing and analysis capabilities, predicting target keywords and target pages through the server can improve the accuracy and efficiency of predictions, thereby helping to improve search response speed and search hit rate.
[0081] Optionally, if the correlation between the first keyword and the target keyword or the target page satisfies a preset condition, receiving the target resource sent by the server includes:
[0082] If the client predicts a target keyword or a target page whose relevance to the first keyword meets a preset condition, then a third search request for the target keyword or the target page is sent to the server;
[0083] Receive the target resource returned by the server based on the third search request.
[0084] In this implementation, after receiving the first keyword input by the user, the client can predict whether there is a target keyword or target page whose relevance to the first keyword meets the preset condition. When the client predicts a target keyword or target page whose relevance to the first keyword meets the preset condition, the client can send a search request (i.e., a third search request) for the target keyword or target page to the server.
[0085] After the server receives the third search request sent by the client, it can return the resources of the search result page corresponding to the target keyword (i.e., the target resource) to the client, or return the resources of the target page (i.e., the target resource). In this way, the client can obtain the resources of the search result page corresponding to the target keyword or the resources of the target page in advance, and pre-render these resources in the target container.
[0086] By implementing the above prediction process through the client, there is no need to rely on the client to send a search request for the current keyword to the server, so there is no need to obtain the resources of the search result page corresponding to the current keyword in advance, which can save network overhead and network resources. For example, when the search possibility of the current keyword is low, but a target keyword or target page with a high correlation with the current keyword can be predicted based on the current keyword, there is no need to send a search request for the current keyword to the server.
[0087] Optionally, the correlation between the first keyword and the target keyword or the target page satisfies a preset condition, including any of the following:
[0088] If the historical probability of the user searching for the target keyword after inputting the first keyword is greater than or equal to a preset threshold, then the correlation between the first keyword and the target keyword meets the preset condition;
[0089] If there is a target page related to the first keyword and effective at a preset time, the association between the first keyword and the target page satisfies the preset condition.
[0090] In this implementation, the association between keywords can be predicted based on the user's historical input behavior. For example, if a user inputs "Li Bai", there is a 60% probability that the search is for "Li Bai's poems", and if the user inputs "Li Bai's thoughts", there is a 90% probability that the search is for "Li Bai's poems about missing his hometown". Assuming that the preset threshold is 50%, then when the user inputs "Li Bai", "Li Bai's poems" can be used as the target keyword; when the user inputs "Li Bai's thoughts", "Li Bai's poems about missing his hometown" can be used as the target keyword.
[0091] In this implementation, the target keyword is predicted based on the historical probability, so that the search response speed can be improved while ensuring the search hit rate.
[0092] In this implementation, it is also possible to predict whether there is a target page related to the first keyword that takes effect at a preset time. For example, there is an activity on New Year's Eve to watch the Spring Festival Gala and grab red envelopes, and the page of "Watch the Spring Festival Gala and grab red envelopes" has been pre-configured and takes effect at 8 o'clock in the evening on New Year's Eve and ends at 12 o'clock in the evening on New Year's Eve. Then, when receiving keywords such as "New Year's Eve" and "Spring Festival Gala" input by the user, it can be predicted that the page of "Watch the Spring Festival Gala and grab red envelopes" is used as the target page. For another example, a limited-time registration page, a limited-time rush purchase page, etc. can all be used as the target page.
[0093] In this implementation, by searching for associations with the target, the resources of the target page that will take effect at the preset time are obtained in advance according to the needs of the user. When the target page takes effect, the resources of the target page do not need to be obtained from the server, but are obtained locally. In this way, network paralysis caused by many clients concentrating on requesting network resources when the target page takes effect can be avoided, especially during some specific special events, which can reduce the peak pressure on the server and improve the user experience.
[0094] It should be noted that for the target page related to the first keyword that takes effect at the preset time, the prediction timing can be any time before the preset time, for example, when the user enters the relevant keyword, after the user enters the search command, or when the client opens the relevant page.
[0095] In order to better understand the above-mentioned embodiments, Figure 3 to Figure 4 The examples shown are for illustration purposes only.
[0096] like Figure 3As shown, the client receives the user input "Li Bai's", submits a search request for "Li Bai's" to the server, and the server returns the resources of the search result page of "Li Bai's" to the client. The client pre-renders the resources of the search result page of "Li Bai's" returned by the server in container a1. After receiving the search request for "Li Bai's", the server predicts that the correlation between "Li Bai's poems" and "Li Bai's" is greater than the preset threshold, and then sends the resources of the search result page of "Li Bai's poems" to the client. The client pre-renders the resources of the search result page of "Li Bai's poems" returned by the server in container a2. The client continues to receive the user input "missing", and the client submits a search request for "Li Bai's missing" to the server again. The server returns the resources of the search result page of "Li Bai's missing" to the client. The client pre-renders the resources of the search result page of "Li Bai's missing" returned by the server in container a3. When the server receives the search request for "Li Bai's longing for his hometown", it predicts that the correlation between "Li Bai's poems about longing for his hometown" and "Li Bai's longing for his hometown" is greater than the preset threshold, and then sends the resources of the search result page of "Li Bai's poems about longing for his hometown" to the client. The client reuses container a1 to pre-render the resources of the search result page of "Li Bai's poems about longing for his hometown" returned by the server. The client continues to receive the "poems about hometown" input by the user, and receives the search command input by the user, then the client directly outputs the resources of the search result page of "Li Bai's poems about longing for his hometown" loaded in container a1, that is, it realizes the rapid display of the search result page of "Li Bai's poems about longing for his hometown" to the user.
[0097] like Figure 4 As shown, the client receives the "Spring Festival Gala" input by the user, submits a search request for "Spring Festival Gala" to the server, and the server returns the resources of the search result page of "Spring Festival Gala" to the client. The client pre-renders the resources of the search result page of "Spring Festival Gala" returned by the server in container a1. After receiving the search request for "Spring Festival Gala", the server predicts that the page of "Watching Spring Festival Gala and Grabbing Red Packets" is related to "Spring Festival Gala" and will take effect after 1 hour, and then sends the resources of the page of "Watching Spring Festival Gala and Grabbing Red Packets" to the client. The client pre-renders the resources of the page of "Watching Spring Festival Gala and Grabbing Red Packets" returned by the server in container a2. When the client receives the search instruction input by the user, the client directly outputs the resources of the search result page of "Spring Festival Gala" loaded in container a1, that is, the search result page of "Spring Festival Gala" is quickly displayed to the user. When the client receives the relevant instructions from the user to open the page of "Watching Spring Festival Gala and Grabbing Red Packets", the client can directly output the resources of the page of "Watching Spring Festival Gala and Grabbing Red Packets" loaded in container a2, that is, the page of "Watching Spring Festival Gala and Grabbing Red Packets" is quickly displayed to the user.
[0098] Since the number of pre-created containers is usually limited, when all pre-created containers are occupied, the containers can be reused, that is, a container can be selected from the occupied containers for reuse. As the container is reused, the resources previously loaded in the container can be destroyed or released. The reuse of containers can be implemented by using algorithms such as first-in-first-out or least recently used. Assuming that containers a1, a2, and a3 are pre-created in the client, container a1 is occupied first, container a2 is occupied later, and container a3 is occupied last. If a new keyword search request is currently generated, all containers are already occupied at this time, and container a1 can be reused for the current keyword search request.
[0099] As an exception, in the case where the target container is loaded with resources of a target page that takes effect at a preset time, when the container needs to be reused, the target container may not be reused, and other containers may be preferentially selected for reuse.
[0100] Optionally, the target container is loaded with resources of the target page that take effect at the preset time;
[0101] The method further comprises:
[0102] If all pre-created containers are occupied, reuse or release of the target container is prohibited.
[0103] In this implementation, the target container may be prohibited from being reused or released before the target page becomes effective, that is, before the above-mentioned preset time, and the target container may be prohibited from being reused or released before the entire effective time of the target page. In this way, the target container can continue to be used as a dedicated container for the target page, and the resources of the target page in the target container can be retained until it becomes effective, or even retained during the entire effective period, and the user can quickly access the target page during the entire effective period of the target page.
[0104] Optionally, the target container is loaded with resources of the target page that take effect at the preset time;
[0105] The method further comprises:
[0106] Storing the target resource in the target container in a target disk;
[0107] If the target container is reused or released, the target resource is reloaded from the target disk to the target container under a preset condition.
[0108] In this implementation, considering that the user may close or exit the current application during or after the search, the target resource in the target container may be stored in the target disk during or after the target container pre-renders the target resource. In this way, even if the target container is reused or released, the target resource may be reloaded from the target disk to the target container under preset conditions, thereby ensuring that the user can quickly and efficiently access the target page.
[0109] The preset condition may be, for example, restarting the application of the target page, or a preset time period before the preset time (such as 10 minutes before the preset time), and so on.
[0110] In addition, for the search result page or target page, the size of the page resources is usually in MB level, and the number of resources usually reaches hundreds. In order to save the consumption of network resources and further reduce the time and resources consumed by the container in resource pre-rendering, based on the above-mentioned search method, the embodiment of the present application can also adopt a multi-resource reuse strategy in the process of returning resources on the server side.
[0111] For example, in the process of returning the resources of the second search result page by the server, if the first resource of the second search result page is the same as the second resource of the first search result page, the second resource in the first container can be reused in the second container. For another example, in the process of returning the resources of the first search result page by the server, if the third resource of the target search page is the same as the fourth resource of the first search result page, the fourth resource in the first container can be reused in the target container, or the third resource in the target container can be reused in the first container.
[0112] In summary, if multiple containers involve the same resources, the client can reuse the same resources locally without making repeated network requests. In this way, on the one hand, for the same resources, the client does not need to send network requests for resources to the server multiple times, and the server does not need to return resources multiple times for network requests for the same resources, which can save network resource consumption. On the other hand, the same resources do not need to be pre-rendered multiple times in different containers, thereby reducing the time and resources consumed by the container on resource pre-rendering. Therefore, by adopting a multi-resource reuse strategy, the embodiment of the present application can further improve the search response speed while reducing overall resource consumption, thereby further improving the user's search experience.
[0113] In order to implement the multi-resource reuse strategy, a network sharing management module can also be set in the client, which can uniformly manage and reuse all resource requests in the search process. In this implementation, it is possible to determine whether different resources are the same based on the request parameters of different resources, such as url, header, body, etc.
[0114] The multi-resource reuse strategy can be applied to resources that have been acquired from the server (i.e., resource reuse) as well as resources that are being acquired from the server but have not yet been acquired (i.e., resource request reuse). For resources that have already been acquired from the server, the resources can be directly reused in multiple containers. For resource request reuse, a connection between the resource request and the container can be established, and after the resource request is completed, the container associated with it is notified, and the corresponding resources are reused in the container. Specifically, when the resource request is completed, the relevant data can be cached, including control parameters such as cache duration and HTTP Header, and the relevant data and the corresponding control parameters returned by the server can be directly returned to the dependent container.
[0115] By adopting the above-mentioned multi-resource reuse strategy, both resource reuse and resource request reuse are achieved, which can minimize the overall resource consumption and maximize the search response speed.
[0116] When a container is reused or released, if there is an ongoing resource request for the container, and the ongoing resource request is reused or can be reused in other containers, the association between the resource request and the container can be released so that the resource request is not destroyed or released with the reuse or release of the container. Therefore, the resource request originally generated by the container can continue to be reused by the required container. This implementation method realizes the separate management of resource requests and improves the reusability of resource requests, thereby minimizing overall resource consumption and maximizing search response speed.
[0117] In the embodiment of the present application, container reuse and resource reuse have different meanings. Container reuse is to reuse an occupied container, which represents the destruction and reuse of a container; while resource reuse is to load the same resource into different containers, which represents multiple uses of the resource.
[0118] It should be noted that the various optional implementations of the search method in the present application can be implemented in combination with each other or can be implemented separately, and the present application does not limit this.
[0119] The above embodiments of the present application have at least the following advantages or beneficial effects:
[0120] In the present application, during the process of a user inputting a keyword, if the correlation between the current keyword and the target keyword or the target page meets the preset conditions, the client can receive the resources of the search result page corresponding to the target keyword sent by the server, or the resources of the target page, and pre-render the above resources returned by the server in the target container. In this way, when the user inputs a search instruction for the target keyword or the target page, the resources in the target container can be quickly output, so that the user can quickly obtain the search result page or the target page corresponding to the target keyword. Compared with the prior art, the present application can improve the response speed of the search and reduce the waiting time of the user.
[0121] Second embodiment
[0122] like Figure 5 As shown, the present application provides a search device 200, comprising:
[0123] A first receiving module 201, configured to receive a first keyword input by a user;
[0124] The second receiving module 202 is used to receive the target resource sent by the server if the correlation between the first keyword and the target keyword or the target page meets the preset condition; the target resource is the resource of the search result page corresponding to the target keyword or the resource of the target page;
[0125] A first pre-rendering module 203, configured to pre-render the returned resource in a target container during the process of the server returning the target resource;
[0126] The first output module 204 is configured to output the resources in the target container in response to a first search instruction if a first search instruction input by a user is detected; the first search instruction is an instruction for searching the target keyword or the target page.
[0127] Optionally, the search device 200 further includes:
[0128] A first sending module, configured to send a first search request for the first keyword to the server;
[0129] The second pre-rendering module is used to pre-render the returned resources in the first container during the process of the server returning the resources of the first search result page; the first search result page is the search result page corresponding to the first keyword.
[0130] Optionally, the search device 200 further includes:
[0131] A second sending module, configured to send a second search request for the second keyword to the server if it is detected that the user changes the current keyword to a second keyword;
[0132] The third pre-rendering module is used to pre-render the returned resources in the second container when the server returns the resources of the second search result page; the second search result page is the search result page corresponding to the second keyword.
[0133] Optionally, the search device 200 further includes:
[0134] The second output module is configured to output the resources in the container corresponding to the current keyword in response to a second search instruction input by the user if a second search instruction input by the user is detected.
[0135] Optionally, the second receiving module 202 includes:
[0136] The first receiving submodule is used to receive the target resource sent by the server based on the prediction if the server predicts a target keyword or target page whose association with the first keyword meets a preset condition after the server receives the first search request.
[0137] Optionally, the second receiving module 202 includes:
[0138] a sending submodule, configured to send a third search request for a target keyword or a target page to the server if the client predicts a target keyword or a target page whose relevance to the first keyword satisfies a preset condition;
[0139] The second receiving submodule is used to receive the target resource returned by the server based on the third search request.
[0140] Optionally, the correlation between the first keyword and the target keyword or the target page satisfies a preset condition, including any of the following:
[0141] If the historical probability of the user searching for the target keyword after inputting the first keyword is greater than or equal to a preset threshold, then the correlation between the first keyword and the target keyword meets the preset condition;
[0142] If there is a target page related to the first keyword and effective at a preset time, the association between the first keyword and the target page satisfies the preset condition.
[0143] Optionally, the target container is loaded with resources of the target page that take effect at the preset time;
[0144] The search device 200 further includes:
[0145] The prohibition module is used to prohibit the reuse or release of the target container if all pre-created containers are occupied.
[0146] Optionally, the target container is loaded with resources of the target page that take effect at the preset time;
[0147] The search device 200 further includes:
[0148] A storage module, used for storing the target resource in the target container in a target disk;
[0149] A loading module is used to reload the target resource from the target disk to the target container under a preset condition if the target container is reused or released.
[0150] Optionally, the preset condition includes at least one of the following:
[0151] Restart the application of the target page;
[0152] A preset time period before the preset time.
[0153] Optionally, the container includes at least one of the following:
[0154] A container for loading web pages;
[0155] A container for loading applets;
[0156] A container for loading structured data.
[0157] The search device 200 provided in the present application can implement each process in the above-mentioned search method embodiment and can achieve the same beneficial effects. To avoid repetition, it will not be described again here.
[0158] According to an embodiment of the present application, the present application also provides an electronic device, a readable storage medium and a computer program product.
[0159] like Figure 6 , is a block diagram of an electronic device according to a search method according to an embodiment of the present application. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.
[0160] like Figure 6As shown, the electronic device includes: one or more processors 601, a memory 602, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are interconnected using different buses and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In other embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 601 is taken as an example.
[0161] The memory 602 is a non-transient computer-readable storage medium provided in the present application. The memory stores instructions executable by at least one processor to enable at least one processor to perform the search method provided in the present application. The non-transient computer-readable storage medium of the present application stores computer instructions, which are used to enable a computer to perform the search method provided in the present application.
[0162] The memory 602 is a non-transient computer-readable storage medium that can be used to store non-transient software programs, non-transient computer executable programs and modules, such as program instructions / modules corresponding to the search method in the embodiment of the present application (for example, the attached Figure 5 The processor 601 executes various functional applications and data processing of the search device by running the non-transient software programs, instructions and modules stored in the memory 602, that is, implements the search method in the above method embodiment.
[0163] The memory 602 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device of the search method, etc. In addition, the memory 602 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory 602 may optionally include a memory remotely arranged relative to the processor 601, and these remote memories may be connected to the electronic device of the search method via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0164] The electronic device of the search method may further include: an input device 603 and an output device 604. The processor 601, the memory 602, the input device 603 and the output device 604 may be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.
[0165] The input device 603 can receive input digital or character information, and generate key signal input related to user settings and function control of the electronic device of the search method, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator rod, one or more mouse buttons, a trackball, a joystick and other input devices. The output device 604 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display and a plasma display. In some embodiments, the display device may be a touch screen.
[0166] Various implementations of the systems and techniques described herein can be realized in digital electronic circuit systems, integrated circuit systems, dedicated ASICs (application specific integrated circuits), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0167] These computer programs (also referred to as programs, software, software applications, or code) include machine instructions for programmable processors and can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or means (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.
[0168] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0169] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.
[0170] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.
[0171] According to the technical solution of the embodiment of the present application, during the process of the user inputting a keyword, if the correlation between the current keyword and the target keyword or the target page meets the preset conditions, the client can receive the resources of the search result page corresponding to the target keyword sent by the server, or the resources of the target page, and pre-render the above resources returned by the server in the target container. In this way, when the user inputs a search instruction for the target keyword or the target page, the resources in the target container can be quickly output, so that the user can quickly obtain the search result page or the target page corresponding to the target keyword. Compared with the prior art, the present application can improve the response speed of the search.
[0172] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.
[0173] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.
Claims
1. A search method, comprising: receiving a first keyword input by a user; If the correlation between the first keyword and the target keyword or the target page meets the preset condition, receiving the target resource sent by the server; The target resource is a resource of a search result page corresponding to the target keyword or a resource of the target page; In the process of the server returning the target resource, pre-rendering the returned resource in the target container; If a first search instruction input by a user is detected, outputting the resources in the target container in response to the first search instruction; The first search instruction is an instruction to search for the target keyword or the target page; After receiving the first keyword input by the user, the method further includes: Sending a first search request for the first keyword to the server; In the process of the server returning the resources of the first search result page, pre-rendering the returned resources in the first container; the first search result page is the search result page corresponding to the first keyword; After receiving the first keyword input by the user, the method further includes: If it is detected that the user changes the current keyword to a second keyword, sending a second search request for the second keyword to the server; In the process of the server returning the resources of the second search result page, pre-rendering the returned resources in the second container; the second search result page is the search result page corresponding to the second keyword; In the process of the server returning the resource of the second search result page, if the first resource of the second search result page is the same as the second resource of the first search result page, the second resource in the first container is reused in the second container.
2. The method according to claim 1, further comprising: If a second search instruction input by the user is detected, the resources in the container corresponding to the current keyword are output in response to the second search instruction.
3. The method according to claim 1, wherein: If the correlation between the first keyword and the target keyword or the target page meets a preset condition, receiving the target resource sent by the server includes: After the server receives the first search request, if the server predicts a target keyword or a target page whose association with the first keyword meets a preset condition, the server receives a target resource sent by the server based on the prediction.
4. The method according to claim 1, wherein: If the correlation between the first keyword and the target keyword or the target page meets a preset condition, receiving the target resource sent by the server includes: If the client predicts a target keyword or a target page whose relevance to the first keyword meets a preset condition, then a third search request for the target keyword or the target page is sent to the server; Receive the target resource returned by the server based on the third search request.
5. The method according to claim 1, wherein: The relevance between the first keyword and the target keyword or the target page satisfies a preset condition, including any of the following: If the historical probability of the user searching for the target keyword after inputting the first keyword is greater than or equal to a preset threshold, then the correlation between the first keyword and the target keyword meets the preset condition; If there is a target page related to the first keyword and effective at a preset time, the association between the first keyword and the target page satisfies the preset condition.
6. The method according to claim 5, wherein: The target container is loaded with resources of the target page effective at the preset time; The method further comprises: If all pre-created containers are occupied, reuse or release of the target container is prohibited.
7. The method according to claim 5, wherein: The target container is loaded with resources of the target page effective at the preset time; The method further comprises: Storing the target resource in the target container in a target disk; If the target container is reused or released, the target resource is reloaded from the target disk to the target container under a preset condition.
8. The method according to claim 7, wherein: The preset condition includes at least one of the following: Restart the application of the target page; A preset time period before the preset time.
9. The method according to claim 1, wherein: The container comprises at least one of the following: A container for loading web pages; A container for loading applets; A container for loading structured data.
10. A search device, comprising: A first receiving module, used for receiving a first keyword input by a user; A second receiving module, configured to receive a target resource sent by a server if the correlation between the first keyword and the target keyword or the target page meets a preset condition; The target resource is a resource of a search result page corresponding to the target keyword or a resource of the target page; A first pre-rendering module, configured to pre-render the returned resource in a target container during the process of the server returning the target resource; A first output module, configured to output the resources in the target container in response to a first search instruction input by a user if a first search instruction input by a user is detected; The first search instruction is an instruction to search for the target keyword or the target page; The device also includes: A first sending module, configured to send a first search request for the first keyword to the server; A second pre-rendering module is used to pre-render the returned resources in the first container during the process of the server returning the resources of the first search result page; the first search result page is the search result page corresponding to the first keyword; The device also includes: A second sending module, configured to send a second search request for the second keyword to the server if it is detected that the user changes the current keyword to a second keyword; A third pre-rendering module, configured to pre-render the returned resources in a second container during the process of the server returning resources of a second search result page; the second search result page is a search result page corresponding to the second keyword; Wherein, in the process of the server returning the resource of the second search result page, if the first resource of the second search result page is the same as the second resource of the first search result page, the device is further used to reuse the second resource in the first container in the second container.
11. The apparatus according to claim 10, further comprising: The second output module is configured to output the resources in the container corresponding to the current keyword in response to a second search instruction input by the user if a second search instruction input by the user is detected.
12. The device according to claim 10, characterized in that The second receiving module comprises: The first receiving submodule is used to receive the target resource sent by the server based on the prediction if the server predicts a target keyword or target page whose association with the first keyword meets a preset condition after the server receives the first search request.
13. The device according to claim 10, wherein: The second receiving module comprises: a sending submodule, configured to send a third search request for a target keyword or a target page to the server if the client predicts a target keyword or a target page whose relevance to the first keyword satisfies a preset condition; The second receiving submodule is used to receive the target resource returned by the server based on the third search request.
14. The device according to claim 10, wherein: The relevance between the first keyword and the target keyword or the target page satisfies a preset condition, including any of the following: If the historical probability of the user searching for the target keyword after inputting the first keyword is greater than or equal to a preset threshold, then the correlation between the first keyword and the target keyword meets the preset condition; If there is a target page related to the first keyword and effective at a preset time, the association between the first keyword and the target page satisfies the preset condition.
15. The device according to claim 14, wherein: The target container is loaded with resources of the target page effective at the preset time; The device also includes: The prohibition module is used to prohibit the reuse or release of the target container if all pre-created containers are occupied.
16. The device according to claim 14, wherein: The target container is loaded with resources of the target page effective at the preset time; The device also includes: A storage module, used for storing the target resource in the target container in a target disk; A loading module is used to reload the target resource from the target disk to the target container under a preset condition if the target container is reused or released.
17. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 9.
18. A non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the method of any one of claims 1 to 9.
19. A computer program product, comprising a computer program, which, when executed by a processor, implements the method of any one of claims 1 to 9.
