Data query method and device, computer device, and storage medium

By querying the sorting weight configuration information in the database and constructing a data query request, the high-concurrency query requirements were solved, custom sorting and incremental data synchronization were realized, query efficiency and scalability were improved, and code modification work was reduced.

CN115757517BActive Publication Date: 2026-06-05CHINA CONSTRUCTION BANK +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA CONSTRUCTION BANK
Filing Date
2022-11-18
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Traditional location-based query solutions struggle to meet the demands of high-concurrency queries under the high-traffic conditions of the internet, and also fail to support diverse business needs.

Method used

By querying the sorting weight configuration information in the preset database, a data query request is constructed and sent to the search engine. The search engine receives and returns the results. It supports custom configuration of sorting weight and incremental data synchronization, thereby decoupling the data query service from the business side.

Benefits of technology

It improves query efficiency, reduces code modification work, supports complex query and sorting requirements in various scenarios, and can dynamically expand the data query service without affecting the business side under high concurrency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115757517B_ABST
    Figure CN115757517B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of big data, and provides a data query method and device, computer equipment and a storage medium. The method comprises the following steps: receiving an interface calling request sent by a business end, the interface calling request carrying business identification information and input parameter information; querying a preset database according to the input parameter information and the business identification information to obtain sorting weight configuration information, wherein the sorting weight configuration information is self-defined weight configuration information; constructing a data query request according to the input parameter information and the sorting weight configuration information, and sending the data query request to a search engine; receiving a data query result fed back by the search engine and sending the data query result to the business end. The method can decouple the data query service from the business end, so that the data query service is independent of the business end and has strong scalability; when the performance is insufficient to support current business traffic, the data query service can be dynamically expanded in capacity to support high-concurrency query of large traffic.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data query technology for big data, and in particular to a data query method, apparatus, computer equipment, storage medium, and computer program product. Background Technology

[0002] In mobile internet applications, there are various scenarios that combine LBS (Location Based Services) geographic location with custom weighted field scoring calculations. For example, when consumers sort lists of restaurants, supermarkets, and cinemas, they need to sort by geographic location from an overall perspective, and also perform weighted sorting after comprehensive scoring based on various fields such as keywords and user ratings.

[0003] Currently, traditional location-based (LBS) query solutions generate corresponding SQL (Structured Query Language) statements based on information such as longitude, latitude, and keywords in the query request. These SQL statements are then sent to a traditional relational database to perform data sorting and querying. After receiving the response from the relational database, the business side performs a secondary sorting in the program's memory using a comprehensive sorting algorithm. The results of this secondary sorting are then filtered according to conditions to obtain the final sorted result.

[0004] However, the above solutions are insufficient to meet the high-concurrency query demands under the high-traffic conditions of the Internet. Summary of the Invention

[0005] Therefore, it is necessary to provide a data query method, apparatus, computer equipment, computer-readable storage medium, and computer program product capable of handling concurrent query requirements to address the aforementioned technical problems.

[0006] Firstly, this application provides a data query method. The method includes:

[0007] Receive API call requests sent by the business side. The API call requests carry business identification information and input parameter information.

[0008] Based on the input parameter information and business identification information, a query is performed in the preset database to obtain the sorting weight configuration information, which is a custom-configured weight configuration information;

[0009] A data query request is constructed based on the input parameters and sorting weight configuration information, and then sent to the search engine.

[0010] Receive data query results from the search engine and send the data query results to the business side.

[0011] In one embodiment, a data query request includes query sorting criteria and query filtering criteria:

[0012] The data query request is constructed based on the input parameters and sorting weight configuration information, including:

[0013] Based on the input parameters, construct the query filtering conditions;

[0014] Based on the sorting weight configuration information, construct the query sorting conditions;

[0015] Combine the sorting and filtering conditions in the query to obtain the data query request.

[0016] In one embodiment, before sending the data query request to the search engine, the method further includes:

[0017] Acquire incremental data, which includes first incremental data subscribed from the message queue and second incremental data queried from a preset database;

[0018] The first and second incremental data are converted into documents, and an index for the search engine is created based on the documents.

[0019] In one embodiment, before converting the first incremental data and the second incremental data into a document, the method further includes:

[0020] The first and second incremental data are segmented and converted to determine the first target incremental data to be segmented and the second target incremental data that does not need to be segmented.

[0021] Convert the incremental data of the first target into data of the first type, and convert the incremental data of the second target into data of the second type.

[0022] In one embodiment, before converting the first incremental data and the second incremental data into a document, the method further includes:

[0023] Filter out the geographic location data from the first and second incremental data;

[0024] Convert geographic location data into target geographic location type data.

[0025] In one embodiment, before querying a preset database based on input parameter information and business identifier information to obtain sorting weight configuration information, the method further includes:

[0026] Perform parameter verification on the input parameter information and business identification information to obtain the parameter verification results;

[0027] Based on the input parameter information and business identification information, a query is performed in the preset database to obtain the sorting weight configuration information, including:

[0028] When the parameter verification result meets the preset parameter verification conditions, the system queries the preset database based on the input parameter information and business identification information to obtain the sorting weight configuration information.

[0029] In one embodiment, before querying a preset database based on input parameter information and business identifier information to obtain sorting weight configuration information, the method further includes:

[0030] Receive sorting weight configuration instructions, which carry business identifiers and field weight percentage information;

[0031] Based on the business identifier and field weight percentage information, add or update the sorting weight configuration record corresponding to the business identifier.

[0032] Secondly, this application also provides a data query device. The device includes:

[0033] The request receiving module is used to receive interface call requests sent by the business side. The interface call requests carry business identification information and input parameter information.

[0034] The weight configuration query module is used to query the preset database based on the input parameter information and business identification information to obtain the sorting weight configuration information. The sorting weight configuration information is the custom-configured weight configuration information.

[0035] The query request building module is used to construct data query requests based on input parameters and sorting weight configuration information, and send the data query requests to the search engine;

[0036] The data feedback module is used to receive the data query results from the search engine and send the data query results to the business side.

[0037] In one embodiment, a data query request includes query sorting criteria and query filtering criteria:

[0038] The query request building module is also used to build query filtering conditions based on input parameter information, build query sorting conditions based on sorting weight configuration information, and combine query sorting conditions and query filtering conditions to obtain data query requests.

[0039] In one embodiment, the apparatus further includes a data synchronization module for acquiring incremental data, the incremental data including first incremental data subscribed from a message queue and second incremental data queried from a preset database, converting the first incremental data and the second incremental data into documents, and creating an index for a search engine based on the documents.

[0040] In one embodiment, the data synchronization module is further configured to perform word segmentation and conversion judgment on the first incremental data and the second incremental data, determine the first target incremental data to be segmented and the second target incremental data that does not need to be segmented, convert the first target incremental data into a first type of data, and convert the second target incremental data into a second type of data.

[0041] In one embodiment, the data synchronization module is further configured to filter out geographic location data from the first incremental data and the second incremental data, and convert the geographic location data into target geographic location type data.

[0042] In one embodiment, the device further includes a parameter verification module for verifying the input parameter information and the service identification information to obtain the parameter verification result;

[0043] The weight configuration query module is also used to query the preset database based on the input parameter information and business identification information when the parameter verification result meets the preset parameter verification conditions, so as to obtain the sorting weight configuration information.

[0044] In one embodiment, the device further includes a weight configuration module, which is used to receive a sorting weight configuration instruction, the sorting weight configuration instruction carrying a business identifier and field weight ratio information, and adding or updating a sorting weight configuration record corresponding to the business identifier based on the business identifier and field weight ratio information.

[0045] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:

[0046] Receive API call requests sent by the business side. The API call requests carry business identification information and input parameter information.

[0047] Based on the input parameter information and business identification information, a query is performed in the preset database to obtain the sorting weight configuration information, which is a custom-configured weight configuration information;

[0048] A data query request is constructed based on the input parameters and sorting weight configuration information, and then sent to the search engine.

[0049] Receive data query results from the search engine and send the data query results to the business side.

[0050] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:

[0051] Receive API call requests sent by the business side. The API call requests carry business identification information and input parameter information.

[0052] Based on the input parameter information and business identification information, a query is performed in the preset database to obtain the sorting weight configuration information, which is a custom-configured weight configuration information;

[0053] A data query request is constructed based on the input parameters and sorting weight configuration information, and then sent to the search engine.

[0054] Receive data query results from the search engine and send the data query results to the business side.

[0055] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:

[0056] Receive API call requests sent by the business side. The API call requests carry business identification information and input parameter information.

[0057] Based on the input parameter information and business identification information, a query is performed in the preset database to obtain the sorting weight configuration information, which is a custom-configured weight configuration information;

[0058] A data query request is constructed based on the input parameters and sorting weight configuration information, and then sent to the search engine.

[0059] Receive data query results from the search engine and send the data query results to the business side.

[0060] The aforementioned data query method, apparatus, computer equipment, storage medium, and computer program product, based on the input parameters and business identifier information in the interface call request sent by the business end, query a preset database to obtain ranking weight configuration information. Then, based on the input parameters and ranking weight configuration information, a data query request is constructed and sent to the search engine. The data query results from the search engine are received and sent back to the business end. Data query is achieved through data interaction between the data query service, the business end, and the search engine. This solution, on the one hand, supports custom configuration of ranking weights. Business personnel can configure ranking weights according to business needs to support complex query ranking requirements in various scenarios, which can improve query efficiency to a certain extent and avoid modifying the code due to the diversity of query requirements, saving the work of modifying the code. On the other hand, decoupling the data query service from the business side makes the data query service independent of the business side, which largely avoids the need to modify the code due to increasingly complex business requirements, avoids the tedious operation of developers to modify the program again, and saves a lot of manpower and time. At the same time, as an independent service, the data query service is highly scalable. When the performance is insufficient to support the current business traffic, the capacity of the data query service can be dynamically expanded to support high-concurrency queries with large traffic, without the need to expand the capacity of the business side. Attached Figure Description

[0061] Figure 1 This is a diagram illustrating the application environment of a data query method in one embodiment.

[0062] Figure 2 This is a flowchart illustrating a data query method in one embodiment;

[0063] Figure 3 This is a flowchart illustrating the data query method in another embodiment;

[0064] Figure 4 This is a schematic diagram illustrating the acquisition of incremental data in one embodiment;

[0065] Figure 5 This is a flowchart illustrating the data query method in yet another embodiment;

[0066] Figure 6 This is a flowchart illustrating the data query method in another embodiment;

[0067] Figure 7 This is a structural block diagram of a data query device in one embodiment;

[0068] Figure 8 This is a structural block diagram of the data query device in another embodiment;

[0069] Figure 9This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0070] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. It should be noted that the acquisition, storage, use, and processing of data in the technical solutions of this application all comply with relevant national laws and regulations.

[0071] The data query method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, the data query server (which may be an LBS query server) 104 communicates with the business server (hereinafter referred to as the business server) 102 and the search engine 106 via a network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104 or placed on the cloud or other network servers. Specifically, the data query server 104 receives an interface call request sent by the business server 102. This data query request carries corresponding business identification information and input parameter information. Then, based on the input parameter information and business identification information, it queries a preset database to obtain sorting weight configuration information. The sorting weight configuration information is a custom-configured weight configuration. Based on the input parameter information and sorting weight configuration information, it constructs a data query request and sends it to the search engine 106. It receives the data query results from the search engine 106 and sends the data query results back to the business server 104. The business server 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart vehicle devices, etc. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted devices. The data query server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers. The search engine 106 can be deployed on a standalone server or a server cluster consisting of multiple servers.

[0072] In one embodiment, such as Figure 2 As shown, a data query method is provided, which can be applied to... Figure 1 Taking the data query server 104 as an example, the following steps are included:

[0073] Step S200: Receive the interface call request sent by the business terminal. The interface call request carries business identification information and input parameter information.

[0074] The business side refers to providing products and services to the service platform. Key functions include product and service display, order submission and procurement, marketing activities, and order payment. Business identification information is data representing a specific business type, which can be a business number or business name, or a combination of both. Input parameter information consists of variable parameters required for the interface request, including required and optional parameters. In this embodiment, required parameters include geographic location data, such as longitude and latitude. Optional parameters include keywords, store location, and range. In practical applications, taking an LBS query server as an example, the data query server can be a client (which can be a mobile terminal) that has obtained authorization from the client to access the client's geographical location, obtains the client's geographical location, receives the field information input by the client, and sends an LBS query request carrying business identification information, geographical location data, and input keywords to the business side. The business side receives the LBS query request, extracts the business identification information, geographical location data, and keyword information from the LBS query request, determines the input parameter information based on the keyword information and geographical location information, and then constructs an LBS interface call request carrying the business identification information and input parameter information, and sends the interface call request to the LBS query server. The LBS query server receives the interface call request.

[0075] Step S400: Query the preset database based on the input parameter information and business identification information to obtain the sorting weight configuration information, which is a custom-configured weight configuration information.

[0076] The sorting weight configuration information is used to determine the order of query results data. It specifically includes business identifier information, the weight percentage of each field, and other information. In this embodiment, the sorting weight configuration information is configured by the operations personnel according to specific business needs. For example, in a food ordering scenario, the sorting weight configuration information is 50% for store reviews and 50% for store name. In this case, the search results will prioritize displaying stores with higher review counts when matching store names.

[0077] In this embodiment, the preset database can be a MySQL database, an SQL database, or another database. Upon receiving an interface call request, the input parameter information and business identifier information in the interface call request can be extracted. A matching query can then be performed in the preset database based on the input parameter information and business identifier information to obtain the sorting weight configuration information corresponding to the business identifier information.

[0078] Step S600: Construct a data query request based on the input parameter information and sorting weight configuration information, and send the data query request to the search engine.

[0079] Following the above embodiments, after obtaining the sorting weight configuration information, a data query request can be constructed based on the input parameters and the sorting weight configuration information. Specifically, a query request containing conditions such as query filtering and query sorting can be constructed, and then the data query request is sent to the search engine. In this embodiment, the search engine can be a secondary development of Elasticsearch. Elasticsearch is a distributed, highly scalable, and real-time search and data analysis engine, and it supports geolocation (geo_point) type conversion. Elasticsearch has indexed data corresponding to the business data. It is understood that in other embodiments, the search engine can also be a Solr search engine or a Splunk search engine, depending on the actual situation, and is not limited here.

[0080] Step S800: Receive the data query results from the search engine and send the data query results to the business side.

[0081] Taking Elasticsearch as an example, Elasticsearch builds indexes corresponding to the business data on the business side. Upon receiving a data query request from the data query server, it can perform word segmentation on the input parameters of the request. Based on the segmented results, it performs a matching query in the index data to obtain the corresponding query results, which are then sent back to the data query server. The data query server, upon receiving the query results from Elasticsearch, assembles them and sends the assembled results to the business side. Furthermore, the business side pushes the received query results to the client. At this point, the client displays the query results according to user needs and sorting weight configuration information, allowing users to select products that meet their needs in a shorter time.

[0082] In the above data query method, based on the input parameters and business identifier information in the interface call request sent by the business side, a query is performed in a preset database to obtain the sorting weight configuration information. Then, a data query request is constructed based on the input parameters and sorting weight configuration information and sent to the search engine. The data query results fed back by the search engine are received and sent to the business side. Data query is realized through data interaction between the data query service, the business side, and the search engine. This solution, on the one hand, supports custom configuration of sorting weights. Business personnel can configure sorting weights according to business needs to support complex query sorting requirements in various scenarios, which can improve query efficiency to a certain extent and avoid modifying the code due to the diversity of query requirements, saving code modification work. On the other hand, decoupling the data query service from the business side makes the data query service independent of the business side, which largely avoids the need to modify the code due to increasingly complex business requirements, avoids the tedious operation of developers to modify the program again, and saves a lot of manpower and time. At the same time, as an independent service, the data query service is highly scalable. When the performance is insufficient to support the current business traffic, the capacity of the data query service can be dynamically expanded to support high-concurrency queries with large traffic, without the need to expand the capacity of the business side.

[0083] like Figure 3 As shown, in one embodiment, a data query request includes query sorting conditions and query filtering conditions:

[0084] Step S600 includes: Step S620, constructing query filtering conditions based on input parameter information, constructing query sorting conditions based on sorting weight configuration information, combining query sorting conditions and query filtering conditions to obtain a data query request, and sending the data query request to the search engine.

[0085] In this embodiment, the search engine uses Elasticsearch as an example. Constructing a data query request can be done by building query filtering conditions corresponding to Elasticsearch based on the input parameter information, building query sorting conditions corresponding to Elasticsearch based on the sorting weight configuration information, and then combining the query sorting conditions and query filtering conditions to obtain a data query request that Elasticsearch can respond to. The following example illustrates the construction of a query request. If the input parameter information is: McDonald's, 116.391XXX7, 39.905XXX7, within 10KM, and the sorting weight configuration information is: 100% geographical location, then the constructed query request is: {"geo_distance":{"distance":"10km","pin.location":{"lat":39.9053937,"lon":116.3913447}}}, where the sorting method is by geographical location.

[0086] Specifically, based on the store name, product category, and range distance information in the input parameters, query filtering conditions are constructed to filter out merchants or products that do not match the input parameters. Query sorting conditions are also constructed based on the sorting weight configuration information. For example, if the sorting weight configuration information is 50% for store positive reviews and 50% for store name, then, in the case of matching store names, stores with higher positive review counts should be listed before stores with lower positive review counts. As another example, if the sorting weight configuration information is 30% for store positive reviews, 20% for store name, and 50% for range distance, then, in the case of matching stores with the same store name in ascending order of distance from the client, stores with higher positive review counts should be listed before stores with lower positive review counts.

[0087] In this embodiment, query filtering conditions and query sorting conditions are constructed based on input parameter information and sorting weight configuration information, which can match results that meet user needs more quickly and accurately.

[0088] like Figure 3 As shown, in one embodiment, before step S600, the following steps are further included:

[0089] Step S120: Obtain incremental data, which includes first incremental data subscribed from the message queue and second incremental data queried from a preset database.

[0090] Step S140: Convert the first incremental data and the second incremental data into documents, and create an index for the search engine based on the documents.

[0091] In practical applications, before sending a data query request to a search engine, the data in the database should be synchronized to the search engine. Specifically, the synchronized data can be incremental data from the database. For example... Figure 4 As shown, this could be a data synchronization component in a data query server, acquiring incremental data, converting it into documents according to business rules, segmenting the documents, building an inverted index, and establishing a search engine index. The incremental data comes from two sources: firstly, incremental data obtained through subscription and consumption from a message queue; and secondly, incremental data obtained periodically from the database via SQL queries through scheduled tasks. The data sources in the message queue include business data actively published by various systems, which can be obtained through the data operation layer, and also incremental data published by the Cannal service, which obtains incremental changes from the database by subscribing to the database binlog. Since data in the search engine is stored in document format, similar to how data in a database is stored in table format, this process is similar to how data in a database is stored in tables. After obtaining the first and second incremental data, the data can be converted into documents according to business rules. After generating the documents, the search engine can be queried based on the document ID (identity document). If the document already exists, it can be updated; otherwise, it can be inserted. The document can be segmented into words, an inverted index can be built, and an index can be created for the search engine to synchronize the incremental data to the search engine.

[0092] For example, generating documents in Elasticsearch based on business rules could be as follows: Suppose there's a merchant table in the database named `table_mct` with five fields: `latitude`, `longitude`, `type`, `name`, and `dsc`. These represent the merchant's latitude, longitude, type, name, and description, respectively, and all fields are of type `varchar`. Then, an index named `es_table_mct` is created in Elasticsearch, corresponding to the merchant table in the database. The index has five fields: `latitude`, `longitude`, `type`, `name`, and `dsc`. `latitude` and `longitude` are of type `geo_point`, `type` is of type `keyword`, and `name` and `dsc` are of type `wildcard`, corresponding to the five fields in the `table_mct` table. This index data in Elasticsearch is used for subsequent searches; subsequent search operations will directly retrieve records that meet the specified conditions from the index.

[0093] Furthermore, data synchronization can be performed incrementally on data subscribed to in the message queue, or fully on data retrieved periodically from the database via SQL queries. During synchronization, if data is updated, it is synchronized to the search engine; otherwise, it is not synchronized. Thus, the data synchronized to the search engine is essentially incrementally changed data. In this embodiment, by synchronizing incremental data to the search engine, the timeliness of the index data queried by the search engine can be ensured, resulting in more accurate search results.

[0094] like Figure 5 As shown, in one embodiment, before step S140, the method further includes: step S130, performing word segmentation and conversion judgment on the first incremental data and the second incremental data, determining the first target incremental data to be segmented and the second target incremental data that does not need to be segmented, converting the first target incremental data into first type data, and converting the second target incremental data into second type data.

[0095] Following the above embodiment, before processing the first and second incremental data, a word segmentation conversion judgment can be performed on the first and second incremental data to determine the first target incremental data to be segmented and the second target incremental data that does not need to be segmented. Then, in the word segmentation conversion, the first target incremental data that needs to be segmented is converted into text type data, and the second incremental data that does not need to be segmented is converted into keyword type data. Finally, the first and second target incremental data that have completed word segmentation conversion are converted into a document. In this embodiment, by performing word segmentation conversion on the incremental data, the standardization of the data can be ensured, which facilitates subsequent data management and data querying.

[0096] like Figure 5 As shown, in one embodiment, before step S140, the method further includes: step S132, filtering out geographic location data from the first incremental data and the second incremental data, and converting the geographic location data into target geographic location type data.

[0097] Geographic location data includes latitude and longitude location data, as well as land and sea location data. Continuing from the previous embodiment, the incremental data can be converted to geographic location data after word segmentation. Specifically, geographic location data can be filtered according to the target format, and then uniformly converted to the target geographic location type. In this embodiment, taking Elasticsearch as an example, the geographic location type in its index is geo_point. Geographic location data can be converted to geo_point type, and then the longitude and latitude can be written; that is, a geo_point record includes both longitude and latitude information. Furthermore, in Elasticsearch, the geo_distance function can be used to match a set of geographic locations within a certain range based on the client's geographic location data. It is understood that there is no necessary order between word segmentation and geographic location conversion; word segmentation can be performed first, followed by geographic location conversion, or vice versa. This embodiment ensures the standardization of geographic location data by converting it to the target geographic location type.

[0098] like Figure 6 As shown, in one embodiment, before step S400, the method further includes: step S300, performing parameter verification on the input parameter information and service identification information to obtain parameter verification results; step S400 includes: step S420, when the parameter verification results meet the preset parameter verification conditions, querying the preset database based on the input parameter information and service identification information to obtain sorting weight configuration information.

[0099] In practical implementation, after the interface call request, parameter validation can be performed on the input parameters and business identifier information in the interface call request. In this embodiment, the validity of the request fields can be validated. For example, keywords can be Chinese characters, English letters, English words, or a range of numbers, with a length not exceeding a limit, such as 20. Latitude and longitude values ​​must be within the valid range: longitude range is 0-180, and latitude range is 0-90. When the input parameters and business identifier pass the above parameter validation, a query is performed in a preset database based on the input parameters and business identifier information to obtain the sorting weight configuration information; otherwise, a parameter error message is pushed to the business system for timely parameter correction. It is understood that in addition to validity validation, validity validation or other dimensions of validation can also be performed, depending on the actual situation, and are not limited here. In this embodiment, by validating the fields in the request, the validity of the request call can be guaranteed.

[0100] like Figure 6As shown, in one embodiment, before step S400, the method further includes: step S100, receiving a sorting weight configuration instruction carrying service identifier and field weight ratio information, and adding or updating a sorting weight configuration record corresponding to the service identifier according to the service identifier and field weight ratio information.

[0101] This embodiment describes how to configure sorting weights for operations personnel. In practical applications, operations personnel with operational permissions can add or modify sorting weight configuration information in the management backend. Each configuration includes information such as business identifier, query field identifier, and field weight percentage. Specifically, the configured fields include name, business description, time period, geographical location, and category. After operations personnel complete the sorting weight configuration information, clicking the save button will save the sorting weight configuration record to a preset database. Specifically, they can first check if there is sorting weight configuration information corresponding to the business identifier in the database. If it exists, the sorting weight configuration information corresponding to the business identifier will be updated accordingly; if it does not exist, a new sorting weight configuration information corresponding to the business identifier will be added. Similarly, for example, in a food ordering scenario, operations personnel can set the weighting of store reviews to 50% and store name to 50%. In this case, the search results will prioritize displaying stores with higher reviews when matching store names. In addition, different product categories can be prioritized for different time periods. For example, between 7:00 AM and 9:00 AM, breakfast items can be prioritized over other categories, and between 3:00 PM and 5:00 PM, afternoon tea items can be prioritized over other categories. In this embodiment, by receiving sorting weight configuration instructions and adding or updating sorting weight configuration records corresponding to business identifiers, the sorting weight configuration instructions can be customized to flexibly address a variety of business scenarios.

[0102] To clearly explain the data query method provided in this application, the following is in conjunction with the appendix. Figure 6 and one A specific embodiment will be described, which includes the following:

[0103] Step S100: Receive a sorting weight configuration instruction carrying business identifier and field weight percentage information, and add or update the sorting weight configuration record corresponding to the business identifier based on the business identifier and field weight percentage information.

[0104] Step S120: Obtain incremental data, which includes first incremental data subscribed from the message queue and second incremental data queried from a preset database.

[0105] Step S130: Perform word segmentation and conversion judgment on the first incremental data and the second incremental data, and convert the incremental data into different types of data. Specifically, determine the first target incremental data to be segmented and the second target incremental data that does not need to be segmented, convert the first target incremental data into first type data, and convert the second target incremental data into second type data.

[0106] Step S132: Filter out the geographic location data in the first incremental data and the second incremental data, and convert the geographic location data into target geographic location type data.

[0107] Step S142: Convert the first and second incremental data, which have undergone word segmentation and geolocation conversion, into documents, and create an index for the search engine based on the documents.

[0108] Step S200: Receive an interface call request sent by the service terminal, which carries service identification information and input parameter information.

[0109] Step S300: Perform parameter verification on the input parameter information and business identification information to obtain the parameter verification result.

[0110] Step S420: When the parameter verification result meets the preset parameter verification conditions, query the preset database according to the input parameter information and business identification information to obtain the sorting weight configuration information.

[0111] Step S600: Construct a query request based on the input parameter information and sorting weight configuration information, and send the data query request to the search engine. Specifically, construct query filter conditions based on the input parameter information, construct query sorting conditions based on the sorting weight configuration information, combine the query sorting conditions and query filter conditions to obtain the data query request, and send the data query request to the search engine.

[0112] Step S800: Receive the data query results from the search engine and send the data query results to the business side.

[0113] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0114] Based on the same inventive concept, this application also provides a data query apparatus for implementing the data query method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more data query apparatus embodiments provided below can be found in the limitations of the data query method described above, and will not be repeated here.

[0115] In one embodiment, such as Figure 7 As shown, a data query device is provided, including: a request receiving module 710, a weight configuration query module 720, a query request construction module 730, and a data feedback module 740, wherein:

[0116] The request receiving module 710 is used to receive interface call requests sent by the business side. The interface call requests carry business identification information and input parameter information.

[0117] The weight configuration query module 720 is used to query the preset database based on the input parameter information and business identification information to obtain the sorting weight configuration information, which is the custom-configured weight configuration information.

[0118] The query request building module 730 is used to build a data query request based on the input parameter information and the sorting weight configuration information, and send the data query request to the search engine.

[0119] The data feedback module 740 is used to receive the data query results from the search engine and send the data query results to the business side.

[0120] The aforementioned data query device, based on the input parameters and business identifier information in the interface call request sent by the business end, queries a preset database to obtain sorting weight configuration information. Then, it constructs a data query request based on the input parameters and sorting weight configuration information, sends the data query request to the search engine, receives and sends the data query results from the search engine back to the business end, and realizes data query through data interaction between the data query service, the business end, and the search engine. This solution, on the one hand, supports custom configuration of sorting weights, allowing business personnel to configure sorting weights according to business needs to support complex query sorting requirements in various scenarios. This can improve query efficiency to a certain extent and avoid modifying the code due to the diversity of query requirements, saving the work of modifying the code. On the other hand, decoupling the data query service from the business side makes the data query service independent of the business side, which largely avoids the need to modify the code due to increasingly complex business requirements, avoids the tedious operation of developers to modify the program again, and saves a lot of manpower and time. At the same time, as an independent service, the data query service is highly scalable. When the performance is insufficient to support the current business traffic, the capacity of the data query service can be dynamically expanded to support high-concurrency queries with large traffic, without the need to expand the capacity of the business side.

[0121] In one embodiment, a data query request includes query sorting criteria and query filtering criteria:

[0122] The query request building module 730 is also used to build query filtering conditions based on input parameter information, build query sorting conditions based on sorting weight configuration information, and combine query sorting conditions and query filtering conditions to obtain a data query request.

[0123] like Figure 8 As shown, in one embodiment, the device further includes a data synchronization module 702, which is used to acquire incremental data, including first incremental data subscribed from a message queue and second incremental data queried from a preset database, convert the first incremental data and the second incremental data into documents, and create an index for a search engine based on the documents.

[0124] In one embodiment, the data synchronization module 702 is further configured to perform word segmentation and conversion judgment on the first incremental data and the second incremental data, determine the first target incremental data to be segmented and the second target incremental data that does not need to be segmented, convert the first target incremental data into first type data, and convert the second target incremental data into second type data.

[0125] In one embodiment, the data synchronization module 702 is further configured to filter out geographic location data in the first incremental data and the second incremental data, and convert the geographic location data into target geographic location type data.

[0126] like Figure 8 As shown, in one embodiment, the device further includes a parameter verification module 722, which is used to perform parameter verification on the input parameter information and the service identification information to obtain the parameter verification result; the weight configuration query module 720 is also used to query the preset database according to the input parameter information and the service identification information when the parameter verification result meets the preset parameter verification conditions to obtain the sorting weight configuration information.

[0127] In one embodiment, the device further includes a weight configuration module 704, which is used to receive a sorting weight configuration instruction, the sorting weight configuration instruction carrying a business identifier and field weight ratio information, and adding or updating a sorting weight configuration record corresponding to the business identifier based on the business identifier and field weight ratio information.

[0128] Each module in the aforementioned data query device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0129] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 9 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores data such as sorting weight configuration information and service identifiers. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a data query method.

[0130] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0131] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the data query method described above.

[0132] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in the data query method described above.

[0133] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the data query method described above.

[0134] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0135] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0136] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A data query method, characterized in that, The method includes: Receive an interface call request sent by the business terminal, wherein the interface call request carries business identification information and input parameter information; The input parameter information and the business identification information are subjected to parameter verification to obtain parameter verification results. When the parameter verification results meet the preset parameter verification conditions, the input parameter information and the business identification information are queried in the preset database to obtain the sorting weight configuration information. The sorting weight configuration information is a weight configuration information that is customized according to business needs. The weight configuration information includes the sorting priority of different categories of products that are dynamically adjusted according to time periods. A data query request is constructed based on the input parameter information and the sorting weight configuration information, and the data query request is sent to the search engine. The data query request includes query filtering conditions constructed based on the input parameter information and query sorting conditions constructed based on the sorting weight configuration information. Receive the data query results from the search engine and send the data query results to the business terminal; Before sending the data query request to the search engine, the process further includes: acquiring incremental data, which includes first incremental data subscribed from a message queue and second incremental data queried from the preset database; performing word segmentation and conversion judgment on the first and second incremental data to determine the first target incremental data to be segmented and the second target incremental data that does not need to be segmented; converting the first target incremental data into first type data and the second target incremental data into second type data; filtering out the geographic location data in the first and second incremental data; converting the geographic location data into target geographic location type data; converting the processed first and second incremental data into documents according to business rules; performing word segmentation on the documents; constructing an inverted index; and establishing the search engine's index.

2. The method according to claim 1, characterized in that, The step of constructing a data query request based on the input parameter information and the sorting weight configuration information includes: Based on the input parameter information, construct query filtering conditions; Based on the sorting weight configuration information, construct the query sorting conditions; By combining the query sorting conditions and the query filtering conditions, a data query request is obtained.

3. The method according to claim 1, characterized in that, Before querying the preset database based on the input parameter information and the business identifier information to obtain the sorting weight configuration information, the method further includes: Receive a sorting weight configuration instruction, the sorting weight configuration instruction carrying a business identifier and field weight percentage information; Based on the business identifier and the field weight ratio information, add or update the sorting weight configuration record corresponding to the business identifier.

4. The method according to claim 1, characterized in that, The input parameters include required parameters and optional parameters. The required parameters include geographic location data, and the optional parameters include keywords, store location, and range.

5. A data query device, characterized in that, The device includes: The request receiving module is used to receive interface call requests sent by the business side, wherein the interface call requests carry business identification information and input parameter information; The parameter verification module is used to perform parameter verification on the input parameter information and the service identification information to obtain the parameter verification result. The weight configuration query module is used to query the preset database based on the input parameter information and the business identification information when the parameter verification result meets the preset parameter verification conditions, and obtain the sorting weight configuration information. The sorting weight configuration information is a weight configuration information customized according to business needs. The weight configuration information includes the sorting priority of different categories of products dynamically adjusted according to time periods. The query request construction module is used to construct a data query request based on the input parameter information and the sorting weight configuration information, and send the data query request to the search engine; The data feedback module is used to receive the data query results from the search engine and send the data query results to the business terminal. The data synchronization module is used to acquire incremental data, which includes first incremental data subscribed from a message queue and second incremental data queried from a preset database. It performs word segmentation and conversion judgment on the first and second incremental data to determine first target incremental data to be segmented and second target incremental data that does not require segmentation. It converts the first target incremental data into first type data and the second target incremental data into second type data. It filters out geographic location data from the first and second incremental data and converts the geographic location data into target geographic location type data. It then converts the processed first and second incremental data into documents according to business rules, performs word segmentation on the documents, constructs an inverted index, and establishes an index for the search engine.

6. The apparatus according to claim 5, characterized in that, The data query request includes query sorting conditions and query filtering conditions: The query request construction module is further configured to construct query filtering conditions based on the input parameter information, construct query sorting conditions based on the sorting weight configuration information, and combine the query sorting conditions and the query filtering conditions to obtain a data query request.

7. The apparatus according to any one of claims 5 to 6, characterized in that, The device further includes a weight configuration module for receiving a sorting weight configuration instruction, the sorting weight configuration instruction carrying a business identifier and field weight percentage information, and adding or updating a sorting weight configuration record corresponding to the business identifier based on the business identifier and the field weight percentage information.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 4.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.