Search method, device, electronic device and storage medium
By dynamically adjusting the deployment methods of full index and real-time index in the search engine, the problem that existing technologies can only support a single deployment method is solved. This enables flexible index deployment to adapt to different business scenarios, simplifies operation and maintenance, and ensures search stability.
Patent Information
- Application Number
- CN202010720013.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-23
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2040-07-23
AI Technical Summary
Existing search engines only support one method: deploying full indexes and real-time indexes on the same machine or on different machines. This cannot flexibly adapt to the index deployment needs of different business scenarios.
A search method and apparatus are provided that can dynamically adjust the deployment mode of full index and real-time index according to business scenarios, support on-device deployment and off-device deployment, determine the target index deployment mode by pre-configuring the correspondence between index identifiers and deployment modes, and process search requests and results under different deployment modes.
This enables the same search engine to flexibly adopt different index deployment methods in different business scenarios, simplifying operation and maintenance, saving resources, ensuring the stability of the search server cluster, and meeting users' search needs.
Smart Images

Figure CN112052367B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of search engines, and in particular to a search method, device, electronic device and storage medium. Background Art
[0002] In search engines, documents can be divided into full index and real-time index according to their update frequency and size. Full index stores the entire set of data and is updated periodically, while real-time index stores a subset of data and only saves data that has changed during each full index building cycle. Through full index and real-time index, users can be guaranteed to recall all required data and ensure the timeliness of data.
[0003] There are two ways to deploy the full index and the real-time index. One way is to deploy the full index and the real-time index simultaneously in one electronic device, that is, the full index and the real-time index are deployed on the same machine. The other way is to deploy the full index and the real-time index separately in two electronic devices, that is, the full index and the real-time index are not deployed on the same machine. In the related art, some search engines only support the deployment of the full index and the real-time index on the same machine, and other search engines only support the deployment of the full index and the real-time search on different machines.
[0004] The inventors have at least found in their research that, in order to meet the search needs of users, for the same search engine, in some business scenarios, it is necessary to adopt an index deployment method in which the full index and the real-time index are deployed on the same machine, while in other business scenarios, it is necessary to adopt an index deployment method in which the full index and the real-time index are not deployed on the same machine. Therefore, it is urgently necessary to provide an index deployment method that supports both deployment on the same machine and deployment on different machines. Summary of the invention
[0005] In order to solve the technical problems described in the background technology, the embodiments of the present application provide a search method, device, electronic device and storage medium.
[0006] In a first aspect, an embodiment of the present application provides a search method, the method comprising:
[0007] receiving a target search request sent by a user terminal, wherein the target search request carries a target search term and a target index identifier, wherein the target index identifier is determined based on a business scenario corresponding to the target search request, and different business scenarios correspond to different target index identifiers;
[0008] Determine the target index deployment mode corresponding to the target index identifier according to the correspondence between the pre-configured index identifier and the index deployment mode, where different target index identifiers correspond to different target index deployment modes;
[0009] Sending the target search request to a target search server corresponding to the target index deployment mode;
[0010] Receive the target search results matching the target search term fed back by the target search server.
[0011] Optionally, when the target index deployment mode is that the full index and the real-time index are deployed on different machines, sending the target search request to the target search server corresponding to the target index deployment mode includes:
[0012] Sending the target search request to a first search server corresponding to the full index, and sending the target search request to a second search server corresponding to the real-time index;
[0013] Correspondingly, the receiving of the target search result matching the target search term fed back by the target search server includes:
[0014] receiving a first search result fed back by the first search server and a second search result fed back by the second search server;
[0015] The first search result and the second search result are deduplicated and sorted to obtain a target search result.
[0016] Optionally, when the target index deployment mode is that the full index and the real-time index are deployed on the same machine, sending the target search request to the target search server corresponding to the target index deployment mode includes:
[0017] Sending the target search request to a third search server corresponding to the full index and the real-time index;
[0018] Correspondingly, the receiving of the target search result matching the target search term fed back by the target search server includes:
[0019] A third search result fed back by the third search server is received, and the third search result is used as the target search result.
[0020] In a second aspect, an embodiment of the present application provides a search method, the method comprising:
[0021] Receive a target search request sent by a search engine proxy server, the target search request carries a target search term and a target index identifier, the target index identifier is determined based on a business scenario corresponding to the target search request, the search engine proxy server determines a target index deployment mode corresponding to the target index identifier according to a correspondence between a pre-configured index identifier and an index deployment mode, determines a search server corresponding to the target index deployment mode, and sends the target search request to the target search server, wherein different business scenarios correspond to different target index identifiers, and different target index identifiers correspond to different target index deployment modes;
[0022] Searching for search results matching the target search term from the data set corresponding to the target index identifier;
[0023] The search results are sorted and the sorted search results are fed back to the search engine proxy server.
[0024] Optionally, when the index deployment mode corresponding to the search server is that the full index and the real-time index are deployed on the same machine, when the data of the data set corresponding to the target index identifier is updated, the method further includes:
[0025] Deleting target data in the data set corresponding to the full index, wherein the target data is data corresponding to the data to be updated and already stored in the data set corresponding to the full index;
[0026] The data to be updated is updated to the data set corresponding to the real-time index.
[0027] Optionally, when the index deployment mode corresponding to the search server is that the full index and the real-time index are deployed on different machines, when the data of the data set corresponding to the target index identifier increases, the method further includes:
[0028] Deleting target data in the data set corresponding to the full index and the data set corresponding to the real-time index, wherein the target data is data that has been stored in the data set corresponding to the full index and the data set corresponding to the real-time index and corresponds to the data to be added;
[0029] The data to be added is updated to the data set corresponding to the real-time index.
[0030] Optionally, the method further includes:
[0031] Updating the data set corresponding to the full index at a predetermined update time;
[0032] When the index deployment mode corresponding to the search server is that the full index and the real-time index are not deployed on the same machine, the data set corresponding to the real-time index before the scheduled update time is deleted.
[0033] In a third aspect, an embodiment of the present application provides a search device, which is applied to a search engine proxy server, and the device includes:
[0034] A search request receiving module, configured to receive a target search request sent by a user terminal, wherein the target search request carries a target search term and a target index identifier, wherein the target index identifier is determined based on a business scenario corresponding to the target search request, and different business scenarios correspond to different target index identifiers;
[0035] An index deployment mode determination module, used to determine the target index deployment mode corresponding to the target index identifier according to the correspondence between the pre-configured index identifier and the index deployment mode, where different target index identifiers correspond to different target index deployment modes;
[0036] A search request sending module, used to send the target search request to the target search server corresponding to the target index deployment mode;
[0037] The search result receiving module is used to receive the target search result matching the target search term fed back by the target search server.
[0038] Optionally, when the target index deployment mode is that the full index and the real-time index are deployed on different machines, the search request sending module is specifically used to:
[0039] Sending the target search request to a first search server corresponding to the full index, and sending the target search request to a second search server corresponding to the real-time index;
[0040] Accordingly, the search result receiving module is specifically used for:
[0041] receiving a first search result fed back by the first search server and a second search result fed back by the second search server;
[0042] The first search result and the second search result are deduplicated and sorted to obtain a target search result.
[0043] Optionally, when the target index deployment mode is that the full index and the real-time index are deployed on the same machine, the search request sending module is specifically used to:
[0044] Sending the target search request to a third search server corresponding to the full index and the real-time index;
[0045] Accordingly, the search result receiving module is specifically used for:
[0046] A third search result fed back by the third search server is received, and the third search result is used as the target search result.
[0047] In a fourth aspect, an embodiment of the present application provides a search device, which is applied to a search server, and the device includes:
[0048] A receiving module, used for receiving a target search request sent by a search engine proxy server, wherein the target search request carries a target search term and a target index identifier, wherein the target index identifier is determined based on a business scenario corresponding to the target search request, and the search engine proxy server determines a target index deployment mode corresponding to the target index identifier according to a correspondence between a pre-configured index identifier and an index deployment mode, and determines a search server corresponding to the target index deployment mode, and sends the target search request to the target search server, wherein different business scenarios correspond to different target index identifiers, and different target index identifiers correspond to different target index deployment modes;
[0049] A search module, configured to search for search results matching the target search term from the data set corresponding to the target index identifier;
[0050] The sorting module is used to sort the search results and feed back the sorted search results to the search engine proxy server.
[0051] Optionally, when the index deployment mode corresponding to the search server is that the full index and the real-time index are deployed on the same machine, the device further includes:
[0052] A first deletion module, configured to delete target data in the data set corresponding to the full index when data in the data set corresponding to the target index identifier is updated, wherein the target data is data corresponding to the data to be updated and already stored in the data set corresponding to the full index;
[0053] The first updating module is used to update the data to be updated to the data set corresponding to the real-time index.
[0054] Optionally, when the index deployment mode corresponding to the search server is that the full index and the real-time index are not deployed on the same machine, the device further includes:
[0055] A second deletion module is configured to delete target data in the data set corresponding to the full index and the data set corresponding to the real-time index when data in the data set corresponding to the target index identifier is added, wherein the target data is data that has been stored in the data set corresponding to the full index and the data set corresponding to the real-time index and corresponds to the data to be added;
[0056] The second updating module is used to update the data to be added to the data set corresponding to the real-time index.
[0057] Optionally, the device further comprises:
[0058] A third updating module, used to update the data set corresponding to the full index at a predetermined update time;
[0059] The third deletion module is used to delete the data set corresponding to the real-time index before the scheduled update time when the index deployment mode corresponding to the search server is that the full index and the real-time index are not deployed on the same machine.
[0060] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the search method described in the first aspect or the second aspect when executing the program.
[0061] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the search method described in the first aspect or the second aspect are implemented.
[0062] The technical solution provided by the embodiment of the present application is that after the search engine proxy server receives the target search request sent by the user terminal, it determines the target index deployment mode corresponding to the target index identifier according to the correspondence between the pre-configured index identifier and the index deployment mode; sends the target search request to the target search server corresponding to the target index deployment mode; and receives the target search result matching the target search term fed back by the target search server. It can be seen that through the technical solution provided by the embodiment of the present application, the same search engine can support different index deployment modes. In this way, for different business scenarios, the search engine can adopt different index deployment modes, which is flexible to use and can meet the search needs of users. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 It is a flowchart of the steps of a search method applied to a search engine proxy server provided in an embodiment of the present application;
[0064] Figure 2is a flowchart of a search method applied to a search server provided in an embodiment of the present application;
[0065] Figure 3 A schematic diagram of a real-time message processing flow when a full index and a real-time index are deployed on the same machine provided by an embodiment of the present application;
[0066] Figure 4 A schematic diagram of a real-time message processing flow when full indexing and real-time indexing are not deployed on the same machine provided by an embodiment of the present application;
[0067] Figure 5 A schematic diagram of a data processing flow for updating a data set corresponding to a full index provided in an embodiment of the present application;
[0068] Figure 6 It is a structural block diagram of a search method device applied to a search engine proxy server provided in an embodiment of the present application;
[0069] Figure 7 It is a structural block diagram of a search method device applied to a search server provided in an embodiment of the present application;
[0070] Figure 8 It is a structural block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0071] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0072] In order to solve the technical problems described in the background technology, the embodiments of the present application provide a search method, device, electronic device and storage medium.
[0073] In addition, for the sake of clarity in describing the solution, the full index and real-time index involved in the embodiments of the present application will be introduced below.
[0074] In search engines, documents can be divided into full index and real-time index according to their update frequency and size. The full index stores the entire set of data and is updated periodically, for example, the data set corresponding to the full index is updated every preset number of days or hours. The real-time index stores a subset of the data, which only saves the data that has changed during each full index construction cycle. Through full index and real-time index, it can be ensured that the search engine can recall all the data that users want and ensure the timeliness of the data.
[0075] Although both full index and real-time index are inverted indexes, their overall structures are completely different. This is because the full index structure uses a more space-saving solution to ensure that as much data as possible can be stored within a limited storage space; while the real-time index focuses on the real-time nature of data updates, so a storage structure with higher update efficiency is required to ensure that more new data is received per unit time.
[0076] In actual applications, there are usually two ways to deploy indexes for full indexing and real-time indexing.
[0077] The first index deployment method is: full index and real-time index are deployed on the same machine. Specifically, a search server is deployed with full index and real-time index at the same time. In this index deployment method, the business party will update the full data to the search engine at one time, and the search engine will store all the data in segments. The subsequent real-time data updates will be pushed to the search engine one by one to complete the real-time index construction. This ensures that a search server stores the full data of the business and the real-time updated data.
[0078] When the full index and real-time index are deployed on the same machine, during the data update process, the search engine completes the real-time index construction one by one, and regularly merges the real-time index with the full index. This deployment and operation method is simple, but it has certain hidden dangers in stability and availability. Once the data is contaminated, all data needs to be rebuilt, which takes a long time. If a machine failure or service abnormality occurs, the search will result in no results, seriously affecting the user experience.
[0079] The second index deployment method is: the full index and the real-time index are not deployed on the same machine, that is, the full index and the real-time index are deployed in two electronic devices, namely two search servers, respectively, such as major Chinese search engines. In this index deployment method, the full index is regularly built on the offline end and distributed to each online search engine, while the real-time index receives updated data in real time.
[0080] When the full index and real-time index are not deployed on the same machine, when faced with massive data updates, the recall results from the full index and the real-time index can be merged to ensure the timeliness of the data and effectively isolate the data, thereby improving the stability of the service. However, this method is complex in operation and maintenance, the real-time processing process is complex, and there may be a waste of resources.
[0081] As can be seen from the above description, the two index deployment methods have their own advantages and disadvantages. Currently, for the same search engine, the search engine only supports the deployment of full index and real-time index on the same machine, or the search engine only supports the deployment of full index and real-time index on different machines.
[0082] In the implementation of the present application, a search server is proposed to support the deployment of full index and real-time index on the same machine, and the deployment of full index and real-time index on different machines. Specifically, different index deployment methods can be used according to different business scenarios.
[0083] In business scenarios with less data updates, the full index and real-time index are deployed on the same machine, which can simplify operation and maintenance and save resources. In business scenarios with massive data updates, the full index and real-time index are deployed on different machines, which can effectively ensure the stability of the search server cluster.
[0084] Furthermore, the embodiments of the present application are compatible with both co-machine deployment and non-co-machine deployment in terms of index structure design and real-time index building process.
[0085] A search method, device, electronic device and storage medium provided in an embodiment of the present application will be described in detail below.
[0086] In the first aspect, a search method applied to a search engine proxy server is first introduced.
[0087] like Figure 1 As shown, the search method provided in the embodiment of the present application may include the following steps:
[0088] S110: Receive a target search request sent by a user terminal.
[0089] The target search request carries a target search term and a target index identifier. The target index identifier is determined based on the business scenario corresponding to the target search request. Different business scenarios correspond to different target index identifiers.
[0090] Specifically, when a user wants to search for content, the user can send a search request to the search engine proxy server through the user terminal, so that the search engine proxy server can receive the search request. For the sake of clear description of the solution, the search request can be called a target search request.
[0091] In addition, the target search request carries a target search term and a target index identifier. The target search term is the content that the user wants to search for, such as Haidilao. The target index identifier can be a target index name, and the target index identifier can be determined based on the business scenario corresponding to the target search request, and different business scenarios correspond to different target index identifiers. Specifically, in actual applications, two different target search requests carry the same search term, but if the business scenarios corresponding to the two different target search requests are different, the two different target search requests carry different target index identifiers.
[0092] For example, in one business scenario, a user searches for Haidilao on the Meituan homepage. At this time, the search term carried in the target search request is Haidilao, and the index identifier carried in the target search request is mainshop. In another business scenario, a user searches for Haidilao on Meituan Waimai. At this time, the target search term carried in the target search request is also Haidilao, but the target index identifier carried in the target search request is waimaipoi.
[0093] S120: Determine a target index deployment mode corresponding to the target index identifier according to a pre-configured correspondence between the index identifier and the index deployment mode.
[0094] Among them, different target index identifiers correspond to different target index deployment methods.
[0095] In the embodiment of the present application, the index deployment method adopted by the search engine may be different for different business scenarios. Specifically, when facing a business scenario with less data updates, an index deployment method in which the full index and the real-time index are deployed on the same machine is adopted, which can simplify operation and maintenance and save resources. When facing a business with massive data updates, an index deployment method in which the full index and the real-time index are not deployed on the same machine is adopted, which can effectively ensure the stability of the search server cluster.
[0096] The target index identifier is determined based on the business scenario corresponding to the target search request. Therefore, in order to accurately determine which index deployment method should be adopted after receiving the target search request, the corresponding relationship between the index identifier and the index deployment method can be pre-configured, so that after receiving the target search request, the target index deployment method corresponding to the target index identifier can be accurately determined. The target index deployment method corresponding to the target index identifier can be an index deployment method in which the full index and the real-time index are deployed on the same machine, or an index deployment method in which the full index and the real-time index are not deployed on the same machine.
[0097] S130: Send a target search request to a target search server corresponding to the target index deployment mode.
[0098] Specifically, when the target index deployment mode is an index deployment mode in which the full index and the real-time index are deployed on the same machine, there is only one target search server corresponding to the target index deployment mode. Therefore, the search engine proxy server only needs to send the target search request once.
[0099] When the target index deployment mode is an index deployment mode in which the full index and the real-time index are not deployed on the same machine, the target index deployment mode corresponds to not only one but two target search servers. Therefore, the search engine proxy server needs to send the target search request twice.
[0100] In one implementation, when the target index deployment mode is that the full index and the real-time index are deployed on different machines, sending a target search request to a target search server corresponding to the target index deployment mode may include:
[0101] A target search request is sent to a first search server corresponding to the full index, and a target search request is sent to a second search server corresponding to the real-time index.
[0102] In this embodiment, the full index and real-time search are deployed in two different search servers respectively. Therefore, in order to obtain accurate search results in subsequent steps, the search engine proxy server needs to send the target search request to the first search server corresponding to the full index, and send the target search request to the second search server corresponding to the real-time index.
[0103] In another implementation, when the target index deployment mode is full and the real-time index is deployed on the same machine, sending a target search request to a target search server corresponding to the target index deployment mode may include:
[0104] A target search request is sent to a third search server corresponding to the full index and the real-time index.
[0105] In this implementation, the full index and the real-time index are deployed in the same search server. Therefore, the search engine proxy server only needs to send the target search request to the third search server corresponding to the full index and the real-time index to obtain accurate search results in subsequent steps.
[0106] S140, receiving target search results matching the target search term fed back by the target search server.
[0107] Specifically, after receiving the target search request sent by the search engine proxy server, the target search server can parse the target search request, obtain the target search term and target index identifier carried in the target search request, and search for search results matching the target search term from the data set corresponding to the target index identifier.
[0108] Inside the search engine, the full index is split into multiple segments based on the total amount of data. The data stored in each segment is unique. When processing a target search request, the search engine will recall all relevant data from all segments, merge the data, and then sort and package them uniformly. The real-time index is also stored in the search engine in the form of one or more segments. During the result recall process, in addition to retrieving the segments of the full index, all real-time indexes are also retrieved. The result merging, sorting, and packaging are the same as for the full index.
[0109] It can be understood that when the target index deployment method is an index deployment method in which the full index and the real-time index are deployed on the same machine, there is only one target search server corresponding to the target index deployment method, and the search engine proxy server only sends a target search request to one target search server. Therefore, the search engine proxy server only receives the search results fed back by this target search server.
[0110] When the target index deployment mode is an index deployment mode in which the full index and the real-time index are not deployed on the same machine, there are two target search servers corresponding to the target index deployment mode. The search engine proxy server sends the target search request to two different target search servers. Therefore, the search engine proxy server receives the search results fed back by the two target search servers.
[0111] In one implementation, when the target index deployment mode is that the full index and the real-time index are deployed on different machines, receiving the target search result matching the target search term fed back by the target search server may include:
[0112] receiving a first search result fed back by the first search server and a second search result fed back by the second search server;
[0113] The first search result and the second search result are deduplicated and sorted to obtain a target search result.
[0114] In this embodiment, after the search engine proxy server receives the first search result fed back by the first search server corresponding to the full index and the second search result fed back by the second search server corresponding to the real-time index, since there may be duplicate search results in the first search result and the second search result, it is necessary to deduplicate the first search result and the second search result to obtain the deduplicated search results, and sort the deduplicated search results to obtain the target search results.
[0115] In another implementation, when the target index deployment mode is full index and real-time index are deployed on the same machine, receiving the target search result matching the target search term fed back by the target search server may include:
[0116] A third search result fed back by a third search server is received, and the third search result is used as a target search result.
[0117] In this implementation, the search engine only receives the third search result fed back by the third search server corresponding to the full engine and the real-time engine, and therefore, the third search result can be used as the target search result.
[0118] Furthermore, after obtaining the target search results fed back by the target search server, the search engine proxy server may send all the target search results to the user terminal, or may send the top-ranked search results in the target search results to the user terminal, so that the user can view the content he wants to search for.
[0119] The technical solution provided by the embodiment of the present application is that after the search engine proxy server receives the target search request sent by the user terminal, it determines the target index deployment mode corresponding to the target index identifier according to the correspondence between the pre-configured index identifier and the index deployment mode; sends the target search request to the target search server corresponding to the target index deployment mode; receives the target search result matching the target search term fed back by the target search server; and sends the target search result to the user terminal. It can be seen that through the technical solution provided by the embodiment of the present application, the same search engine can support different index deployment modes. In this way, for different business scenarios, the search engine can adopt different index deployment modes, which is flexible to use and can meet the search needs of users.
[0120] In the second aspect, a search method applied to a search server provided in an embodiment of the present application will be introduced in detail.
[0121] like Figure 2 As shown, a search method applied to a search server provided in an embodiment of the present application may include the following steps:
[0122] S210, receiving a target search request sent by a search engine proxy server.
[0123] The target search request carries a target search term and a target index identifier, and the target index identifier is determined based on the business scenario corresponding to the search request. The target index identifier is determined based on the business scenario corresponding to the target search request, and the search engine proxy server determines the target index deployment mode corresponding to the target index identifier according to the correspondence between the pre-configured index identifier and the index deployment mode, and determines the search server corresponding to the target index deployment mode, and sends the target search request to the target search server, wherein different business scenarios correspond to different target index identifiers, and different target index identifiers correspond to different target index deployment modes.
[0124] Specifically, when a user wants to search for content, the user can send a search request to the search engine proxy server through the user terminal, so that the search engine proxy server can receive the search request. For the sake of clear description of the solution, the search request can be called a target search request.
[0125] In addition, the target search request carries a target search term and a target index identifier, where the target search term is the content that the user wants to search for, such as Haidilao. The target index identifier may be a target index name, and the target index identifier may be determined based on the business scenario corresponding to the search request. In actual applications, two different target search requests carry the same target search term, but if the business scenarios corresponding to the two different target search requests are different, the target index identifiers carried by the two different target search requests are different.
[0126] For example, in one business scenario, a user searches for Haidilao on the Meituan homepage. At this time, the search term carried in the target search request is Haidilao, and the index identifier carried in the target search request is mainshop. In another business scenario, a user searches for Haidilao on Meituan Waimai. At this time, the search term carried in the target search request is also Haidilao, but the index identifier carried in the target search request is waimaipoi.
[0127] In the embodiment of the present application, the index deployment method adopted by the search engine may be different for different business scenarios. Specifically, when facing a business scenario with less data updates, an index deployment method in which the full index and the real-time index are deployed on the same machine is adopted, which can simplify operation and maintenance and save resources. When facing a business with massive data updates, an index deployment method in which the full index and the real-time index are not deployed on the same machine is adopted, which can effectively ensure the stability of the search server cluster.
[0128] The target index identifier is determined based on the business scenario corresponding to the target search request. Therefore, in order to accurately determine which index deployment method should be adopted after receiving the target search request, the corresponding relationship between the index identifier and the index deployment method can be pre-configured, so that after receiving the target search request, the target index deployment method corresponding to the target index identifier can be accurately determined. The target index deployment method corresponding to the target index identifier can be an index deployment method in which the full index and the real-time index are deployed on the same machine, or an index deployment method in which the full index and the real-time index are not deployed on the same machine.
[0129] After the search engine proxy server determines the target index deployment mode, it can send a target search request to the target search server corresponding to the target index deployment mode. When the target index deployment mode is an index deployment mode in which the full index and the real-time index are deployed on the same machine, there is one target search server, so only one search server receives the target search request. When the target index deployment mode is an index deployment mode in which the full index and the real-time index are deployed on the same machine, there are two target search servers, so two search servers receive the target search request.
[0130] S220: Searching for search results matching the target search term from the data set corresponding to the target index identifier.
[0131] S230, sorting the search results and feeding back the sorted search results to the search engine proxy server.
[0132] Specifically, after receiving the target search request sent by the search engine proxy server, the search server can parse the target search request, obtain the target search term and target index identifier carried in the target search request, and search for search results matching the target search term from the data set corresponding to the target index identifier.
[0133] Inside the search engine, the full index is split into multiple segments based on the total amount of data. The data stored in each segment is unique. When processing a target search request, the search engine will recall all relevant data from all segments, merge the data, and then sort and package them uniformly. The real-time index is also stored in the search engine in the form of one or more segments. During the result recall process, in addition to retrieving the segments of the full index, all real-time indexes are also retrieved. The result merging, sorting, and packaging are the same as for the full index, and the sorted search results are fed back to the search engine proxy server. In this way, the search engine proxy server can feed back the search results to the user terminal.
[0134] The technical solution provided by the embodiment of the present application is that after the search engine proxy server receives the target search request sent by the user terminal, it determines the target index deployment mode corresponding to the target index identifier according to the correspondence between the pre-configured index identifier and the index deployment mode; sends the target search request to the target search server corresponding to the target index deployment mode; and receives the target search result matching the target search term fed back by the target search server. It can be seen that through the technical solution provided by the embodiment of the present application, the same search engine can have different index deployment modes. In this way, for different business scenarios, the search engine can adopt different index deployment modes, which is flexible to use and can meet the search needs of users.
[0135] In one embodiment, when the index deployment mode corresponding to the search server is that the full index and the real-time index are deployed on the same machine, when the data set corresponding to the target index identifier is updated, the search method applied to the search server may further include the following steps, namely step a1 and step a2:
[0136] Step a1: Delete the target data in the data set corresponding to the full index.
[0137] The target data is the data corresponding to the data to be updated that has been stored in the data set corresponding to the full index.
[0138] Step a2: update the data to be updated to the data set corresponding to the real-time index.
[0139] In this embodiment, when the full index and the real-time index are deployed on the same machine, in order to ensure that the search results are complete and non-repetitive, the search server does not adopt the same duplicate filtering strategy as the search engine proxy server. Instead, during the real-time data update process, for each new data to be updated, before adding the data to be updated to the data set corresponding to the real-time index, the search server will first delete the old data corresponding to the data to be updated that has been stored in the data set corresponding to the full index. This ensures that each piece of data will only appear in the data set corresponding to the full index or the data set corresponding to the real-time index, thereby ensuring that even if the full index and the real-time index are deployed on the same machine, the accuracy of information recall will be guaranteed and there will be no duplication.
[0140] The following will describe in detail the real-time message processing flow when the full index and real-time index are deployed on the same machine with specific examples. Figure 3 shown.
[0141] like Figure 3 The figure shows the process flow of real-time message processing in this solution when the full index and real-time index are deployed on the same machine. The search engine will perform different data update processes based on the type of each message.
[0142] For deleted data, the search engine directly deletes the document.
[0143] For newly added documents, the old documents will first be deleted from the existing full index segment and real-time index segment, and then the document will be added to the latest real-time index segment.
[0144] For update operations, if only fixed-length field updates are involved, the data content in the index is modified directly. If text updates or variable-length field updates are involved, the process of adding new documents is directly executed. Through such data processing, it can be effectively guaranteed that each data in the search engine is unique and up-to-date.
[0145] The following will describe in detail the real-time message processing flow when the full index and real-time index are deployed on the same machine with specific examples. Figure 3 shown.
[0146] In one embodiment, when the index deployment mode corresponding to the search server is that the full index and the real-time index are deployed on different machines, when the data of the data set corresponding to the target index identifier increases, the search method applied to the search server may further include the following steps, namely step b1 and step b2:
[0147] Step b1, delete the target data in the data set corresponding to the full index and the data set corresponding to the real-time index.
[0148] The target data is the data that has been stored in the data set corresponding to the full index and the data set corresponding to the real-time index and corresponds to the data to be added.
[0149] Step b2: Update the data to be added to the data set corresponding to the real-time index.
[0150] Specifically, the index structure of the full index uses compact memory. In order to ensure that as much data as possible is stored, it does not support the addition of new data. Therefore, when the full index and the real-time index are not deployed on the same machine, all newly added data are stored in the real-time index. When the search engine proxy server receives a target search request, it sends the target search request to the search server corresponding to the full index and the search server corresponding to the real-time index through the search engine proxy server. The search results fed back by the search server corresponding to the full index and the search server corresponding to the real-time index are the latest.
[0151] The following will describe in detail the process of processing real-time messages when full index and real-time index are not deployed on the same machine, with specific examples. Figure 4 shown.
[0152] Figure 4 This is a flowchart of data update when the full index and real-time index are not deployed on the same machine. When the full index and real-time index are not deployed on the same machine, the processing flow for the real-time index is the same as when the full index and real-time index are deployed on the same machine; for the full index, when the full index and real-time index are not deployed on the same machine, only deletion and update operations are performed, and no addition operations are performed. In this way, the search results fed back by the search server corresponding to the full index and the search server corresponding to the real-time index are the latest.
[0153] In one implementation, the search method applied to the search server may further include the following steps, namely step c1 and step c2:
[0154] Step c1: Update the data set corresponding to the full index at the scheduled update time.
[0155] Step c2: when the index deployment mode corresponding to the search server is that the full index and the real-time index are not deployed on the same machine, the data set corresponding to the real-time index before the scheduled update time is deleted.
[0156] Specifically, whether the full index and the real-time index are deployed on the same machine or on different machines, in order to ensure that the data in the data set corresponding to the full index is the latest, the data set corresponding to the full index needs to be updated at the scheduled update time. However, when the full index and the real-time index are deployed at different levels, since the data in the data set corresponding to the real-time index is not complete, in order to maintain data consistency, the data set corresponding to the real-time index before the scheduled update time needs to be deleted.
[0157] The following will describe in detail the data processing flow of updating the data set corresponding to the full index with specific examples. Figure 5 shown.
[0158] like Figure 5 As shown in the figure, the search engine will also regularly update the data set corresponding to the full index. Updating the data set corresponding to the full index means re-indexing all documents and then distributing the constructed full index to each search engine. When the new version of the full index is distributed to all search engines, the search engine will delete the old version of the data, load the new version of the full index to complete the index switch, and then use the new version of the full index to provide retrieval services.
[0159] When the full index and the real-time index are not deployed on the same machine, since the data in the data set corresponding to the real-time index is not complete, in order to maintain data consistency, when the full index and the real-time index are not deployed on the same machine, the search engine will delete the real-time index in the search engine according to the timestamp when the full index construction starts, that is, delete the data before the timestamp when the full index construction starts.
[0160] It should be noted that, for the method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions involved are not necessarily required by the present application.
[0161] In a third aspect, the present application provides a search device, which is applied to a search engine proxy server, such as Figure 6 As shown, the device comprises:
[0162] A search request receiving module 610 is used to receive a target search request sent by a user terminal, wherein the target search request carries a target search term and a target index identifier, wherein the target index identifier is determined based on a business scenario corresponding to the target search request, and different business scenarios correspond to different target index identifiers;
[0163] An index deployment mode determination module 620 is used to determine a target index deployment mode corresponding to the target index identifier according to a pre-configured correspondence relationship between the index identifier and the index deployment mode, where different target index identifiers correspond to different target index deployment modes;
[0164] A search request sending module 630, configured to send the target search request to a target search server corresponding to the target index deployment mode;
[0165] The search result receiving module 640 is used to receive the target search result matching the target search term fed back by the target search server.
[0166] The technical solution provided by the embodiment of the present application is that after the search engine proxy server receives the target search request sent by the user terminal, it determines the target index deployment mode corresponding to the target index identifier according to the correspondence between the pre-configured index identifier and the index deployment mode; sends the target search request to the target search server corresponding to the target index deployment mode; receives the target search result matching the target search term fed back by the target search server; and sends the target search result to the user terminal. It can be seen that through the technical solution provided by the embodiment of the present application, the same search engine can support different index deployment modes. In this way, for different business scenarios, the search engine can adopt different index deployment modes, which is flexible to use and can meet the search needs of users.
[0167] Optionally, when the target index deployment mode is that the full index and the real-time index are deployed on different machines, the search request sending module is specifically used to:
[0168] Sending the target search request to a first search server corresponding to the full index, and sending the target search request to a second search server corresponding to the real-time index;
[0169] Accordingly, the search result receiving module is specifically used for:
[0170] receiving a first search result fed back by the first search server and a second search result fed back by the second search server;
[0171] The first search result and the second search result are deduplicated and sorted to obtain a target search result.
[0172] Optionally, when the target index deployment mode is full index and real-time index are deployed on the same machine, the search request sending module is specifically used to:
[0173] Sending the target search request to a third search server corresponding to the full index and the real-time index;
[0174] Accordingly, the search result receiving module is specifically used for:
[0175] A third search result fed back by the third search server is received, and the third search result is used as the target search result.
[0176] In a fourth aspect, an embodiment of the present application provides a search device, which is applied to a search server, such as Figure 7 As shown, the device comprises:
[0177] The receiving module 710 is used to receive a target search request sent by a search engine proxy server, wherein the target search request carries a target search term and a target index identifier, wherein the target index identifier is determined based on a business scenario corresponding to the target search request, and the search engine proxy server determines the target index deployment mode corresponding to the target index identifier according to a correspondence between a pre-configured index identifier and an index deployment mode, and determines a search server corresponding to the target index deployment mode, and sends the target search request to the target search server, wherein different business scenarios correspond to different target index identifiers, and different target index identifiers correspond to different target index deployment modes;
[0178] A search module 720, configured to search for search results matching the target search term from the data set corresponding to the target index identifier;
[0179] The sorting module 730 is used to sort the search results and feed back the sorted search results to the search engine proxy server.
[0180] The technical solution provided by the embodiment of the present application is that after the search engine proxy server receives the target search request sent by the user terminal, it determines the target index deployment mode corresponding to the target index identifier according to the correspondence between the pre-configured index identifier and the index deployment mode; sends the target search request to the target search server corresponding to the target index deployment mode; receives the target search result matching the target search term fed back by the target search server; and sends the target search result to the user terminal. It can be seen that through the technical solution provided by the embodiment of the present application, the same search engine can have different index deployment modes. For different business scenarios, the search engine can adopt different index deployment modes, which is flexible to use and can meet the search needs of users.
[0181] Optionally, when the index deployment mode corresponding to the search server is that the full index and the real-time index are deployed on the same machine, the device further includes:
[0182] A first deletion module, configured to delete target data in the data set corresponding to the full index when data in the data set corresponding to the target index identifier is updated, wherein the target data is data corresponding to the data to be updated and already stored in the data set corresponding to the full index;
[0183] The first updating module is used to update the data to be updated to the data set corresponding to the real-time index.
[0184] Optionally, when the index deployment mode corresponding to the search server is that the full index and the real-time index are not deployed on the same machine, the device further includes:
[0185] A second deletion module is configured to delete target data in the data set corresponding to the full index and the data set corresponding to the real-time index when data in the data set corresponding to the target index identifier is added, wherein the target data is data that has been stored in the data set corresponding to the full index and the data set corresponding to the real-time index and corresponds to the data to be added;
[0186] The second updating module is used to update the data to be added to the data set corresponding to the real-time index.
[0187] Optionally, the device further comprises:
[0188] A third updating module, used to update the data set corresponding to the full index at a predetermined update time;
[0189] The third deletion module is used to delete the data set corresponding to the real-time index before the scheduled update time when the index deployment mode corresponding to the search server is that the full index and the real-time index are not deployed on the same machine.
[0190] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0191] In a fifth aspect, an embodiment of the present application provides an electronic device, such as Figure 8 As shown, it includes a memory 810, a processor 820, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps of the search method described in the first aspect or the second aspect are implemented.
[0192] The technical solution provided by the embodiment of the present application is that after the search engine proxy server receives the target search request sent by the user terminal, it determines the target index deployment mode corresponding to the target index identifier according to the correspondence between the pre-configured index identifier and the index deployment mode; sends the target search request to the target search server corresponding to the target index deployment mode; and receives the target search result matching the target search term fed back by the target search server. It can be seen that through the technical solution provided by the embodiment of the present application, the same search engine can support different index deployment modes. In this way, for different business scenarios, the search engine can adopt different index deployment modes, which is flexible to use and can meet the search needs of users.
[0193] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the search method described in the first aspect or the second aspect are implemented.
[0194] The technical solution provided by the embodiment of the present application is that after the search engine proxy server receives the target search request sent by the user terminal, it determines the target index deployment mode corresponding to the target index identifier according to the correspondence between the pre-configured index identifier and the index deployment mode; sends the target search request to the target search server corresponding to the target index deployment mode; and receives the target search result matching the target search term fed back by the target search server. It can be seen that through the technical solution provided by the embodiment of the present application, the same search engine can support different index deployment modes. In this way, for different business scenarios, the search engine can adopt different index deployment modes, which is flexible to use and can meet the search needs of users.
[0195] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0196] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0197] The present application is described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0198] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0199] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0200] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0201] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0202] The above is a detailed introduction to a search method, device, electronic device and storage medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A search method, the method comprising: receiving a target search request sent by a user terminal, wherein the target search request carries a target search term and a target index identifier, wherein the target index identifier is determined based on a business scenario corresponding to the target search request, and different business scenarios correspond to different target index identifiers; Determine the target index deployment mode corresponding to the target index identifier according to the correspondence between the pre-configured index identifier and the index deployment mode, where different target index identifiers correspond to different target index deployment modes; Sending the target search request to a target search server corresponding to the target index deployment mode; Receiving target search results matching the target search term fed back by the target search server; Wherein, when the target index deployment mode is that the full index and the real-time index are deployed on different machines, sending the target search request to the target search server corresponding to the target index deployment mode includes: Sending the target search request to a first search server corresponding to the full index, and sending the target search request to a second search server corresponding to the real-time index; Correspondingly, the receiving of the target search result matching the target search term fed back by the target search server includes: receiving a first search result fed back by the first search server and a second search result fed back by the second search server; The first search result and the second search result are deduplicated and sorted to obtain a target search result.
2. The method according to claim 1, characterized in that: When the target index deployment mode is that the full index and the real-time index are deployed on the same machine, sending the target search request to the target search server corresponding to the target index deployment mode includes: Sending the target search request to a third search server corresponding to the full index and the real-time index; Correspondingly, the receiving of the target search result matching the target search term fed back by the target search server includes: A third search result fed back by the third search server is received, and the third search result is used as the target search result.
3. A search method, characterized in that: The method comprises: Receive a target search request sent by a search engine proxy server, the target search request carries a target search term and a target index identifier, the target index identifier is determined based on a business scenario corresponding to the target search request, the search engine proxy server determines a target index deployment mode corresponding to the target index identifier according to a correspondence between a pre-configured index identifier and an index deployment mode, determines a target search server corresponding to the target index deployment mode, and sends the target search request to the target search server, wherein different business scenarios correspond to different target index identifiers, and different target index identifiers correspond to different target index deployment modes; Searching for search results matching the target search term from the data set corresponding to the target index identifier; Sorting the search results and feeding back the sorted search results to the search engine proxy server; Wherein, when the index deployment mode corresponding to the search server is that the full index and the real-time index are deployed on the same machine, when the data set corresponding to the target index identifier is updated, the method further includes: Deleting target data in the data set corresponding to the full index, wherein the target data is data corresponding to the data to be updated and already stored in the data set corresponding to the full index; The data to be updated is updated to the data set corresponding to the real-time index.
4. The method according to claim 3, characterized in that When the index deployment mode corresponding to the search server is that the full index and the real-time index are deployed on different machines, when the data of the data set corresponding to the target index identifier increases, the method further includes: Delete target data in the data set corresponding to the full index and the data set corresponding to the real-time index, where the target data is data that has been stored in the data set corresponding to the full index and the data set corresponding to the real-time index and corresponds to the data to be added; Update the data to be added to the data set corresponding to the real-time index.
5. The method according to any one of claims 3 to 4, characterized in that: The method further comprises: Updating the data set corresponding to the full index at a predetermined update time; When the index deployment mode corresponding to the search server is that the full index and the real-time index are not deployed on the same machine, the data set corresponding to the real-time index before the scheduled update time is deleted.
6. A search device, characterized in that: The device comprises: A search request receiving module, configured to receive a target search request sent by a user terminal, wherein the target search request carries a target search term and a target index identifier, wherein the target index identifier is determined based on a business scenario corresponding to the target search request, and different business scenarios correspond to different target index identifiers; An index deployment mode determination module is used to determine the target index deployment mode corresponding to the target index identifier according to the correspondence between the pre-configured index identifier and the index deployment mode, different target index identifiers correspond to different target index deployment modes, and determine the target search server corresponding to the target index deployment mode; A search request sending module, used to send the target search request to the target search server corresponding to the target index deployment mode; A search result receiving module, configured to receive a target search result matching the target search term fed back by the target search server; Wherein, when the target index deployment mode is that the full index and the real-time index are deployed on different machines, the search request sending module is specifically used to: Sending the target search request to a first search server corresponding to the full index, and sending the target search request to a second search server corresponding to the real-time index; Accordingly, the search result receiving module is specifically used for: receiving a first search result fed back by the first search server and a second search result fed back by the second search server; The first search result and the second search result are deduplicated and sorted to obtain a target search result.
7. The device according to claim 6, characterized in that When the target index deployment mode is that the full index and the real-time index are deployed on the same machine, the search request sending module is specifically used to: Sending the target search request to a third search server corresponding to the full index and the real-time index; Accordingly, the search result receiving module is specifically used for: A third search result fed back by the third search server is received, and the third search result is used as the target search result.
8. A search device, characterized in that: The device comprises: A receiving module, used to receive a target search request sent by a search engine proxy server, wherein the target search request carries a target search term and a target index identifier, wherein the target index identifier is determined based on a business scenario corresponding to the target search request, and the search engine proxy server determines a target index deployment method corresponding to the target index identifier according to a correspondence between a pre-configured index identifier and an index deployment method, and determines a target search server corresponding to the target index deployment method, and sends the target search request to the target search server, wherein different business scenarios correspond to different target index identifiers, and different target index identifiers correspond to different target index deployment methods; A search module, configured to search for search results matching the target search term from the data set corresponding to the target index identifier; A sorting module, used to sort the search results and feed back the sorted search results to the search engine proxy server; Wherein, when the index deployment mode corresponding to the search server is that the full index and the real-time index are deployed on the same machine, the device further includes: A first deletion module, configured to delete target data in the data set corresponding to the full index when data in the data set corresponding to the target index identifier is updated, wherein the target data is data corresponding to the data to be updated and already stored in the data set corresponding to the full index; The first updating module is used to update the data to be updated to the data set corresponding to the real-time index.
9. The device according to claim 8, characterized in that When the index deployment mode corresponding to the search server is that the full index and the real-time index are not deployed on the same machine, the device further includes: A second deletion module is configured to delete target data in the data set corresponding to the full index and the data set corresponding to the real-time index when data in the data set corresponding to the target index identifier is added, wherein the target data is data that has been stored in the data set corresponding to the full index and the data set corresponding to the real-time index and corresponds to the data to be added; The second updating module is used to update the data to be added to the data set corresponding to the real-time index.
10. The device according to any one of claims 8 to 9, characterized in that The device also includes: A third updating module, used to update the data set corresponding to the full index at a predetermined update time; The third deletion module is used to delete the data set corresponding to the real-time index before the scheduled update time when the index deployment mode corresponding to the search server is that the full index and the real-time index are not deployed on the same machine.
11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the search method according to any one of claims 1 to 2, or 3 to 5 are implemented.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the search method according to any one of claims 1 to 2, or 3 to 5 are implemented.
Citation Information
Patent Citations
Real-time index creating and real-time searching method and device
CN103294731A
Method, device and system for searching Internet information resources
CN104991907A
Routing data and connecting users based on interactions with machine-readable code of content data
CN106796612A
Construction method of index system and method and device of achieving search
CN107203532A
Searching method, device and searching engine system
CN107545004A
