Search engine query processing method and apparatus
By using custom data structures and middleware to convert query code into structured messages, the problem of insufficient flexibility and high coupling in existing search engines under large data volume scenarios is solved, achieving efficient query processing and improved stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING YAKE PAYMENT TECHNOLOGY CO LTD
- Filing Date
- 2026-01-26
- Publication Date
- 2026-06-09
AI Technical Summary
In scenarios with large amounts of data, existing search engines in enterprise application systems suffer from insufficient flexibility, excessive coupling, long requirement delivery cycles, and bloated and repetitive code, which affects system stability and iteration efficiency.
The query code is encoded using a custom data structure. The query code is converted into a structured message through middleware and the search engine front-end application, and then translated into a query language according to the search engine language specification. This enables interaction with the search engine, reduces redundant code development, and lowers coupling.
It improved query processing efficiency, reduced redundant code development, lowered the coupling between the system and the search engine, simplified the impact of changes in business system requirements, and improved development efficiency and system stability.
Smart Images

Figure CN122173522A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a search engine query processing method and apparatus. Background Technology
[0002] In current enterprise application systems, search engines (such as Elasticsearch and Solr) are widely used to achieve efficient and complex full-text search and structured query functions. However, in scenarios with large amounts of data, problems such as insufficient flexibility, high coupling, and long requirement delivery cycles have gradually emerged. Adopting mainstream search engine service platforms also increases the additional learning time cost for technical positions.
[0003] In existing technologies, whenever a business department raises a new search request, the development team needs to develop a new API interface specifically for that scenario. This API interface is used to handle search requests from the business side, complete the interaction adaptation with the search engine service platform, and return structured results that conform to business rules. This "one requirement, one interface" development model leads to a rapid expansion of the number of interfaces in the system, bloated and repetitive code, long testing and deployment cycles, and difficulty in unified management. At the same time, since each change involves code modification, system stability and iteration efficiency are significantly affected. Summary of the Invention
[0004] This invention provides a search engine query processing method to improve query processing efficiency and reduce redundant code development. The method includes: Receive query code; the query code includes a custom data structure composed of multiple predefined functions; the predefined functions include query type functions, aggregate functions, and logical type functions; the custom data structure encodes multiple subqueries in a nested manner; Based on a custom data structure, the query code is converted into a structured message; Translate structured messages into query language according to search engine language specifications; Use a query language to request query results from a search engine and obtain the query results returned by the search engine.
[0005] This invention also provides a search engine query processing device to improve query processing efficiency and reduce redundant code development. The device includes: The middleware receives query codes; the query codes include a custom data structure composed of multiple predefined functions; the predefined functions include query type functions, aggregation functions, and logical type functions; the custom data structure encodes multiple sub-queries in a nested manner; based on the custom data structure, the query codes are converted into structured messages; The search engine front-end application is used to translate structured messages into query language according to the search engine language specification; it then uses the query language to request query results from the search engine and obtains the query results returned by the search engine.
[0006] This invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the above-described search engine query processing method.
[0007] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described search engine query processing method.
[0008] This invention also provides a computer program product, which includes a computer program that, when executed by a processor, implements the above-described search engine query processing method.
[0009] In this embodiment of the invention, the query code includes a custom data structure composed of multiple predefined functions. These predefined functions include query type functions, aggregation functions, and logical type functions. The custom data structure encodes multiple subqueries in a nested manner. Based on the custom data structure, the query code is converted into a structured message. The structured message is then translated into a query language according to search engine language specifications. The query language is used to request query results from the search engine, and the results returned by the search engine are obtained. In this embodiment, queries, subqueries, aggregations, and other constraints can be customized, facilitating flexible user use. It standardizes request and response content, defines common methods, reduces redundant code development and bug rates, lowers the coupling between the business system and the search engine server, and ensures that search engine server version upgrades and changes do not affect the business system. The impact of changes in business system requirements is minimized, query processing efficiency is improved, and development is out-of-the-box, requiring no learning of the official language. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the 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. In the drawings: Figure 1 This is a flowchart illustrating the search engine query processing method in an embodiment of the present invention; Figure 2This is a flowchart illustrating the construction of query conditions in an embodiment of the present invention; Figure 3 This is a flowchart illustrating the construction of the aggregation function in an embodiment of the present invention; Figure 4 This is a specific example diagram of the search engine query processing method in an embodiment of the present invention; Figure 5 This is a flowchart illustrating the middleware processing in an embodiment of the present invention. Figure 6 This is a flowchart illustrating the processing of the search engine pre-application in an embodiment of the present invention. Figure 7 This is a schematic diagram of the search engine query processing device in an embodiment of the present invention. Detailed Implementation
[0011] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings. Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.
[0012] Figure 1 This is a flowchart illustrating the search engine query processing method in an embodiment of the present invention, such as... Figure 1 As shown, the method includes: Step 101: Receive query code; the query code includes a custom data structure composed of multiple predefined functions; the predefined functions include query type functions, aggregation functions, and logical type functions; the custom data structure encodes multiple subqueries in a nested manner; Step 102: Based on the custom data structure, convert the query code into a structured message; Step 103: Translate the structured message into a query language according to the search engine language specification; Step 104: Use the query language to request query results from the search engine and obtain the query results returned by the search engine.
[0013] The following describes in detail the search engine query processing method in the embodiments of the present invention.
[0014] In this embodiment, query code from a developer is received. This query code supports implementation in multiple programming languages, including but not limited to Python, Java, and Go. The query code includes a custom data structure composed of multiple predefined functions. This custom data structure encodes multiple subqueries in a nested manner. Each subquery has a sub-clustering function and a logical type with other subqueries.
[0015] The query type function includes one or any combination of the following: Precise search, word segmentation search, phrase matching, range search, geographic location search, relative location search, related search, fuzzy search; The logical type functions include AND, OR, and NOT; The aggregation function includes one or any combination of the following: Average function, maximum value function, minimum value function, summation function, metadata calculation, median calculation, percentile calculation, weighted average calculation, data snapshot, filter, histogram aggregation function, range aggregation function, TopN aggregation, precise pagination, filter; where N is a set positive integer, and TopN aggregation represents the first N options after aggregation and sorting.
[0016] The predefined functions also include sorting functions; sorting includes ascending and descending order.
[0017] The query type function refers to the data in the query conditions. Referring to Table 1, some predefined functions are shown. In actual use, users can use these data structures according to their needs. For example, the summation function is "sum," which allows customization of the summation field (e.g., the field for storing monetary amounts, "amount"), the return name (e.g., "SumAmount"), filtering query conditions, and whether to use year-on-year aggregation conditions. Each "field name" below has different attribute values, which users need to use according to their requirements. Finally, all input parameters are converted into a "parent-child layer" format.
[0018] Table 1
[0019] For example, in Table 1, cell represents a predefined field name, missing represents the default value when there is no value, aggsFilters represents aggregation filters, which filter specific subsets of data in aggregation queries, aggsDerivative represents the aggregation month-on-month function calculation, which is used to calculate the month-on-month data of the summed numeric field in the aggregation result, Max5NumericText represents numeric text of up to 5 characters, which only allows numeric characters, and Max16Text represents arbitrary character text of up to 16 characters, which supports numbers, letters, Chinese characters, etc.
[0020] Refer to Table 2, which shows the essential structure required for query codes.
[0021] Table 2
[0022] Table 3 shows the query conditions, query type functions, and other related information.
[0023] Table 3
[0024] For example, in Table 3, Must: Documents must meet this condition (equivalent to logical AND). Must_not: Documents must not meet this condition (equivalent to logical NOT). Should: Documents should preferably meet this condition (equivalent to logical OR). Filter: Documents must meet this condition (filtering only, higher performance). A and 'a' are examples; for instance, the actual field value is 'cell'.
[0025] Tables 4-1 and 4-2 show the aggregate functions.
[0026] Table 4-1
[0027] Table 4-2
[0028] In one embodiment, the custom data structure is a tree structure, including multiple nodes; each node includes one or any combination of query type function fields, logical type function fields, aggregate function fields, and child node list fields; the child node list field includes zero or more other nodes.
[0029] During implementation, based on a custom data structure, the query code is converted into a structured message. This may include: determining the fields of query type functions, logical type functions, and aggregate functions in the query code through recursion and loops, converting the fields into key-value pairs, and serializing all key-value pairs into a structured message.
[0030] The structured message is, for example, a message in JSON or XML format.
[0031] Figure 2 This is a flowchart of constructing query conditions in an embodiment of the present invention, refer to... Figure 2 When constructing a query statement, the system finds the relation type and query conditions, and queries subqueries, constructs subqueries, queries sibling queries, and constructs query conditions to obtain a structured message of query conditions adapted to the search engine.
[0032] Figure 3 This is a flowchart of constructing the aggregation function in an embodiment of the present invention, referencing... Figure 3 When constructing aggregate functions, it determines whether there are filters and sub-aggregates, and constructs filters, sub-aggregates, sibling aggregates, etc., to realize the construction of aggregate functions and obtain structured messages of aggregate functions adapted to search engines.
[0033] Combination Figure 2 , Figure 3First, the query condition structure is constructed: based on the relationship types and basic query conditions in the business requirements, it is determined whether subqueries and sibling queries are included; then, according to the search engine syntax specifications, these elements are integrated and transformed, and the logical relationships of basic conditions, subqueries, and sibling queries are nested or arranged in parallel to complete the custom-structured query condition structure message (e.g., Figure 2 ).
[0034] Next, the aggregate function structure is constructed: based on the generated query condition message, it first determines whether the aggregation requirement needs to include a filter, and then, according to the determination result, constructs the filter rules, sub-aggregate hierarchy, and sibling aggregation relationships in sequence, binding the aggregation dimension, indicators (such as summation, average, group statistics) with the filter conditions to complete the custom-structured aggregate function structure message (e.g., ... Figure 3 ).
[0035] By organizing the structured messages of query conditions, aggregate functions, and basic parameters (starting page, number of data rows, etc.), a complete custom structure is generated to obtain a structured message adapted to the search engine.
[0036] Then, the structured message is translated into query language according to the search engine language specification.
[0037] The search engines include distributed full-text search engines, inverted index search engines, etc.
[0038] In one embodiment, translating structured messages into query language according to search engine language specifications may include: The structured message is cleaned and then converted into a JSON message. Using a pre-established mapping file, JSON messages are translated into a query language; the mapping file includes the mapping relationship between predefined data types in the search engine and key-value pairs in the JSON message.
[0039] Finally, the query language is used to request query results from the search engine, and the search engine returns the query results.
[0040] In one embodiment, after obtaining the query results returned by the search engine, the method may further include: using a pre-established mapping file to translate the query results into a JSON message; and then outputting the JSON message to the user terminal in a format for display on the user terminal.
[0041] In this example, the returned query results are also a custom structure, processed according to the reverse logic transmitted from the query code, and finally returned as a key-value JSON message.
[0042] Figure 4This is a specific example diagram of the search engine query processing method in an embodiment of the present invention, with reference to... Figure 4 When each system raises new business requirements, there is no need to develop each new requirement separately. Instead, it can achieve fast query processing by utilizing middleware and a search engine front-end application.
[0043] In this embodiment, the middleware steps include building, calling, and parsing.
[0044] Among them, the core of this invention is to construct query code to receive and process input, providing basic data support for subsequent processes. This step is based on the development logic of traditional programming languages, and then the hierarchical structure of query requests is summarized and extracted.
[0045] The call involves sending the JSON or XML formatted message obtained from the build steps to the search engine's front-end application via a network communication mechanism.
[0046] The parsing process involves processing the received query results and generating standardized output parameters for use by the client.
[0047] The steps involved in a search engine's pre-application process include translation, querying, and transcribing.
[0048] The translation is: Translate the received messages into the query language according to the official language specifications of the search engine; Another core component of this translation method is to convert the grammatical structure generated in the build steps into the official grammatical structure of the search engine.
[0049] A query is used to request search engine server results. Translate the query results into a message and return it to the middleware.
[0050] Figure 5 This is a flowchart of the middleware processing in an embodiment of the present invention, such as... Figure 5 The diagram illustrates the steps involved in building, calling, and parsing middleware.
[0051] Construction steps: 1. "Query Parameters". Determine if a query structure exists.
[0052] 2. "Relation Types". Construct logical operation relations, including "AND", "OR", "NOT", etc.
[0053] 3. "Loop-based function construction". This method uses a loop to construct an independent query function for each query condition based on the key-value pair content.
[0054] 4. Subquery. Determine if a subquery is included. If yes, proceed to steps 2 and 3.
[0055] 5. "Summary Function". Determine if a summary structure exists.
[0056] 6. “Constructing functions”. Construct summary functions based on the summary content.
[0057] 7. Sub-summaries. Determine if sub-summaries are included. If yes, proceed to step 6.
[0058] 8. "Format Middleware Parameters". Formats the constructed query content into a JSON or XML string message.
[0059] Instructions for calling: Request results from the search engine front-end application. Send the message assembled in the build steps to the search engine front-end application, then retrieve the string-formatted message content and parse it into JSON or XML format.
[0060] Instructions for the analysis steps: 1. "Function". Determine if a function structure exists.
[0061] 2. "Function parsing". Parses the content into a key-value pair data structure.
[0062] 3. "Sub-function". Determine if there is a sub-function. If "yes", proceed to step 2.
[0063] Figure 6 This is a flowchart of the processing of the search engine pre-application in an embodiment of the present invention, such as... Figure 6 As shown, the steps for translation, querying, and transcribing are illustrated.
[0064] Translation steps instructions: 1. "Query Parameters". Determine if a query structure exists.
[0065] 2. "Relation Types". Construct logical operation relations, including "AND", "OR", "NOT", etc.
[0066] 3. "Building the Official Language Through Looping". A loop is used to build the official query language for each query condition based on the key-value pair content.
[0067] 4. Subquery. Determine if a subquery is included. If yes, proceed to steps 2 and 3.
[0068] 5. "Summary Parameters". Determine if a summary structure exists.
[0069] 6. "Build the official language". Build the summary function for the official language based on the summary content.
[0070] 7. Sub-summaries. Determine if sub-summaries are included. If yes, proceed to step 6.
[0071] 8. “Construct Official Language Message”. Build the content into a string message according to the official rules.
[0072] Instructions for the query steps: Request results from the search engine. Send the message assembled in the translation steps to the search engine, and then retrieve the message content in string format.
[0073] Translation steps: 1. "Function". Determine if a function structure exists.
[0074] 2. "Function parsing". Parses the content into a key-value pair data structure.
[0075] 3. "Sub-function". Determine if there is a sub-function. If "yes", proceed to step 2.
[0076] 4. "Construct middleware parameters". Assemble the middleware parameters into a string content in JSON or XML format.
[0077] This invention proposes a technical framework for calling search engine APIs. The goal of this framework is to reduce the barrier to entry and learning curve, and improve delivery efficiency. During the call process, the client only needs to focus on business logic and configure parameters for query and aggregation requirements according to a unified input standard. After receiving the parameters, the framework sequentially executes key processes such as building, calling, translating, querying, transcribing, and parsing, ultimately providing standardized output results to the client.
[0078] This solution effectively addresses the pain points of existing systems while improving development efficiency and reducing learning costs.
[0079] Scenario Example 1: Each page contains 15 data entries; the query returns data for those older than 35, showing the second page. Based on this embodiment of the invention, implementing a custom data structure is relatively easy, and converting to DSL syntax is also quite simple.
[0080] Scenario Example 2: Each page contains 15 data entries. The query retrieves data from the second page for individuals aged 35 and older. This data is then aggregated over time, with each five-day period forming a group. The goal is to calculate the sum of the amounts and the year-over-year comparison of these sums. Traditional SQL syntax cannot handle such complex data. This embodiment of the invention utilizes a custom data structure designed recursively and iteratively to easily achieve this. In practice, the custom data structure can map each node of the AST to the corresponding search engine query syntax nodes, generating a DSL syntax that is more flexible and powerful.
[0081] In summary, this invention, based on the hierarchical structure technology of search engines, proposes a hierarchical structure for input and output parameters that is more in line with the development logic of traditional SQL and easier to understand. Furthermore, by employing recursion and loop techniques, it standardizes the technical specifications for the two key aspects of "input" and "output."
[0082] This optimization enables the system to be more flexible during the invocation process, while significantly improving the readability and maintainability of the code.
[0083] This invention also provides a search engine query processing device, as described in the following embodiments. Since the principle by which this device solves the problem is similar to that of the search engine query processing method, the implementation of this device can refer to the implementation of the search engine query processing method; repeated details will not be elaborated further.
[0084] Figure 7 This is a schematic diagram of a search engine query processing device in an embodiment of the present invention, such as... Figure 7 As shown, the device 700 includes: Middleware 701 is used to receive query codes; the query codes include a custom data structure composed of multiple predefined functions; the predefined functions include query type functions, aggregation functions, and logical type functions; the custom data structure encodes multiple sub-queries in a nested manner; based on the custom data structure, the query codes are converted into structured messages; The search engine front-end application 702 is used to translate structured messages into query language according to the search engine language specification; it then uses the query language to request query results from the search engine and obtains the query results returned by the search engine.
[0085] In one embodiment, the query type function includes one or any combination of the following: Precise search, word segmentation search, phrase matching, range search, geographic location search, relative location search, related search, fuzzy search; The logical type functions include AND, OR, and NOT; The aggregation function includes one or any combination of the following: Average function, maximum value function, minimum value function, summation function, metadata calculation, median calculation, percentile calculation, weighted average calculation, data snapshot, filter, histogram aggregation function, range aggregation function, TopN aggregation, precise pagination, filter; where N is a set positive integer, and TopN aggregation represents the first N options after aggregation and sorting.
[0086] In one embodiment, the custom data structure is a tree structure, including multiple nodes; each node includes one or any combination of query type function fields, logical type function fields, aggregate function fields, and child node list fields; the child node list field includes zero or more other nodes.
[0087] In one embodiment, the middleware 701 is specifically used for: By using recursion and loops, the fields of query type functions, logical type functions, and aggregate functions in the query code are determined, the fields are converted into key-value pairs, and all key-value pairs are serialized into a structured message.
[0088] In one embodiment, the search engine front-end application 702 is specifically used for: The structured message is cleaned and then converted into a JSON message. Using a pre-established mapping file, JSON messages are translated into a query language; the mapping file includes the mapping relationship between predefined data types in the search engine and key-value pairs in the JSON message.
[0089] In one embodiment, the search engine front-end application 702 is further used for: After obtaining the query results returned by the search engine, the query results are translated into JSON messages using a pre-established mapping file.
[0090] In one embodiment, the predefined function further includes a sorting function; the sorting includes ascending order and descending order.
[0091] This invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the above-described search engine query processing method.
[0092] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described search engine query processing method.
[0093] This invention also provides a computer program product, which includes a computer program that, when executed by a processor, implements the above-described search engine query processing method.
[0094] The embodiments of the present invention have the following technical advantages: 1. Query and summarize the key values, contents, and constraints of parameters. The key-value pair data structure allows for customization and flexible use.
[0095] 2. It standardized request and response content, defined common methods, reduced redundant code development, and lowered the bug rate.
[0096] 3. It reduces the coupling between the system and the search engine's front-end applications and search engine servers, ensuring that operational operations such as search engine server version upgrades and changes will not affect the business system. The impact of system requirement changes is minimized.
[0097] 4. Development can be done out of the box without needing to learn the official language.
[0098] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0099] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0100] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0101] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0102] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A search engine query processing method, characterized in that, include: Receive query code; The query code includes a custom data structure composed of multiple predefined functions; the predefined functions include query type functions, aggregation functions, and logical type functions; the custom data structure encodes multiple subqueries in a nested manner. Based on a custom data structure, the query code is converted into a structured message; Translate structured messages into query language according to search engine language specifications; Use a query language to request query results from a search engine and obtain the query results returned by the search engine.
2. The method as described in claim 1, characterized in that, The query type function includes one or any combination of the following: Precise search, word segmentation search, phrase matching, range search, geographic location search, relative location search, related search, fuzzy search; The logical type functions include AND, OR, and NOT; The aggregation function includes one or any combination of the following: Average function, maximum value function, minimum value function, summation function, metadata calculation, median calculation, percentile calculation, weighted average calculation, data snapshot, filter, histogram aggregation function, range aggregation function, TopN aggregation, precise pagination, filter; where N is a set positive integer, and TopN aggregation represents the first N options after aggregation and sorting.
3. The method as described in claim 1, characterized in that, The custom data structure is a tree structure, which includes multiple nodes; each node includes one or any combination of query type function fields, logical type function fields, aggregate function fields, and child node list fields; the child node list field includes zero or more other nodes.
4. The method as described in claim 1, characterized in that, Based on a custom data structure, the query code is converted into a structured message, including: By using recursion and loops, the fields of query type functions, logical type functions, and aggregate functions in the query code are determined, the fields are converted into key-value pairs, and all key-value pairs are serialized into a structured message.
5. The method as described in claim 1, characterized in that, The structured message is translated into a query language according to the search engine language specification, including: The structured message is cleaned and then converted into a JSON message. Using a pre-established mapping file, JSON messages are translated into a query language; the mapping file includes the mapping relationship between predefined data types in the search engine and key-value pairs in the JSON message.
6. The method as described in claim 1, characterized in that, After receiving the search results returned by the search engine, it also includes: Using a pre-built mapping file, the query results are translated into JSON messages.
7. The method as described in claim 1, characterized in that, The predefined functions also include sorting functions; sorting includes ascending and descending order.
8. A search engine query processing device, characterized in that, include: Middleware used to receive query codes; The query code includes a custom data structure composed of multiple predefined functions; the predefined functions include query type functions, aggregation functions, and logical type functions; the custom data structure encodes multiple subqueries in a nested manner. Based on a custom data structure, the query code is converted into a structured message; A front-end application for search engines, used to translate structured messages into query language according to search engine language specifications; Use a query language to request query results from a search engine and obtain the query results returned by the search engine.
9. The apparatus as claimed in claim 8, characterized in that, The query type function includes one or any combination of the following: Precise search, word segmentation search, phrase matching, range search, geographic location search, relative location search, related search, fuzzy search; The logical type functions include AND, OR, and NOT; The aggregation function includes one or any combination of the following: Average function, maximum value function, minimum value function, summation function, metadata calculation, median calculation, percentile calculation, weighted average calculation, data snapshot, filter, histogram aggregation function, range aggregation function, TopN aggregation, precise pagination, filter; where N is a set positive integer, and TopN aggregation represents the first N options after aggregation and sorting.
10. The apparatus as claimed in claim 8, characterized in that, The custom data structure is a tree structure, which includes multiple nodes; each node includes one or any combination of query type function fields, logical type function fields, aggregate function fields, and child node list fields; the child node list field includes zero or more other nodes.
11. The apparatus as claimed in claim 8, characterized in that, Middleware is specifically used for: By using recursion and loops, the fields of query type functions, logical type functions, and aggregate functions in the query code are determined, the fields are converted into key-value pairs, and all key-value pairs are serialized into a structured message.
12. The apparatus as claimed in claim 8, characterized in that, Search engine front-end applications are specifically used for: The structured message is cleaned and then converted into a JSON message. Using a pre-established mapping file, JSON messages are translated into a query language; the mapping file includes the mapping relationship between predefined data types in the search engine and key-value pairs in the JSON message.
13. The apparatus as claimed in claim 8, characterized in that, Search engine front-end applications are also used for: After obtaining the query results returned by the search engine, the query results are translated into JSON messages using a pre-established mapping file.
14. The apparatus as claimed in claim 8, characterized in that, The predefined functions also include sorting functions; sorting includes ascending and descending order.
15. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 7.
16. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method of any one of claims 1 to 7.
17. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the method of any one of claims 1 to 7.