Search task processing method, electronic equipment and storage medium

The thread pooling technology concurrently executes the core and edge sub-tasks in the route information search task, and performs critical updates and wait time processing after receiving the core sub-task return results, solving the problems of long search time and outdated information in the existing technology, and achieving efficient and accurate search results acquisition.

CN120029772AActive Publication Date: 2025-05-23MOBILE TECH COMPANY CHINA TRAVELSKY HLDG

Patent Information

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

AI Technical Summary

Technical Problem

When searching route information in the prior art, the overall search time is long. Performing subtasks requires allocating the API interface of a third-party service provider. The response time is unstable, resulting in low search efficiency and dynamic changes in route information, which may lead to outdated information and reduce the accuracy of the return results.

Method used

Thread pooling technology is used to perform core subtasks and edge subtasks concurrently. When the return result of the core subtask is received, the time point is recorded as the key update time point, and the initial return result list is copied as the first return result list. When the first return result is NULL, the waiting time weight of the unfinished subtask is obtained according to the preset importance weight mapping list, and the integration process is performed when the key update time point plus the target waiting time arrives to obtain the final return result.

Benefits of technology

It shortens the overall search time, improves the search efficiency, and helps improve the accuracy of the final return results of the search task.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120029772A_ABST
    Figure CN120029772A_ABST
Patent Text Reader

Abstract

The invention provides a search task processing method, electronic equipment and a storage medium, and relates to the technical field of task processing, the method concurrently executes a core sub-task and all edge sub-tasks based on a thread pool technology, when a return result of the core sub-task is received, a time point at the moment is recorded as a key update time point, and the key update time point is updated; and copying the initial return result list at the moment as a first return result list, when the first return result is NULL, indicating that the edge sub-task corresponding to the first return result is not completed, obtaining candidate waiting duration corresponding to the identifier of the uncompleted sub-task, and taking the maximum candidate waiting duration as target waiting duration, and when the time point obtained by adding the key update time point and the target waiting duration arrives, all the initial return results in the initial return result list at the moment are integrated to obtain the final return result corresponding to the search task, so that 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] The present invention relates to the technical field of task processing, and in particular to a search task processing method, electronic equipment and storage medium. Background Art

[0002] The route information includes flight number, airline, aircraft model, flight departure time, flight arrival time, ticket information, etc. When searching for route information, a search task consisting of one or several subtasks is often generated based on the departure address and destination address input by the target user. For example, the search task is "search for ticket information directly from the departure address to the destination address", and the subtasks corresponding to the search task may include but are not limited to "search for flights directly from the departure address to the destination address", "search for flights from the departure address to the destination address via the transit address", "search for ticket prices for 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 will be created to execute each subtask in sequence. When all subtasks are executed, the return results corresponding to all subtasks are integrated to obtain the return results corresponding to the search task.

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

[0004] The above method needs to execute each subtask in sequence. When all subtasks are completed, the return results of all subtasks will be integrated to obtain the return results corresponding to the search task. The overall search time is long and the execution of subtasks requires the allocation of API interfaces of third-party service providers (such as airlines). The response time of third-party API interfaces may be unstable. The execution time of subtasks is too long, which further prolongs the overall search time, resulting in low overall search efficiency. In addition, route information changes dynamically, especially in the event 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 return results of the search task. Summary of the invention

[0005] In view of the above technical problems, the technical solution adopted by the present invention is:

[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 for relevant information from a target departure address to a target arrival address, and the method comprises the following steps:

[0007] S1. When receiving the target departure 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 corresponding to the search task are obtained. 1 , B 2, ……, B i , ……, B m}, B i is the identifier of the i-th edge sub-task corresponding to the search task, where i ranges from 1 to m, and m is the number of edge sub-task identifiers corresponding to the search task.

[0008] S2. Let the thread pool allocate m + 1 threads to concurrently execute the core sub-task corresponding to A and B 1 , B 2 , ……, B i , ……, B m corresponding edge sub-tasks.

[0009] S3. Obtain the initial return result list C = {C 0 , C 1 , C 2 , ……, C i , ……, C m}, C 0 is the initial return result corresponding to A, C i is for B i corresponding initial return result, where C 0 and C i are initially NULL.

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

[0011] S5. When C 0 is not NULL, take the current time point as the key update time point D corresponding to A and immediately copy the current C as the first return result list E = {E 0 , E 1 , E 2 , ……, E i , ……, E m}, E 0 is the first return result corresponding to A, E i is for B i corresponding first return result.

[0012] S6. Obtain the final return result corresponding to the search task based on E i , including the following steps:

[0013] S61. Traverse E. When E i is NULL, take B i as the uncompleted sub-task identifier to obtain the uncompleted sub-task identifier list F = {F 1 , F 2 , ……, F j, ..., F n}, F j is the jth unfinished subtask identifier, the value of j ranges from 1 to n, and n is the number of unfinished subtask identifiers.

[0014] S62, obtaining F according to the preset importance weight mapping list G corresponding to the search task j The corresponding waiting time weight H j , G={G 1 , G 2 , ..., 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 G j Medium B j The corresponding preset importance weights, where F j =B i When G 0 j As H j .

[0015] S63, obtain the candidate waiting time list K corresponding to F = {K 1 , K 2 , ..., K j , ..., K n} and K 1 , K 2 , ..., K j , ..., K n The largest candidate waiting time in K is taken as the target waiting time MB. j F j The corresponding candidate waiting time, where K j =H j ×T, T is the preset maximum waiting time.

[0016] S64. When the predicted time point YC arrives, 0 , C 1 , C 2 , ..., C i , ..., C m An integration process is performed 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, in which a computer program is stored. 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, there is provided an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the aforementioned method when executing the computer program.

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

[0020] The present invention provides a search task processing method, an electronic device and a storage medium. The method concurrently executes a core subtask and all edge subtasks based on a thread pool technology. When a return result of a core subtask is received, the time point at this moment is recorded as a key update time point, and the initial return result list at this moment is copied as a first return result list. When the first return result is NULL, it indicates that the edge subtask corresponding to the first return result has not been completed. According to a preset importance weight mapping list, the waiting time weight corresponding to the unfinished subtask identifier is obtained, and the product of the waiting time weight corresponding to the unfinished subtask identifier and the preset maximum waiting time is used as the unfinished subtask identifier. The candidate waiting time corresponding to the subtask identifier is used, 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 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. There is no need to create an additional thread for the search task, nor is there any need to wait until all subtasks are executed 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 is beneficial to improving the accuracy of the final return result corresponding to the search task. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0022] Figure 1 A flowchart of a search task processing method provided by an embodiment of the present invention. DETAILED DESCRIPTION

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

[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar tasks, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.

[0025] An embodiment of the present invention provides a search task processing method, wherein the search task is a task for searching for relevant information from a target departure address to a target arrival address, and the method comprises the following steps: Figure 1 As shown:

[0026] S1. When receiving the target departure 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 corresponding to the search task are obtained. 1 , B 2 , ..., B i , ..., B m}, B i is the ith edge subtask identifier corresponding to the search task, the value of i ranges from 1 to m, and m is the number of edge subtask identifiers corresponding to the search task, wherein the search task is composed 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, and the edge subtask corresponding to the search task is the subtask other than 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 a unique identifier of the core subtask; the core subtask can be understood as a subtask whose result directly affects the success 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 the unique identity identifier of the edge subtask; the edge subtask can be understood as a subtask whose result does not directly affect the success 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 failure of the entire search task.

[0030] Specifically, there is no dependency relationship between the core subtask and any edge subtask.

[0031] Specifically, there is no dependency relationship 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 the route information, transportation methods, route planning, weather information, accommodation information, visa information, baggage regulations, and user preferences from the target departure address to the target arrival address. The route information includes but is not limited to the flight number, airline, aircraft model, flight departure time, flight arrival time, and air ticket information.

[0033] S2: Let the thread pool allocate m+1 threads to concurrently execute the core subtasks corresponding to A and B 1 , B 2 , ..., B i , ..., B m The corresponding edge subtasks can be understood as: let the thread pool allocate m+1 threads to execute the core subtasks corresponding to A and B at the same time 1 , B 2 , ..., B i , ..., B m The corresponding edge subtask.

[0034] Specifically, m+1 threads and A, B 1 , B 2 , ..., B i , ..., B m They correspond one to one.

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

[0036] Specifically, there is no dependency between the core subtask and any edge subtask, and there is no dependency between any two edge subtasks. In order to allocate m+1 threads to the thread pool to concurrently execute the core subtask corresponding to A and B 1 , B2 , ..., B i , ..., B m The corresponding edge subtasks provide implementation conditions so that each thread can run independently of other threads, which helps to improve search efficiency. At the same time, the thread pool is used to manage thread resources to reduce the overhead of thread creation and destruction, thereby improving performance.

[0037] S3, obtain the initial return result list C corresponding to the search task = {C 0 , C 1 , C 2 , ..., C i , ..., C m}, C 0 is the initial return result corresponding to A, C i For B i The corresponding initial return result, where C 0 and C i Initially both are NULL.

[0038] S4. Update C and determine C each time the update is completed. 0 Is it NULL and go to step S5, where when the thread corresponding to A is executed, let C 0 =A 0 So that C is updated, A 0 The output or return value generated after the thread corresponding to A completes the core subtask corresponding to A. i When the corresponding thread is finished, let C i =B 0 i So that C is updated, B 0 i For B i The corresponding thread completes B i The output or return value generated by the corresponding edge subtask.

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

[0040] S5, when C 0 When not NULL, C 0 , C 1 , C 2 , ..., C i , ..., C m Perform integration processing to obtain the final return result corresponding to the search task.

[0041] Through the above steps, the core subtask and all edge subtasks are executed concurrently based on the thread pool technology. There is no need to create an additional thread for the search task to execute all subtasks in sequence, which can shorten the overall search time. When the return result of the core subtask is received, the return result of the core subtask and the return result of the currently received edge subtask are integrated to obtain the final return result corresponding to the search task. At the same time, the execution of unfinished edge subtasks is stopped. There is no need to wait until all subtasks are executed and then integrate the return results of all subtasks to obtain the final return result corresponding to the search task. This further shortens the overall search time, improves the overall search efficiency, and is beneficial to improving the accuracy of the final return result corresponding to the search task.

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

[0043] S5, when C 0 When it is not NULL, the current time point is used as the key update time point D corresponding to A and the current C is immediately copied as the first return result list E corresponding to the search task = {E 0 , E 1 , E 2 ,……,E i ,……,E m}, E 0 is the first returned result corresponding to A, E i For B i The corresponding first returned result.

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

[0045] Specifically, in step S6, the following steps S61-S64 are included:

[0046] S61. Traverse E, when E i When NULL, B i as the unfinished subtask identifier to obtain the unfinished subtask identifier list F={F 1 , F 2 , ..., F j , ..., F n}, F j is the jth unfinished subtask identifier, the value of j ranges from 1 to n, and n is the number of unfinished subtask identifiers.

[0047] S62, obtaining F according to the preset importance weight mapping list G corresponding to the search task j The corresponding waiting time weight H j , G={G 1 , G 2, ……, G i , ……, G m}, G i = (B i , G 0 j ), G j is the preset importance weight mapping combination corresponding to B j , G 0 j is G j the preset importance weight corresponding to B in G j , where when F j = B i , G 0 j is taken as H j .

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

[0049] Specifically, the preset importance weight is the weight preset to represent the importance degree of the edge subtask. The greater the preset importance weight, the higher the importance degree of the edge subtask corresponding to the edge subtask identifier corresponding to the preset importance weight, and the more important the edge subtask. Among them, 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 duration list K = {K 1 , K 2 , ……, K j , ……, K n} corresponding to F and take the maximum candidate waiting duration in K 1 , K 2 , ……, K j , ……, K n as the target waiting duration MB, and K j is the candidate waiting duration corresponding to F j , where K j = H j × T, and T is the preset maximum waiting duration. Among them, in a specific actual application, the preset maximum waiting duration can be set by those skilled in the art according to actual needs. For example, 10s, 20s, which will not be elaborated here.

[0051] S64. When the prediction time point YC arrives, for C 0 , C 1 , C 2 , ……, C i , ……, C mAn integration process is performed to obtain the final return result corresponding to the search task, where YC=D+MB.

[0052] Specifically, the integration process can be understood as converting C 0 , C 1 , C 2 , ..., C i , ..., C m The process of aggregating, filtering, sorting, and optimizing to produce a unified and complete final result.

[0053] Specifically, in C 0 , C 1 , C 2 , ..., C i , ..., C m While performing integration processing to obtain the final return result corresponding to the search task, the execution of unfinished edge subtasks is stopped.

[0054] Specifically, when C 0 When it is NULL, continue to wait for C to be updated; it can be understood as: when C 0 If it is NULL, no processing is performed.

[0055] Through the above steps, when the return result of the core subtask is received, the current time point is recorded as the key 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 been completed. Since the result of the edge subtask does not directly affect the success of the entire search task, it is only a subtask that plays an auxiliary role in the search task. Even if the edge subtask is not completed, it will not cause the failure of the entire search task. Therefore, at this time, according to the preset importance weight mapping list, the waiting time weight corresponding to the unfinished subtask identifier is obtained. The larger the waiting time weight, the higher the importance of the unfinished subtask. The product of the waiting time weight corresponding to the unfinished subtask identifier and the preset maximum waiting time is used as the unfinished subtask identifier. The corresponding candidate waiting time is used, 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 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. 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 to obtain the final return result corresponding to the search task. This shortens the overall search time, improves the overall search efficiency, is conducive to improving the accuracy of the final return result corresponding to the search task, and can also obtain a more comprehensive final return result.

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

[0057] S100, according to 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, U={U 1 , U 2 , ..., U g , ..., U h},U g =(U g1 , U g2 ), U g is the gth preset address pair weight combination, g ranges from 1 to h, h is the number of preset address pair weight combinations, U g1 For U g The preset address pair in U g2 For U g1 The corresponding preset address pair weight, U g1 The preset departure address and the preset arrival address are included in Q. When the target departure address in Ug1 The preset departure address in Q is the same as that in U and the destination address in Q is the same as that in U g1 If the preset destination address is the same as that in g2 As W.

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

[0059] Specifically, the preset address pair weight is used to indicate 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 technical personnel in this field according to actual needs. For example: the higher the click-through rate of the search task corresponding to the preset address pair, the greater the weight of the preset address pair; 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 greater the weight of the preset address pair; the higher the popularity of the preset departure address and the preset arrival address in the preset address pair, the greater the weight of the preset address pair, which will not be repeated here.

[0060] S200, obtain the waiting time list P corresponding to F = {P 1 , P 2 , ..., P j , ..., P n} and P 1 , P 2 , ..., P j , ..., P n The maximum waiting time in the candidate is taken as MB, P j F j The corresponding waiting time, P j Meet the following conditions:

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

[0062] Through the above steps, according to the starting address pair corresponding to the search task and the preset address pair weight mapping list, the weight of the target address pair corresponding to the starting address pair corresponding to the search task is obtained. The larger the weight of the target address pair, the higher the importance of the search task. The product of the target address pair weight, the waiting time weight corresponding to the unfinished subtask identifier and the preset maximum waiting time is used as the candidate waiting time corresponding to the unfinished 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 to the target waiting time arrives, 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. The overall search time can be determined according to the importance of the search task and the importance of the unfinished task, 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 executed, the return results of all subtasks are integrated to obtain the final return result corresponding to the search task, which shortens the overall search time, improves the overall search efficiency, and is conducive to improving the accuracy of the final return result corresponding to the search task, and can also obtain a more comprehensive final return result.

[0063] In a specific embodiment, step S2 also includes:

[0064] At the same time, the thread pool is instructed to allocate another thread to execute a target user type label acquisition task. The target user type label acquisition task is a user type label acquired based on the historical search data of the target user, including: efficiency type and comprehensive type.

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

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

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

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

[0069] S5, when C 0 If it is not NULL and the corresponding result of the target user type label acquisition task has not been received, 0 , C 1 , C 2 , ..., C i , ..., C m Perform integration processing to obtain the final return result corresponding to the search task.

[0070] Specifically, the return result corresponding to the target user type label acquisition task can be understood as the output or return value generated after the thread executes the target user type label acquisition task.

[0071] S6. When C 0 is not NULL and the return result corresponding to the received target user type label acquisition task is of the efficiency type, perform integration processing on C 0 , C 1 , C 2 , ……, C i , ……, C m to obtain the final return result corresponding to the search task.

[0072] S7. When C 0 is not NULL and the return result corresponding to the received target user type label acquisition task is of the comprehensive type, use the current time point as the key update time point D corresponding to A and immediately copy the current C as the first return result list E = {E 0 , E 1 , E 2 , ……, E i , ……, E m} corresponding to the search task, where E 0 is the first return result corresponding to A, and E i is the first return result corresponding to B i .

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

[0074] Through the above steps, the target user type label is obtained to determine whether the target user expects to obtain search results faster 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 at this moment, and all the 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 label is efficiency, it means that the target user expects to obtain search results faster, then all the initial return results in the initial return result list are directly integrated to obtain the final return result corresponding to the search task, so that the target user can obtain search results faster; if the target user type label is comprehensiveness, it means that the target user expects to obtain more comprehensive search results. At this time, the current time point is recorded as the key update time point, and the initial return result list at this time is copied as the first return result list. The target waiting time is obtained according to the first return result list. When the time point obtained by adding the key update time point and the target waiting time arrives, 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, so that the target user can obtain more comprehensive search results, which is conducive to improving user experience.

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

[0076] Get the data transmission duration SC corresponding to the target user. SC meets the following conditions:

[0077] SC=SC1-SC2, SC1 is the time point when the target departure address and the target arrival address input by the target user are received, and SC2 is the time point when the target departure address and the target arrival address are input by the target user.

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

[0079] S501, when C 0 Not NULL and SC>SC 0 When C 0 , C 1 , C 2 , ..., C i , ..., C m Perform integration processing to obtain the final return result corresponding to the search task, SC 0 It is a preset data transmission time. In a specific practical application, the preset data transmission time can be set by a technician in this field according to actual needs, for example: 30ms, 50ms, which will not be repeated here.

[0080] S502, when C 0is NULL and SC≤SC 0 When the current time point is used as the key update time point D corresponding to A, the current C is immediately copied as the first return result list E corresponding to the search task = {E 0 , E 1 , E 2 ,……,E i ,……,E m}, E 0 is the first returned result corresponding to A, E i For B i The corresponding first returned result.

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

[0082] Through the above steps, according to the time point when the target departure address and the target arrival address input by the target user are received and the time point when the target user inputs the target departure address and the target arrival address, the data transmission duration corresponding to the target user is obtained. When the data transmission duration is greater than the preset data transmission duration, it indicates that the network speed of the target user is slow. At this time, after receiving the return result of the core subtask, all the initial return results in the initial return result list are immediately and directly integrated to obtain the final return result corresponding to the search task, so as to avoid the user receiving the final return result later due to the slow network speed of the target user. When the data transmission duration is not greater than the preset data transmission duration, it indicates that the network speed of the target user is accelerated. At this time, the time point at this moment is recorded as the key 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 according to the first return result list. When the time point obtained by adding the key update time point and the target waiting time arrives, 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, so that the target user can obtain a more comprehensive search result, which is conducive to improving the user experience.

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

[0084] S01, obtain the subtask identifier list V corresponding to the search task = {V 1 , V 2 , ..., V e , ..., V f},V e is the e-th subtask identifier corresponding to the search task, the value of e is 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 of the subtask.

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

[0087] Specifically, f=m+1.

[0088] S02. Get V e Corresponding impact level label X e , X e To represent V e The labels of the levels of impact on the search task when the corresponding subtask is not completed include: first-level labels, second-level labels, third-level labels and fourth-level labels. In a specific application scenario, the impact level label corresponding to the subtask identifier can be obtained according to the trained neural network model. The neural network model is trained based on historical data, user feedback and real-time performance indicators to obtain the trained neural network model, which will not be repeated here.

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

[0090] S03, if X e If V is the first label, e As A, V 1 , V 2 , ..., V e , ..., V f V e The other subtask identifiers except are used as the edge subtask identifiers 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, and the core subtasks and marginal subtasks are determined according to the impact level label corresponding to the subtask identifier. Compared with manually determining or statically automatically determining the core subtasks and marginal subtasks according to predefined rules, fixed algorithms, or pre-set priority lists, this method can flexibly respond to different scenarios, avoid human errors and biases, and ensure that the impact level labels corresponding to the subtasks are the most accurate.

[0092] In a specific embodiment, before step S22, the following steps S001-S004 are also included to obtain G 0 j :

[0093] S001. Obtain a preset influence weight list Y={Y 1 , Y2 , Y 3 , Y 4}, where Y 1 is the preset influence weight corresponding to the first-level label, Y 2 is the preset influence weight corresponding to the secondary influence label, Y 3 is the preset influence weight corresponding to the third-level label, Y 4 The preset influence weights corresponding to the four-level labels.

[0094] Specifically, Y 1 >Y 2 >Y 3 >Y 4 , wherein those skilled in the art know that Y 1 , Y 2 , Y 3 , Y 4 The specific value of is set by those skilled in the art according to actual needs, for example: 1 =10, Y 2 =7,Y 3 =4,Y 4 =1, no further details will be given here.

[0095] S002, when X e When it is a first-level label, Y 1 As V e The corresponding intermediate influence weight Z e , when X e When it is a secondary tag, Y 2 As Z e , when X e When it is a third-level label, Y 3 As Z e , when X e When it is a level 4 label, Y 4 As Z e , to obtain the intermediate influence weight list Z corresponding to V = {Z 1 , Z 2 , ..., Z e , ..., Z f}.

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

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

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

[0099] The present invention provides a search task processing method, an electronic device and a storage medium. The method concurrently executes a core subtask and all edge subtasks based on a thread pool technology. When a return result of a core subtask is received, the time point at this moment is recorded as a key update time point, and the initial return result list at this moment is copied as a first return result list. When the first return result is NULL, it indicates that the edge subtask corresponding to the first return result has not been completed. According to a preset importance weight mapping list, the waiting time weight corresponding to the unfinished subtask identifier is obtained, and the product of the waiting time weight corresponding to the unfinished subtask identifier and the preset maximum waiting time is used as the unfinished subtask identifier. The candidate waiting time corresponding to the subtask identifier is used, 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 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. There is no need to create an additional thread for the search task, nor is there any need to wait until all subtasks are executed 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 is beneficial to improving 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 air ticket information from a target departure address to a target arrival address. When applied to searching for air ticket information from a target departure address to a target arrival address, the search task generated when receiving the target departure address and target arrival address input by the target user can be: "Query the air ticket information from the target departure address to the target arrival address"; the subtasks corresponding to the search task can include: "Query the flight ID that directly reaches the target arrival address from the target departure address and the fare and number of remaining tickets corresponding to the flight ID", "Query the flight ID that reaches the target arrival address from the target departure address via the intermediate station address and The search task is to find the flight ID that directly reaches the target arrival address from the target departure address and the fare information and number of remaining tickets corresponding to the flight ID, query the flight ID that reaches the target arrival address from the neighboring address of the target departure address and the fare information and number of remaining tickets corresponding to the flight ID, and query the flight ID that reaches the neighboring address of the target arrival address from the target departure address and the fare information and number of remaining tickets corresponding to the flight ID. The core subtask of the search task is to query the flight ID that directly reaches the target arrival address from the target departure address and the fare and number of remaining tickets corresponding to the flight ID, and the other subtasks are edge subtasks. The thread pool is allocated 4 threads to concurrently execute the core subtask and each edge subtask, wherein each thread executes the core subtask. When executing the core subtask and the edge subtask, the airline's database can be accessed as needed to obtain the return results of the core subtask and each edge subtask. The return result can be understood as the output or return value generated after the thread completes the core subtask or the edge subtask. When the thread completes the core subtask, the initial return result corresponding to the core subtask identifier in the initial return result list is replaced with the return result of the core subtask, so that the initial return result list is updated. When the thread completes each edge subtask, the initial return result corresponding to the edge subtask ID in the initial return result list is replaced with the return result of the edge subtask, so that the initial return result list is updated. After each update of the initial return result list is completed, it is necessary to determine whether the core subtask is completed, 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 at this time. There is no need to determine whether there are any unfinished edge subtasks. All initial return results in the initial return result list at this time are directly 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 been completed at this time and needs 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 means that the core subtask has been completed at this time, and the time point at this time is used as the key update time point, and the initial return result list at this time is immediately copied as the first return result list. If there is a NULL value in the first return result list, it means that some edge subtasks have not been completed. These unfinished edge subtask identifiers are used as unfinished subtask identifiers, and the waiting time weight corresponding to each unfinished subtask identifier is obtained based on the preset importance weight corresponding to the edge subtask identifier preset according to actual needs. The preset importance weight corresponding to the edge subtask identifier is a preset weight indicating 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 corresponding to the preset importance weight, and the more important the edge subtask is, that is, the larger the waiting time weight corresponding to the unfinished subtask identifier, the higher the importance of the unfinished subtask, and the more important the unfinished subtask is. For example: if the importance of the unfinished subtask corresponding to "querying the flight identifier from the target departure address through the intermediate station address to the target arrival address and the fare information and the number of remaining tickets corresponding to the flight identifier" is higher than that of "querying the temporary flight from the target departure address The importance of the unfinished subtask corresponding to "query the flight ID from the target departure address to the target arrival address through the intermediate station address, and the fare information and the number of remaining tickets corresponding to the flight ID" is greater than the waiting time weight corresponding to the unfinished subtask ID of "query the flight ID from the target departure address to the target arrival address through the intermediate station address, and the fare information and the number of remaining tickets corresponding to the flight ID". The product of the waiting time weight and the maximum waiting time is taken as the unfinished task. The candidate waiting time corresponding to the subtask identifier proves that the greater the waiting time weight, the longer the candidate waiting time of the corresponding subtask, but it cannot exceed the preset maximum waiting time. At this time, the maximum candidate waiting time is taken as the target waiting time, and the sum of the target waiting time and the key update time point is taken as the predicted time point. When the predicted time point arrives, 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 final return result obtained is more comprehensive.

[0102] In a specific application scenario, the weight of the target address pair corresponding to the search task is obtained according to 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. The preset address pair weight combination includes the preset address pair and the weight corresponding to the preset address pair. The preset address pair includes a preset departure address and a preset arrival address. The preset address pair weight is used to indicate 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 corresponding to the preset address pair weight, and the more important the search task. The preset address pair weight is set by technicians in this field according to actual needs. For example: if the number of users searching for information related to the preset departure place and the preset arrival place in the first preset address pair is the largest in the historical time period, then the preset address pair weight corresponding to the first preset address pair is set to the maximum value, or the preset address pair weight in the current first preset address pair is set to the maximum value. Assuming that the geographical areas corresponding to the departure point and the preset destination point are the most popular, then 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 weight of the waiting time corresponding to each unfinished subtask identifier, the waiting time corresponding to each unfinished subtask identifier is obtained, and the maximum waiting time among the waiting times corresponding to all unfinished subtask identifiers is used as the target waiting time, and the sum of the target waiting time and the key update time point is used as the predicted time point. When the predicted time point is arrived, 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, and the waiting time after receiving the return result of the core subtask is determined according to the importance of different search tasks. The time to obtain the final result of the search task can be flexibly adjusted, which can improve the efficiency of obtaining the final return result corresponding to the search task and avoid waste of resources.

[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 the return result corresponding to the target user type label acquisition task has not been received, it means that the core subtask has been completed but it is not known what kind of result the target user expects. At this time, all the 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 received target user type label acquisition task is efficiency-type, it means that the core subtask has been completed and the target user expects to get the search result faster. At this time, all the 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 conducive to improving user experience. When the return result corresponding to the core subtask identifier is not NULL and the return result corresponding to the received target user type label acquisition task is comprehensive, it means that the core subtask has been completed and the target user expects to obtain more comprehensive search results. The time point at this time is used as the key update time point, and the initial return result list at this time is immediately copied as the first return result list. The target waiting time is further obtained according to the first return result list, and the maximum candidate waiting time is taken as the target waiting time. The sum of the target waiting time and the key update time point is used as the predicted time point. When the predicted time point arrives, 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 final return result corresponding to the search task can be obtained after the most important edge subtask is completed, so that the final return result obtained is more comprehensive, which is also conducive to improving 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 time corresponding to the target user is greater than the preset data transmission time, it means that the core subtask has been completed and the user's network speed is relatively slow. At this time, all the initial return results in the initial return result list are directly integrated and processed 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 in the initial return result list is not NULL and the data transmission time corresponding to the target user is not greater than the preset data transmission time, it means that the core subtask has been completed and the user's network speed is relatively fast. The time point at this time is used as the key update time point, and the initial return result list at this time is immediately copied as the first return result list. According to the first return result list, the target waiting time is further obtained, the maximum candidate waiting time is set as the target waiting time, and the sum of the target waiting time and the key update time point is used as the predicted time point. When the predicted time point arrives, 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 final return result corresponding to the search task can be obtained after the most important edge subtask is completed, so that the obtained final return result is more comprehensive, which is also beneficial to improving user experience.

[0105] An embodiment of the present invention also provides a non-transitory computer-readable storage medium, which can be set in an electronic device to store a computer program related to a method in a method embodiment, and the computer program is loaded and executed by the processor to implement the method provided in the above embodiment.

[0106] An embodiment of the present invention further provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method provided in the above embodiment when executing the computer program.

[0107] An embodiment of the present invention further provides a computer program product, which includes program code. When the program product is run on an electronic device, the program code is used to enable the electronic device to execute the steps of the method according to various exemplary embodiments of the present invention described above in this specification.

[0108] Although some specific embodiments of the present invention have been described in detail by way of example, it should be understood by those skilled in the art that the above examples are only for illustration, not for limiting the scope of the present invention. It should also be understood by those skilled in the art that various modifications may be made to the embodiments without departing from the scope and spirit of the present invention.

Claims

1. A search task processing method, characterized in that: The search task is a task for searching for relevant information from a target departure address to a target arrival address, and the method comprises the following steps: S1. When receiving the target departure 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 corresponding to the search task are obtained. i , ..., B m }, B i is the ith edge subtask identifier corresponding to the search task, i ranges from 1 to m, and m is the number of edge subtask identifiers corresponding to the search task; S2, let the thread pool allocate m+1 threads to concurrently execute the core subtasks corresponding to A and B1, B2, ..., B i , ..., B m The corresponding edge subtask; S3, obtain the initial return result list C corresponding to the search task = {C 0 , C1, C2, ..., C i , ..., C m }, C 0 is the initial return result corresponding to A, C i For B i The corresponding initial return result, where C 0 and C i Initially, they are all NULL; S4. Update C and determine C each time the update is completed. 0 Is it NULL and go to step S5; S5, when C 0 When it is not NULL, the current time point is used as the key update time point D corresponding to A and the current C is immediately copied as the first return result list E corresponding to the search task = {E 0 , E1, E2, ..., E i ,……,E m }, E 0 is the first returned result corresponding to A, E i For B i The corresponding first returned result; S6, based on E i Obtaining the final return result corresponding to the search task includes the following steps: S61. Traverse E, when E i When NULL, B i as the unfinished subtask identifier to obtain an unfinished subtask identifier list F={F1, F2, . . . , F j , ..., F n }, F j is the jth unfinished subtask identifier, where j ranges from 1 to n, and n is the number of unfinished subtask identifiers; S62, obtaining F according to 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 G j Medium B j The corresponding preset importance weights, where F j =B i When G 0 j As H j ; S63, obtain the candidate waiting time list K corresponding to F = {K1, K2, ..., K j , ..., K n } and K1, K2, ..., K j , ..., K n The largest candidate waiting time in K is taken as the target waiting time MB. j F j The corresponding candidate waiting time, where K j =H j ×T, T is the preset maximum waiting time; S64. When the predicted time point YC arrives, 0 , C1, C2, ..., C i , ..., C m An integration process is performed 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 the unique identity identifier of the core subtask, and the edge subtask identifier is the unique identity identifier of the edge subtask.

3. The search task processing method according to claim 2, characterized in that: The search task is composed 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 subtask corresponding to the search task is the subtask other than the core subtask among the several 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 is executed, let C 0 =A 0 So that C is updated, A 0 The output or return value generated after the thread corresponding to A completes the core subtask corresponding to A. i When the corresponding thread is finished, let C i =B 0 i So that C is updated, B 0 i For B i The corresponding thread completes B i The output or return value generated by 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 edge subtask.

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: Step S63 is replaced by the following steps S100-S200: S100, according to 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, U = {U1, U2, ..., U g , ..., U h },U g =(U g1 , U g2 ), U g is the gth preset address pair weight combination, g ranges from 1 to h, h is the number of preset address pair weight combinations, U g1 For U g The preset address pair in U g2 For U g1 The corresponding preset address pair weight, U g1 The preset departure address and the preset arrival address are included in Q. When the target departure address in U g1 The preset departure address in Q is the same as that in U and the destination address in Q is the same as that in U g1 If the preset destination address is the same as that in g2 As W; S200, obtain the waiting time list P corresponding to F = {P1, P2, ..., P j , ..., P n } and P1, P2, ..., P j , ..., P n The maximum waiting time in the candidate is taken as MB, P j F j The corresponding waiting time, P j Meet the following conditions: 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 to 8.

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

Citation Information

Patent Citations

  • Method and device for processing tasks

    CN104461710A

  • A thread resource grouping method and device

    CN109710400A

  • Nearest neighbor quick search method and system for ten-million-level point-like elements

    CN111538725A

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

    CN120029773A

  • Spatially dynamic document retrieval

    US20210192002A1

Cited By

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

    CN120029773A

  • A method, device, and medium for processing search tasks based on a thread pool

    CN120029773B