A search task processing method, electronic device and storage medium

By using a thread pool to concurrently execute the core and peripheral subtasks of the route information search task and integrating and returning the results at key time points, the problem of long search time and low accuracy in existing technologies is solved, and more efficient and accurate search results are obtained.

CN120029772BActive Publication Date: 2025-11-11MOBILE TECH COMPANY CHINA TRAVELSKY HLDG
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510118253.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-24
Publication Date
2025-11-11
Estimated Expiration
2045-01-24

AI Technical Summary

Technical Problem

Existing technologies, when performing route information search tasks, result in long search times due to the sequential execution of subtasks, unstable third-party API interfaces affecting response time, and dynamic changes in route information causing information to become outdated, thus reducing the accuracy of search results.

Method used

The core subtask and edge subtask are executed concurrently using thread pool technology. When the core subtask returns a result, the key update time point is recorded. The initial return result list is copied as the first return result. The waiting time of the unfinished subtask is calculated according to the preset importance weight mapping list. All return results are integrated at the predicted time point.

Benefits of technology

It shortens search time, improves search efficiency and the accuracy of results, and avoids the need to wait for all subtasks to complete before integrating and returning the results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120029772B_ABST
    Figure CN120029772B_ABST
Patent Text Reader

Abstract

The application provides a search task processing method, an electronic device and a storage medium, relates to the technical field of task processing, and is based on thread pool technology to concurrently execute core subtasks and all edge subtasks. When a return result of the core subtask is received, a time point at this moment is recorded as a key update time point, and an initial return result list at this moment is copied as a first return result list. When the first return result is NULL, it is indicated that an edge subtask corresponding to the first return result has not been completed, a candidate waiting duration corresponding to an uncompleted subtask identifier is acquired, the maximum candidate waiting duration is taken as a target waiting duration, and when a time point obtained by adding the key update time point and the target waiting duration is reached, all initial return results in the initial return result list at this moment are integrated to acquire a final return result corresponding to the search task. The overall search time is shortened, and the overall search efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of task processing technology, and in particular to a search task processing method, electronic device, and storage medium. Background Technology

[0002] Route information includes flight number, airline, aircraft type, flight departure time, flight arrival time, ticket information, etc. When searching for route information, a search task consisting of one or more subtasks is often generated based on the departure address and destination address entered by the target user. For example, the search task is "search for ticket information from the departure address to the destination address directly". The subtasks corresponding to the search task may include, but are not limited to, "search for flights from the departure address to the destination address directly", "search for flights from the departure address to the destination address via a transit address", "search for the ticket price of each flight", and "query the number of remaining tickets for each flight". In the process of obtaining the return results of the search task, a thread is created to execute each subtask in sequence. When all subtasks are completed, the return results of all subtasks are integrated and processed to obtain the return result corresponding to the search task.

[0003] However, the above method also has the following technical problems:

[0004] The above method requires executing each subtask sequentially. Only after all subtasks are completed are the results of all subtasks integrated and processed to obtain the results corresponding to the search task. The overall search time is relatively long, and the execution of subtasks requires the allocation of API interfaces from third-party service providers (such as airlines). The response time of third-party API interfaces may be unstable, resulting in excessively long subtask execution times, which further prolongs the overall search time and leads to low overall search efficiency. Furthermore, route information is dynamically changing, especially in the case of flight delays, cancellations, or fare changes. If the execution time interval between subtasks is long, some information may become outdated, reducing the accuracy of the search task's returned results. Summary of the Invention

[0005] To address the aforementioned technical problems, the technical solution adopted by this invention is as follows:

[0006] According to a first aspect of the present invention, a search task processing method is provided, wherein the search task is a task for searching relevant information from a target departure address to a target arrival address, the method comprising the following steps:

[0007] S1. Upon receiving the target start address and target arrival address input by the target user, a search task is generated, and the core subtask identifier A and the edge subtask identifier list B = {B1, B2, ..., B} corresponding to the search task are obtained. i , ..., Bm}, B i Let i be the identifier of the i-th edge subtask corresponding to the search task, where i ranges from 1 to m, and m is the number of edge subtask identifiers corresponding to the search task.

[0008] S2. Allocate m+1 threads from the thread pool to concurrently execute the core subtask corresponding to A and B1, B2, ..., B... i , ..., B m The corresponding edge subtasks.

[0009] S3. Obtain the initial return result list C = {C} for the search task. 0 C1, C2, ..., C i , ..., C m}, C 0 For A, the initial return result is C. i For B i The corresponding initial return result, where C 0 and C i Initially, all values ​​are NULL.

[0010] S4. Update C and determine C upon completion of each update. 0 Check if it is NULL and proceed to step S5.

[0011] S5, when C 0 If not NULL, the current time point is taken as the key update time point D corresponding to A, and the current C is immediately copied as the first returned result list E corresponding to the search task. 0 E1, E2, ..., E i , ..., E m}, E 0 E is the first returned result corresponding to A. i For B i The corresponding first returned result.

[0012] S6, based on E i To obtain the final return results for a search task, the following steps are required:

[0013] S61, Iterate through E, when E i When B is NULL, i As an identifier for an incomplete subtask, obtain a list of incomplete subtask identifiers F = {F1, F2, ..., F...} j , ..., F n}, F j Let j be the identifier of the j-th unfinished subtask, where j can be 1 to n and n is the number of unfinished subtask identifiers.

[0014] S62. Obtain F based on the preset importance weight mapping list G corresponding to the search task. j The corresponding waiting time weight H j G = {G1, G2, ..., G} i , ..., G m}, G i = (B i G 0 j ), G j For B j The corresponding preset importance weight mapping combination, G 0 j For G j China B j The corresponding preset importance weights, where, when F j =B i At that time, G 0 j As H j .

[0015] S63. Obtain the candidate waiting time list K = {K1, K2, ..., K} corresponding to F. j , ..., K n} and K1, K2, ..., K j , ..., K n The largest candidate wait time is used as the target wait time MB, K j For F j The corresponding candidate waiting time, where K j =H j ×T, where T is the preset maximum waiting time.

[0016] S64. When the predicted time point YC arrives, for C 0 C1, C2, ..., C i , ..., C m The results are integrated to obtain the final return result corresponding to the search task, where YC = D + MB.

[0017] According to a second aspect of the present invention, a non-transitory computer-readable storage medium is provided, wherein a computer program is stored in the storage medium, and the computer program is loaded and executed by a processor to implement the aforementioned method.

[0018] According to a third aspect of the present invention, an electronic device is provided, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the aforementioned method.

[0019] The present invention has at least the following beneficial effects:

[0020] This invention provides a search task processing method, an electronic device, and a storage medium. The method uses thread pool technology to concurrently execute core subtasks and all peripheral subtasks. When a result from a core subtask is received, the current time is recorded as a critical update time point, and the initial result list at this moment is copied as a first result list. If the first result is NULL, it indicates that the peripheral subtask corresponding to the first result is not yet complete. Based on a preset importance weight mapping list, the waiting time weight corresponding to the incomplete subtask identifier is obtained. The product of the waiting time weight corresponding to the incomplete subtask identifier and the preset maximum waiting time is taken as the result of the incomplete subtask. The subtask identifies the corresponding candidate waiting time, and the largest candidate waiting time is taken as the target waiting time. When the time obtained by adding the key update time and the target waiting time is reached, all the initial return results in the initial return result list at that time are integrated and processed to obtain the final return result corresponding to the search task. It is not necessary to create an additional thread for the search task, nor is it necessary to wait until all subtasks are completed before integrating the return results of all subtasks to obtain the final return result corresponding to the search task. This shortens the overall search time, improves the overall search efficiency, and also helps to improve the accuracy of the final return result corresponding to the search task. Attached Figure Description

[0021] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1 This is a flowchart of a search task processing method provided in an embodiment of the present invention. Detailed Implementation

[0023] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0024] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar tasks and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or server that comprises a series of steps or units is not necessarily limited to those explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.

[0025] Embodiments of the present invention provide a search task processing method, wherein the search task is a task for searching relevant information from a target departure address to a target arrival address, and the method includes the following steps, such as... Figure 1 As shown:

[0026] S1. Upon receiving the target start address and target arrival address input by the target user, a search task is generated, and the core subtask identifier A and the edge subtask identifier list B = {B1, B2, ..., B} corresponding to the search task are obtained. i , ..., B m}, B i Let i be the identifier of the i-th edge subtask corresponding to the search task, where i ranges from 1 to m, and m is the number of edge subtask identifiers corresponding to the search task. The search task consists of several subtasks. The core subtask corresponding to the search task is the subtask that must be completed among the several subtasks that make up the search task. The edge subtasks corresponding to the search task are the other subtasks besides the core subtask among the several subtasks that make up the search task.

[0027] Specifically, the number of core subtasks corresponding to the search task is 1.

[0028] Specifically, the core subtask identifier is the unique identifier of the core subtask; the core subtask can be understood as the subtask whose result directly affects the success or failure of the entire search task. If the core subtask is not completed, the entire search task will fail.

[0029] Specifically, the edge subtask identifier is a unique identifier for the edge subtask; an edge subtask can be understood as a subtask whose result does not directly affect the success or failure of the entire search task, but only plays an auxiliary role in the search task. Even if the edge subtask is not completed, it will not cause the entire search task to fail.

[0030] Specifically, there is no dependency between the core subtask and any of the peripheral subtasks.

[0031] Specifically, there is no dependency between any two edge subtasks.

[0032] Specifically, the relevant information from the target departure address to the target arrival address includes, but is not limited to, flight information, mode of transportation, route planning, weather information, accommodation information, visa information, baggage regulations, and user preferences. Flight information includes, but is not limited to, flight number, airline, aircraft type, flight departure time, flight arrival time, and ticket information.

[0033] S2. Allocate m+1 threads from the thread pool to concurrently execute the core subtask corresponding to A and B1, B2, ..., B... i , ..., B m The corresponding edge subtasks can be understood as follows: The thread pool allocates m+1 threads to simultaneously execute the core subtask corresponding to A and B1, B2, ..., B1. i , ..., B m The corresponding edge subtasks.

[0034] Specifically, m+1 threads are connected to A, B1, B2, ..., B i , ..., B m Each corresponds to the other one-to-one.

[0035] Specifically, a thread pool is a technique for managing and reusing threads. It pre-creates a certain number of threads and keeps all threads in an "idle" state, waiting to be assigned tasks. When a task needs to be executed, the thread pool selects an idle thread from the pool to execute the task. After the task is completed, the thread returns to the thread pool, ready to execute the next task.

[0036] Specifically, there is no dependency between the core subtask and any edge subtask, and no dependency between any two edge subtasks. To enable the thread pool to allocate m+1 threads to concurrently execute the core subtask corresponding to A and B1, B2, ..., B... i , ..., B m The corresponding edge subtasks provide the implementation conditions, allowing each thread to run independently of other threads. This helps improve search efficiency, while using a thread pool to manage thread resources reduces the overhead of thread creation and destruction, thereby improving performance.

[0037] S3. Obtain the initial return result list C = {C} for the search task. 0 C1, C2, ..., C i , ..., C m}, C 0 For A, the initial return result is C. i For Bi The corresponding initial return result, where C 0 and C i Initially, all values ​​are NULL.

[0038] S4. Update C and determine C upon completion of each update. 0 If the value is NULL, proceed to step S5, where when the thread corresponding to A finishes execution, set C... 0 =A 0 So that C can be updated, A 0 This refers to the output or return value generated after the thread corresponding to A completes the execution of the core subtask corresponding to A, when B... i When the corresponding thread finishes execution, let C... i =B 0 i So that C can be updated, B 0 i For B i After the corresponding thread finishes executing B i The output or return value generated after the corresponding edge subtask.

[0039] In one specific embodiment, the method further includes the following after step S4:

[0040] S5, when C 0 When not NULL, for C 0 C1, C2, ..., C i , ..., C m Perform integration processing to obtain the final return results corresponding to the search task.

[0041] Through the above steps, core subtasks and all edge subtasks are executed concurrently using thread pool technology. This eliminates the need to create an additional thread for the search task to execute all subtasks sequentially, thus shortening the overall search time. When the return result of the core subtask is received, it is integrated with the currently received return results of the edge subtasks to obtain the final return result corresponding to the search task. Simultaneously, execution of unfinished edge subtasks is stopped, eliminating the need to wait until all subtasks are completed before integrating their return results to obtain the final return result for the search task. This further shortens the overall search time, improves overall search efficiency, and also helps improve the accuracy of the final return result for the search task.

[0042] In one specific embodiment, the method further includes the following after step S4:

[0043] S5, when C 0If not NULL, the current time point is taken as the key update time point D corresponding to A, and the current C is immediately copied as the first returned result list E corresponding to the search task. 0 E1, E2, ..., E i , ..., E m}, E 0 E is the first returned result corresponding to A. i For B i The corresponding first returned result.

[0044] S6, based on E i Retrieve the final return result corresponding to the search task.

[0045] Specifically, step S6 includes the following steps S61-S64:

[0046] S61, Iterate through E, when E i When B is NULL, i As an identifier for an incomplete subtask, obtain a list of incomplete subtask identifiers F = {F1, F2, ..., F...} j , ..., F n}, F j Let j be the identifier of the j-th unfinished subtask, where j can be 1 to n and n is the number of unfinished subtask identifiers.

[0047] S62. Obtain F based on the preset importance weight mapping list G corresponding to the search task. j The corresponding waiting time weight H j G = {G1, G2, ..., G} i , ..., G m}, G i = (B i G 0 j ), G j For B j The corresponding preset importance weight mapping combination, G 0 j For G j China B j The corresponding preset importance weights, where, when F j =B i At that time, G 0 j As H j .

[0048] Specifically, G 0 j The value range is [0, 1].

[0049] Specifically, the preset importance weight is a preset weight representing the importance of the edge subtask. The larger the preset importance weight, the higher the importance of the edge subtask corresponding to the edge subtask identifier, and the more important the edge subtask. In a specific application scenario, the preset importance weight mapping list corresponding to the search task can be set by those skilled in the art according to actual needs, which will not be elaborated here.

[0050] S63. Obtain the candidate waiting time list K = {K1, K2, ..., K} corresponding to F. j , ..., K n} and K1, K2, ..., K j , ..., K n The largest candidate wait time is used as the target wait time MB, K j For F j The corresponding candidate waiting time, where K j =H j ×T, where T is the preset maximum waiting time. In specific practical applications, the preset maximum waiting time can be set by those skilled in the art according to actual needs, for example, 10s or 20s, which will not be elaborated here.

[0051] S64. When the predicted time point YC arrives, for C 0 C1, C2, ..., C i , ..., C m The results are integrated to obtain the final return result corresponding to the search task, where YC = D + MB.

[0052] Specifically, the integration process can be understood as combining C 0 C1, C2, ..., C i , ..., C m The process of summarizing, filtering, sorting, and optimizing to generate a unified and complete final result.

[0053] Specifically, regarding C 0 C1, C2, ..., C i , ..., C m While performing integration processing to obtain the final return result corresponding to the search task, stop executing any unfinished edge subtasks.

[0054] Specifically, when C 0 When C is NULL, continue waiting for an update from C; this can be understood as: when C... 0 No action is taken when the value is NULL.

[0055] Through the above steps, when the return result of the core subtask is received, the current time is recorded as the critical update time point, and the initial return result list at this moment is copied as the first return result list. When the first return result is NULL, it means that the edge subtask corresponding to the first return result has not yet been completed. Since the result of the edge subtask does not directly affect the success or failure of the entire search task, but only plays an auxiliary role in the search task, even if the edge subtask is not completed, it will not cause the entire search task to fail. Therefore, at this time, according to the preset importance weight mapping list, the waiting time weight corresponding to the incomplete subtask identifier is obtained. The larger the waiting time weight, the higher the importance of the incomplete subtask. The product of the waiting time weight corresponding to the incomplete subtask identifier and the preset maximum waiting time is used as the incomplete subtask identifier. The corresponding candidate waiting time is used, and the largest candidate waiting time is taken as the target waiting time. When the time obtained by adding the key update time and the target waiting time is reached, all the initial return results in the initial return result list at this time are integrated and processed to obtain the final return result corresponding to the search task. The overall search time can be determined according to the importance of the unfinished tasks, and the search task will not fail. There is no need to create an additional thread for the search task to execute all subtasks in sequence. After all subtasks are completed, the return results of all subtasks are integrated and processed to obtain the final return result corresponding to the search task. This shortens the overall search time, improves the overall search efficiency, and helps to improve the accuracy of the final return result corresponding to the search task, and also can obtain a more comprehensive final return result.

[0056] In one specific embodiment, step S63 is replaced by the following steps S100-S200:

[0057] S100. Based on the starting address pair Q corresponding to the search task and the preset address pair weight mapping list U, obtain the target address pair weight W corresponding to Q, where Q includes the target starting address and the target arrival address, and U = {U1, U2, ..., U...} g , ..., U h}, U g =(U g1 U g2 ), U g For the g-th preset address pair weight combination, g takes values ​​from 1 to h, where h is the number of preset address pair weight combinations, U g1 For U g The default address pair in U g2 For U g1 The corresponding preset address pairs weights, U g1 This includes a preset departure address and a preset arrival address. When the target departure address in Q is different from the target departure address in U... g1The preset departure address in Q is the same as that in U, and the target arrival address in Q is the same as that in U. g1 If the preset arrival address is the same as that in U, then U will be... g2 As W.

[0058] Specifically, U g2 The value range is [0, 1].

[0059] Specifically, the preset address pair weight is used to represent the importance of the search task corresponding to the preset address pair. The larger the preset address pair weight, the higher the importance of the search task corresponding to the preset address pair, and the more important the search task. In a specific application scenario, the preset address pair weight is set by those skilled in the art according to actual needs. For example: the higher the click-through rate of the search task corresponding to the preset address pair, the larger the preset address pair weight; the higher the ratio of the click-through rate of the search task corresponding to the preset address pair to the click-through rate of all search tasks, the larger the preset address pair weight; the higher the popularity of the preset origin address and preset destination address in the preset address pair, the larger the preset address pair weight, which will not be elaborated further here.

[0060] S200. Obtain the list of candidate waiting times corresponding to F, P = {P1, P2, ..., P...} j ..., P n} and P1, P2, ..., P j ..., P n The longest possible waiting time among the candidates is used as MB, P j For F j The corresponding candidate waiting time, P j The following conditions must be met:

[0061] P j =W×H j ×T.

[0062] Through the above steps, based on the starting address pair and the preset address pair weight mapping list corresponding to the search task, the target address pair weight corresponding to the starting address pair of the search task is obtained. The larger the target address pair weight, the higher the importance of the search task. The product of the target address pair weight, the waiting time weight corresponding to the incomplete subtask identifier, and the preset maximum waiting time is used as the candidate waiting time for the incomplete subtask, and the maximum candidate waiting time is used as the target waiting time. When the time point obtained by adding the key update time point and the target waiting time point is reached, all the initial return results in the initial return result list at this time are integrated and processed to obtain the final return result corresponding to the search task. This can determine the overall search time based on the importance of the search task and the importance of the incomplete tasks, while not causing the search task to fail. There is no need to create an additional thread for the search task to execute all subtasks sequentially. After all subtasks are executed, the return results of all subtasks are integrated and processed to obtain the final return result corresponding to the search task. This shortens the overall search time, improves the overall search efficiency, and helps to improve the accuracy of the final return result corresponding to the search task, and also obtains a more comprehensive final return result.

[0063] In one specific embodiment, step S2 further includes:

[0064] At the same time, the thread pool allocates another thread to execute the target user type tag acquisition task. The target user type tag acquisition task is to obtain user type tags based on the target user's historical search data, including: efficiency type and comprehensive type.

[0065] Specifically, target user type labels can be obtained by inputting the target user's historical search data into the classification model.

[0066] Specifically, when the target user type tag is efficiency-oriented, it means that the target user expects to get search results faster.

[0067] Specifically, when the target user type tag is "comprehensive," it means that the target user expects to get more comprehensive search results.

[0068] Following step S4, the following steps S5-S8 are also included:

[0069] S5, when C 0 If the value is not NULL and no return result corresponding to the target user type label retrieval task has been received yet, then for C... 0 C1, C2, ..., C i , ..., C m Perform integration processing to obtain the final return results corresponding to the search task.

[0070] Specifically, the return result of the target user type label retrieval task can be understood as: the output or return value generated after the thread completes the target user type label retrieval task.

[0071] S6, when C 0 When the value is not NULL and the return result corresponding to the target user type label retrieval task is efficiency-oriented, for C... 0 C1, C2, ..., C i , ..., C m Perform integration processing to obtain the final return results corresponding to the search task.

[0072] S7, when C 0 When the value is not NULL and the returned result of the target user type tag retrieval task is comprehensive, the current time point is taken as the key update time point D corresponding to A, and the current C is immediately copied as the first returned result list E corresponding to the search task. 0 E1, E2, ..., E i , ..., E m}, E 0 E is the first returned result corresponding to A. i For B i The corresponding first returned result.

[0073] S8, based on E i Retrieve the final return result corresponding to the search task.

[0074] Through the above steps, the target user type tag is obtained to determine whether the target user expects faster search results or more comprehensive search results. When the initial return result corresponding to the core subtask identifier in the initial return result list is not NULL, it means that the core subtask has been completed. All initial return results in the initial return result list can be integrated to obtain the final return result corresponding to the search task. If the target user type tag is efficiency-oriented, it means the target user expects faster search results. Therefore, all initial return results in the initial return result list are directly integrated to obtain the final return result corresponding to the search task, allowing the target user to obtain search results faster. If the target user type tag is comprehensive, it means the target user expects more comprehensive search results. In this case, the current time point is recorded as the critical update time point, and the initial return result list at this moment is copied as the first return result list. The target waiting time is obtained based on the first return result list. When the time point obtained by adding the critical update time point and the target waiting time arrives, all initial return results in the initial return result list at this time are integrated to obtain the final return result corresponding to the search task, allowing the target user to obtain more comprehensive search results, which is beneficial to improving user experience.

[0075] In one specific embodiment, after step S1 and before step S2, the following steps are further included:

[0076] Obtain the data transmission duration SC corresponding to the target user. SC must meet the following conditions:

[0077] SC = SC1 - SC2, where SC1 is the time point at which the target user inputs the target departure address and target arrival address, and SC2 is the time point at which the target user inputs the target departure address and target arrival address.

[0078] Replace step S5 with the following steps S501-S503:

[0079] S501, when C 0 Not NULL and SC > SC 0 At that time, for C 0 C1, C2, ..., C i , ..., C m Perform integration processing to obtain the final return results corresponding to the search task, SC 0 The preset data transmission duration is used. In specific practical applications, the preset data transmission duration can be set by those skilled in the art according to actual needs, such as 30ms or 50ms, which will not be elaborated here.

[0080] S502, when C 0 It is NULL and SC≤SC 0 At that time, the current time point is taken as the key update time point D corresponding to A, and the current C is immediately copied as the first returned result list E corresponding to the search task = {E}. 0 E1, E2, ..., E i , ..., E m}, E 0 E is the first returned result corresponding to A. i For B i The corresponding first returned result.

[0081] S503, based on E i Retrieve the final return result corresponding to the search task.

[0082] Through the above steps, based on the time points when the target user inputs the target departure address and target arrival address, the data transmission duration corresponding to the target user is obtained. When the data transmission duration exceeds the preset data transmission duration, it indicates that the target user's network speed is slow. In this case, after receiving the return result of the core subtask, all initial return results in the initial return result list are immediately integrated to obtain the final return result corresponding to the search task. This avoids the user receiving the final return result late due to the target user's slow network speed. When the data transmission duration is not greater than the preset data transmission duration, it indicates that the target user's network speed has increased. At this time, the current time point is recorded as the critical update time point, and the initial return result list at this moment is copied as the first return result list. The target waiting time is obtained based on the first return result list. When the time point obtained by adding the critical update time point and the target waiting time arrives, all initial return results in the initial return result list at this time are integrated to obtain the final return result corresponding to the search task. This allows the target user to obtain more comprehensive search results, which is beneficial to improving the user experience.

[0083] In one specific embodiment, step S1 further includes the following steps S01-S03 to obtain A and B:

[0084] S01. Obtain the subtask identifier list V = {V1, V2, ..., V...} corresponding to the search task. e , ..., V f}, V e This is the identifier of the e-th subtask corresponding to the search task, where e ranges from 1 to f, and f is the number of subtask identifiers corresponding to the search task.

[0085] Specifically, the subtask identifier is a unique identifier for the subtask.

[0086] Specifically, there is no dependency between any two subtasks.

[0087] Specifically, f = m + 1.

[0088] S02, Obtain V e Corresponding impact level label X e X e To represent V e The labels for the impact level on the search task when the corresponding subtask is not completed include: level 1 label, level 2 label, level 3 label, and level 4 label. In a specific application scenario, the impact level label corresponding to the subtask identifier can be obtained from a trained neural network model. The neural network model is trained based on historical data, user feedback, and real-time performance indicators, which will not be elaborated here.

[0089] Specifically, the impact of a first-level tag is: the search task cannot be completed and the results are invalid; the impact of a second-level tag is: the search task can be completed, but the results are not comprehensive or some information is missing; the impact of a third-level tag is: the search task can be completed and the results are relatively comprehensive, but some details may be incomplete; the impact of a fourth-level tag is: the search task can be completed and the results are unaffected.

[0090] S03, If X e If it is the first label, then V e As A, V1, V2, ..., V e , ..., V f Except for V e Other subtask identifiers besides the one used as edge subtask identifiers are used to obtain B.

[0091] Through the above steps, each time a search task is generated, the impact level label corresponding to the subtask identifier is dynamically obtained. The core subtask and the peripheral subtask are determined based on the impact level label corresponding to the subtask identifier. Compared with the static automatic determination of core subtask and peripheral subtask based on manual determination or predefined rules, fixed algorithms or pre-set priority lists, it can flexibly respond to different scenarios, avoid human error and bias, and ensure that the impact level label corresponding to the subtask is the most accurate.

[0092] In one specific embodiment, the method further includes the following steps S001-S004 to obtain G before step S22. 0 j :

[0093] S001. Obtain the preset influence weight list Y = {Y1, Y2, Y3, Y4}, where Y1 is the preset influence weight corresponding to the first-level label, Y2 is the preset influence weight corresponding to the second-level label, Y3 is the preset influence weight corresponding to the third-level label, and Y4 is the preset influence weight corresponding to the fourth-level label.

[0094] Specifically, Y1 > Y2 > Y3 > Y4. As those skilled in the art know, the specific values ​​of Y1, Y2, Y3, and Y4 are set by those skilled in the art according to actual needs, for example: Y1 = 10, Y2 = 7, Y3 = 4, Y4 = 1, which will not be elaborated here.

[0095] S002, when X e When it is a first-level label, Y1 is used as V. e The corresponding intermediate influence weight Z e When X e When it is a second-level label, Y2 is used as Z. e When X e When using a level 3 label, treat Y3 as Z.e When X e When using a level 4 label, treat Y4 as Z. e To obtain the list of intermediate influence weights Z = {Z1, Z2, ..., Z...} corresponding to V. e , ..., Z f}

[0096] S003, Based on the softmax function, Z1, Z2, ..., Z e , ..., Z f Process to obtain the normalized weight list Z corresponding to Z. 0 ={Z 0 1, Z 0 2, ..., Z 0 e , ..., Z 0 f}, Z 0 e For Z e The corresponding normalized weights.

[0097] S004, When B j =V e At that time, Z 0 e As G 0 j .

[0098] Through the above steps, an intermediate influence weight list is obtained based on the preset influence weight list. All intermediate influence weights in the intermediate influence weight list are normalized to obtain normalized weights. Based on the normalized weights, the preset importance weights are determined, ensuring that the weight evaluation of all sub-tasks has a consistent standard, which can avoid inconsistencies and subjective biases caused by human judgment.

[0099] This invention provides a search task processing method, an electronic device, and a storage medium. The method uses thread pool technology to concurrently execute core subtasks and all peripheral subtasks. When a result from a core subtask is received, the current time is recorded as a critical update time point, and the initial result list at this moment is copied as a first result list. If the first result is NULL, it indicates that the peripheral subtask corresponding to the first result is not yet complete. Based on a preset importance weight mapping list, the waiting time weight corresponding to the incomplete subtask identifier is obtained. The product of the waiting time weight corresponding to the incomplete subtask identifier and the preset maximum waiting time is taken as the result of the incomplete subtask. The subtask identifies the corresponding candidate waiting time, and the largest candidate waiting time is taken as the target waiting time. When the time obtained by adding the key update time and the target waiting time is reached, all the initial return results in the initial return result list at that time are integrated and processed to obtain the final return result corresponding to the search task. It is not necessary to create an additional thread for the search task, nor is it necessary to wait until all subtasks are completed before integrating the return results of all subtasks to obtain the final return result corresponding to the search task. This shortens the overall search time, improves the overall search efficiency, and also helps to improve the accuracy of the final return result corresponding to the search task.

[0100] In a specific application scenario, the thread pool-based search task processing method can be used to search for flight information from a target departure address to a target arrival address. When applied to searching for flight information from a target departure address to a target arrival address, the search task generated upon receiving the target user's input of the target departure address and target arrival address can be: "Query flight information from the target departure address to the target arrival address"; the subtasks corresponding to the search task can include: "Querying flight identifiers that directly travel from the target departure address to the target arrival address, as well as the corresponding ticket price and number of available tickets," and "Querying flight identifiers that travel from the target departure address through intermediate station addresses to the target arrival address, as well as..." The search task involves three subtasks: "querying flight IDs and their corresponding fares and remaining tickets from the target departure address to the target arrival address," and "querying flight IDs and their corresponding fares and remaining tickets from the target departure address to the target arrival address." The core subtask is "querying flight IDs and their corresponding fares and remaining tickets from the target departure address to the target arrival address," while the other subtasks are peripheral subtasks. A thread pool is used to allocate four threads to concurrently execute the core subtask and each peripheral subtask. Each thread executes the core subtask... When executing core or edge subtasks, the thread can access the airline's database as needed to retrieve the return results of the core and edge subtasks. The return results can be understood as the output or return value generated after the thread completes the core or edge subtask. When a thread completes a core subtask, it replaces the initial return result corresponding to the core subtask identifier in the initial return result list with the core subtask's return result, thus updating the initial return result list. Similarly, when a thread completes each edge subtask, it replaces the initial return result corresponding to the edge subtask ID in the initial return result list with the edge subtask's return result, thus updating the initial return result list. After each update of the initial return result list, it is necessary to determine whether the core subtask is complete. That is, to determine whether the initial return result corresponding to the core subtask identifier in the return result list is NULL. If the return result corresponding to the core subtask identifier in the initial return result list is not NULL, it means that the core subtask has been completed. There is no need to check whether there are any unfinished edge subtasks. Instead, all the initial return results in the current initial return result list are integrated and processed to obtain the final return result corresponding to the search task. If the return result corresponding to the core subtask identifier in the initial return result list is NULL, it means that the core subtask has not yet been completed and we need to continue waiting.

[0101] In a specific application scenario, if the return result corresponding to the core subtask identifier in the initial return result list is not NULL, it indicates that the core subtask has been completed. This point in time is taken as the critical update point, and the initial return result list at this time is immediately copied as the first return result list. If the first return result list contains NULL values, it indicates that some peripheral subtasks have not yet been completed. These incomplete peripheral subtasks are identified as incomplete subtasks. Based on a preset importance weight corresponding to each incomplete subtask identifier (preset according to actual needs), a waiting time weight is obtained for each incomplete subtask identifier. The preset importance weight represents the importance of the peripheral subtask; the larger the preset importance weight, the higher the importance of the peripheral subtask corresponding to the identifier. In other words, the larger the waiting time weight for an incomplete subtask identifier, the higher the importance of the incomplete subtask. For example, if the incomplete subtask "querying flight identifiers from the target departure address through intermediate station addresses to the target arrival address, as well as the corresponding ticket price information and remaining ticket quantity" has a higher importance than "querying intermediate station addresses from the target departure address through intermediate station addresses to the target arrival address," then the incomplete subtask "querying flight identifiers from the target departure address through intermediate station addresses to the target arrival address, as well as the corresponding ticket price information and remaining ticket quantity" has a higher importance than "querying intermediate station addresses through intermediate station addresses to the target arrival address." The importance of the unfinished subtask "Querying flight identifiers from the target departure address through intermediate addresses to the target arrival address, along with the corresponding fare information and remaining ticket quantity" is determined by the order of importance. Therefore, the waiting time weight for the unfinished subtask "Querying flight identifiers from the target departure address through intermediate addresses to the target arrival address, along with the corresponding fare information and remaining ticket quantity" is greater than the waiting time weight for the unfinished subtask "Querying flight identifiers from the target departure address's nearest address to the target arrival address, along with the corresponding fare information and remaining ticket quantity." The product of the waiting time weight and the maximum waiting time is considered the unfinished subtask. The candidate waiting time corresponding to the subtask identifier is used to demonstrate that the greater the weight of the waiting time, the longer the candidate waiting time of the corresponding subtask. However, it cannot exceed the preset maximum waiting time. At this time, the maximum candidate waiting time is set as the target waiting time. The sum of the target waiting time and the key update time point is used as the prediction time point. When the prediction time point is reached, all the initial return results in the initial return result list at this time are integrated and processed to obtain the final return result corresponding to the search task. It is possible to wait until the most important edge subtask is completed before obtaining the final return result corresponding to the search task, so that the obtained final return result is more comprehensive.

[0102] In a specific application scenario, the target address pair weight corresponding to the search task is obtained based on the starting address pair and the preset address pair weight mapping list corresponding to the search task. The preset address pair weight mapping list includes several preset address pair weight combinations, each including a preset address pair and its corresponding weight. Each preset address pair includes a preset departure address and a preset arrival address. The preset address pair weight is used to represent the importance of the search task corresponding to the preset address pair. The larger the preset address pair weight, the higher the importance of the search task corresponding to the preset address pair, and the more important the search task. The preset address pair weight is set by those skilled in the art according to actual needs. For example, if the most users searched for information related to the preset departure and arrival addresses in the first preset address pair within a historical time period, then the preset address pair weight corresponding to the first preset address pair is set to the maximum value, or the weight of the first preset address pair is set to the maximum value. Assuming the geographical regions corresponding to the starting point and the preset destination have the highest popularity, the weight of the preset address pair corresponding to the first preset address pair is set to the maximum value. Based on the weight of the target address pair corresponding to the search task and the waiting time weight corresponding to each incomplete subtask identifier, the candidate waiting time corresponding to each incomplete subtask identifier is obtained. The largest candidate waiting time among all candidate waiting times corresponding to incomplete subtask identifiers is taken as the target waiting time. The sum of the target waiting time and the key update time point is taken as the prediction time point. When the prediction time point is reached, all the initial return results in the initial return result list at this time are integrated and processed to obtain the final return result corresponding to the search task. The waiting time after receiving the return result of the core subtask is determined according to the importance of different search tasks. This allows for flexible adjustment of the time to obtain the final result of the search task, which can improve the efficiency of obtaining the final return result of the search task and avoid resource waste.

[0103] In a specific application scenario, when the return result corresponding to the core subtask identifier in the initial return result list is not NULL and no return result corresponding to the target user type tag acquisition task has been received yet, it indicates that the core subtask has been completed, but the target user's expected result is unknown. In this case, all initial return results in the initial return result list can be directly integrated to obtain the final return result corresponding to the search task. When the return result corresponding to the core subtask identifier in the initial return result list is not NULL and the return result corresponding to the target user type tag acquisition task is efficiency-oriented, it indicates that the core subtask has been completed and the target user expects to obtain search results faster. In this case, all initial return results in the initial return result list can be directly integrated to obtain the final return result corresponding to the search task, which is beneficial to improving user experience. When the return result corresponding to the core subtask identifier is not NULL and the return result corresponding to the target user type tag is comprehensive, it indicates that the core subtask has been completed and the target user expects to obtain more comprehensive search results. This point in time is taken as the key update time point, and the initial return result list at this time is immediately copied as the first return result list. Based on the first return result list, the target waiting time is further obtained, and the largest candidate waiting time is taken as the target waiting time. The sum of the target waiting time and the key update time point is taken as the prediction time point. When the prediction time point is reached, all the initial return results in the initial return result list at this time are integrated and processed to obtain the final return result corresponding to the search task. This allows the final return result corresponding to the search task to be obtained after the most important peripheral subtask is completed, so that the obtained final return result is more comprehensive and also helps to improve the user experience.

[0104] In a specific application scenario, when the return result corresponding to the core subtask identifier in the initial return result list is not NULL and the data transmission duration for the target user is greater than the preset data transmission duration, it indicates that the core subtask has been completed and the user's network speed is relatively slow. In this case, directly integrating all the initial return results in the initial return result list to obtain the final return result corresponding to the search task is beneficial to improving user experience. When the return result corresponding to the core subtask identifier in the initial return result list is not NULL and the data transmission duration for the target user is not greater than the preset data transmission duration, it indicates that the core subtask has been completed and the user's network speed is relatively fast. This time point is taken as the critical update time point, and the initial return result list at this time is immediately copied as the first return result list. Based on the first return result list, the target waiting time is further obtained, and the largest candidate waiting time is taken as the target waiting time. The sum of the target waiting time and the critical update time point is taken as the prediction time point. When the prediction time point is reached, all the initial return results in the initial return result list at this time are integrated to obtain the final return result corresponding to the search task. This allows the final return result corresponding to the search task to be obtained only after the most important peripheral subtasks are completed, making the obtained final return result more comprehensive and also beneficial to improving user experience.

[0105] Embodiments of the present invention also provide a non-transitory computer-readable storage medium that can be disposed in an electronic device to store a computer program related to implementing a method in the method embodiments, the computer program being loaded and executed by the processor to implement the method provided in the above embodiments.

[0106] Embodiments of the present invention also provide an electronic device, including: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method provided in the above embodiments.

[0107] Embodiments of the present invention also provide a computer program product including program code, which, when the program product is run on an electronic device, causes the electronic device to perform the steps of the methods described above in various exemplary embodiments of the present invention.

[0108] While specific embodiments of the invention have been described in detail by way of examples, those skilled in the art should understand that the examples are for illustrative purposes only and are not intended to limit the scope of the invention. Those skilled in the art should also understand that various modifications can be made to the embodiments without departing from the scope and spirit of the invention.

Claims

1. A search task processing method, characterized in that, The search task is a task used to search for relevant information from the target departure address to the target arrival address, and the method includes the following steps: S1. Upon receiving the target start address and target arrival address input by the target user, a search task is generated, and the core subtask identifier A and the edge subtask identifier list B = {B1, B2, ..., B} corresponding to the search task are obtained. i , ..., B m }, B i Let i be the identifier of the i-th edge subtask corresponding to the search task, where i ranges from 1 to m, and m is the number of edge subtask identifiers corresponding to the search task. S2. Allocate m+1 threads from the thread pool to concurrently execute the core subtask corresponding to A and B1, B2, ..., B... i , ..., B m The corresponding edge subtasks; S3. Obtain the initial return result list C = {C} for the search task. 0 C1, C2, ..., C i , ..., C m }, C 0 For A, the initial return result is C. i For B i The corresponding initial return result, where C 0 and C i Initially, all values ​​are NULL; S4. Update C and determine C upon completion of each update. 0 If the value is NULL, proceed to step S5; S5, when C 0 If not NULL, the current time point is taken as the key update time point D corresponding to A, and the current C is immediately copied as the first returned result list E corresponding to the search task. 0 E1, E2, ..., E i , ..., E m }, E 0 E is the first returned result corresponding to A. i For B i The corresponding first returned result; S6, based on E i To obtain the final return results for a search task, the following steps are required: S61, Iterate through E, when E i When B is NULL, i As an identifier for an incomplete subtask, obtain a list of incomplete subtask identifiers F = {F1, F2, ..., F...} j , ..., F n }, F j Let j be the identifier of the j-th unfinished subtask, where j can be 1 to n and n is the number of unfinished subtask identifiers. S62. Obtain F based on the preset importance weight mapping list G corresponding to the search task. j The corresponding waiting time weight H j G = {G1, G2, ..., G} i , ..., G m }, G i = (B i G 0 j ), G j For B j The corresponding preset importance weight mapping combination, G 0 j For G j China B j The corresponding preset importance weights, where, when F j =B i At that time, G 0 j As H j ; S63. Obtain the candidate waiting time list K = {K1, K2, ..., K} corresponding to F. j , ..., K n } and K1, K2, ..., K j , ..., K n The largest candidate wait time is used as the target wait time MB, K j For F j The corresponding candidate waiting time, where K j =H j ×T, where T is the preset maximum waiting time; S64. When the predicted time point YC arrives, for C 0 C1, C2, ..., C i , ..., C m The results are integrated to obtain the final return result corresponding to the search task, where YC = D + MB.

2. The search task processing method according to claim 1, characterized in that, The core subtask identifier is a unique identifier for the core subtask, and the edge subtask identifier is a unique identifier for the edge subtask.

3. The search task processing method according to claim 2, characterized in that, The search task consists of several subtasks. The core subtask of the search task is the subtask that must be completed among the subtasks that make up the search task, while the peripheral subtasks of the search task are the other subtasks besides the core subtask among the subtasks that make up the search task.

4. The search task processing method according to claim 1, characterized in that, In step S4, when the thread corresponding to A finishes execution, C is set to... 0 =A 0 So that C can be updated, A 0 This refers to the output or return value generated after the thread corresponding to A completes the execution of the core subtask corresponding to A, when B... i When the corresponding thread finishes execution, let C... i =B 0 i So that C can be updated, B 0 i For B i After the corresponding thread finishes executing B i The output or return value generated after the corresponding edge subtask.

5. The search task processing method according to claim 3, characterized in that, There is no dependency between the core subtask and any of the peripheral subtasks.

6. The search task processing method according to claim 3, characterized in that, There is no dependency between any two edge subtasks.

7. The search task processing method according to claim 1, characterized in that, G 0 j The value range is [0, 1].

8. The search task processing method according to claim 1, characterized in that, Replace step S63 with the following steps S100-S200: S100. Based on the starting address pair Q corresponding to the search task and the preset address pair weight mapping list U, obtain the target address pair weight W corresponding to Q, where Q includes the target starting address and the target arrival address, and U = {U1, U2, ..., U...} g , ..., U h }, U g =(U g1 U g2 ), U g For the g-th preset address pair weight combination, g takes values ​​from 1 to h, where h is the number of preset address pair weight combinations, U g1 For U g The default address pair in U g2 For U g1 The corresponding preset address pairs weights, U g1 This includes a preset departure address and a preset arrival address. When the target departure address in Q is different from the target departure address in U... g1 The preset departure address in Q is the same as that in U, and the target arrival address in Q is the same as that in U. g1 If the preset arrival address is the same as that in U, then U will be... g2 As W; S200. Obtain the list of candidate waiting times corresponding to F, P = {P1, P2, ..., P...} j ..., P n } and P1, P2, ..., P j ..., P n The longest possible waiting time among the candidates is used as MB, P j For F j The corresponding candidate waiting time, P j The following conditions must be met: P j =W×H j ×T。 9. A non-transitory computer-readable storage medium, characterized in that, The storage medium stores a computer program, which is loaded and executed by a processor to implement the search task processing method as described in any one of claims 1-8.

10. An electronic device, comprising: A processor, a memory, and a computer program stored in the memory and executable on the processor, characterized in that, when the processor executes the computer program, it implements the search task processing method as described in any one of claims 1-8.

Citation Information

Patent Citations

  • Search task processing method and device based on thread pool and medium

    CN120029773A