Data query method and device, computer equipment, readable storage medium and program product
By generating a request carrying identification information in the local database, the server queries based on the identification information, solving the problem of slow fuzzy query speed in large databases, improving query efficiency and reducing server pressure.
Patent Information
- Application Number
- CN202510529416.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-25
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2045-04-25
AI Technical Summary
When fuzzy data query in large databases, the query speed is slow, resulting in high pressure on server operation and low efficiency.
By pre-storing part of the data of the target database as configuration data in the local database, a request information carrying the identification information is generated. The server queries based on the identification information, reducing the number of times fuzzy queries are performed directly in the target database.
It improves the efficiency of data query, reduces the operating pressure of the server, and controls the data storage volume of the terminal, ensuring the rapid response of the query.
Smart Images

Figure CN120429339A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data query method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] With the development of computer technology, database technology has emerged. Database technology can store, organize, manage, and retrieve data, ensuring data consistency, security, and efficient access, and supporting various data processing and decision support functions. The required data can be obtained by querying the database.
[0003] In the current process of querying a database, it is usually necessary to query the database for data matching the fuzzy information based on the fuzzy information.
[0004] To speed up data queries, existing techniques employ indexes within relational databases. However, when performing fuzzy data queries on these databases, if the query fails to find a match on the index, the query speed may be slow, resulting in low query efficiency. When the number of databases is large, the amount of data that needs to be matched against the fuzzy information also increases, which can lead to significant operational strain on the databases. Summary of the Invention
[0005] Based on this, it is necessary to provide a data query method, device, computer equipment, computer-readable storage medium and computer program product that can reduce the operating pressure of the server and improve the efficiency of data query in response to the above technical problems.
[0006] In a first aspect, the present application provides a data query method, comprising:
[0007] Get search information;
[0008] Querying the configuration data stored in the local database for reference information corresponding to the search information, and generating request information based on identification information corresponding to the reference information;
[0009] Sending the request information to the server so that the server can query the corresponding query result from the target database based on the identification information, the configuration data includes the target data in the target database sent by the server in advance, and the configuration data is used to be pre-stored in the local database;
[0010] Receive and display the query results sent by the server.
[0011] In one embodiment, reference information corresponding to the search information is queried from configuration data stored in a local database, and request information is generated based on identification information corresponding to the reference information, including: determining a search item and a search value corresponding to the search information; determining a searchable item from the search item, the searchable item belonging to a configuration field corresponding to the configuration data; determining target field data matching the search value from searchable field data corresponding to the searchable item in the local database; and generating request information based on identification information corresponding to the target field data.
[0012] In one of the embodiments, target field data that matches the search value is determined from the searchable field data corresponding to the searchable item in the local database, and request information is generated based on identification information corresponding to the target field data, including: determining the searchable field corresponding to the searchable item; dividing the searchable field into at least one searchable field set based on the identification field corresponding to the searchable field; determining target field data that matches the search value set corresponding to the searchable field set from the searchable field data corresponding to the searchable item in the local database; and generating request information based on at least one identification field corresponding to the target field data.
[0013] In one embodiment, based on the identification field corresponding to the searchable field, the searchable field is divided into at least one searchable field set, including: determining the parent field to which the searchable field belongs; based on the parent field, the searchable field is divided into at least one searchable field set; each searchable field set includes at least one field; different searchable field sets correspond to different types of parent fields.
[0014] In one embodiment, after determining the search terms and search values corresponding to the search information, the method further includes: determining unsearchable items and corresponding search data from the search terms, the unsearchable items not belonging to the configuration fields; generating request information based on identification information corresponding to the search data and the target field data; sending the request information to the server, so that the server performs a first type of query on the target database based on the search data to obtain a first query result, and the server performs a second type of query on the target database based on the field data corresponding to the searchable field in the target field data to obtain a second query result, and determines the query result based on the first query result and the second query result; receiving and displaying the query result sent by the server.
[0015] In one embodiment, before generating request information based on identification information corresponding to the reference information, the method also includes: if the reference information obtained by the query exceeds a preset amount of information, generating request information based on the search information, and sending the request information to the server, so that the server performs a first type of query on the target database.
[0016] In a second aspect, the present application further provides a data query device, comprising:
[0017] Acquisition module, used to obtain search information;
[0018] a query module, configured to query reference information corresponding to the search information from configuration data stored in a local database, and generate request information based on identification information corresponding to the reference information;
[0019] a communication module, configured to send the request information to a server, so that the server queries a target database for a corresponding query result based on the identification information, wherein the configuration data includes target data in the target database received in advance from the server, and the configuration data is used to be pre-stored in the local database;
[0020] The display module is used to receive and display the query result sent by the server.
[0021] In a third aspect, the present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps described in the above method when executing the computer program.
[0022] In a fourth aspect, the present application also provides a computer-readable storage medium having a computer program stored thereon, which implements the steps described in the above method when executed by a processor.
[0023] In a fifth aspect, the present application also provides a computer program product, comprising a computer program, which implements the steps described in the above method when executed by a processor.
[0024] The above-mentioned data query method, apparatus, computer device, computer-readable storage medium, and computer program product obtain search information, query reference information corresponding to the search information from configuration data stored in a local database of a terminal, and then generate a request message based on identification information corresponding to the reference information. That is, the request message carries the identification information. After receiving the identification information, the server queries the corresponding query result based on the identification information and sends the query result to the terminal for display on the terminal. In this way, the search information can be converted into identification information based on the operating capabilities of the terminal. The process of querying data from the target database based on the identification information can improve query efficiency and reduce the operating pressure of the server querying the target database compared to the process of directly querying data from the target database based on the search information. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments of the present application or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying any creative work.
[0026] Figure 1 This is an application environment diagram of a data query method in one embodiment;
[0027] Figure 2 1 is a flow chart of a data query method in one embodiment;
[0028] Figure 3 A schematic diagram of a query result display page in one embodiment;
[0029] Figure 4 A flowchart of a step of determining identification information in one embodiment;
[0030] Figure 5 Schematic diagram of a data query method according to another embodiment;
[0031] Figure 6 A schematic diagram of a page displayed on a terminal where a user is located in one embodiment;
[0032] Figure 7 A schematic diagram of a first page displayed on a terminal where another user is located in one embodiment;
[0033] Figure 8 A schematic diagram of a second page displayed on a terminal where another user is located in one embodiment;
[0034] Figure 9 A schematic diagram of a third page displayed on a terminal where another user is located in one embodiment;
[0035] Figure 10 Schematic diagram of interaction between a terminal and a server in one embodiment;
[0036] Figure 11 is a structural block diagram of a data query device in one embodiment;
[0037] Figure 12 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0039] The data query method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store data that server 104 needs to process. The data storage system can be integrated with server 104, or located in the cloud or on another network server. Target data in a target database is pre-sent to the terminal. The target data is a portion of the data stored in the target database. The terminal receives the target data and stores it in a local database as configuration data. In response to changes in the target data, the server sends the change data to the terminal to update the locally stored configuration data. The terminal obtains search information, retrieves reference information corresponding to the search information from the configuration data, and generates a request message based on the identification information corresponding to the reference information. The terminal sends the request message to the server. After receiving the request message, the server retrieves the corresponding query results from the target database based on the identification information carried in the request message. The server sends the query results to the terminal, which then displays the query results. The data storage system stores the target database. Terminal 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 car devices, projectors, and the like. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. Head-mounted devices can be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. Server 104 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0040] In an exemplary embodiment, Figure 2 As shown, a data query method is provided, which is applied to Figure 1 The terminal in FIG is taken as an example to illustrate the method, including the following steps S202 to S208. In which:
[0041] Step S202: Obtain search information.
[0042] The search information is information in other forms such as text, numbers, etc. that is used to match data recorded in the local database.
[0043] For example, the search information can be incomplete information entered by the user in an input box displayed on a terminal page. Incomplete information refers to information that cannot be fully matched with any data in the database. For example, the data stored in the database includes: "AAA", "AAB", "BAB", "BAA", and "AB". It can be understood that "AAA" fully matches "AAA", "AAB" fully matches "AAB", and so on. When the search information is "AA", it cannot be fully matched with the above five data, but it partially matches "AAA" and "AAB".
[0044] Optionally, refer to Figure 3 The page is configured with fixed areas and variable areas. Fixed information is displayed in the fixed area. The variable area is used to enter search information. The fixed area can be associated with at least one variable area. The page can also be provided with a display area. The display area is used to display query results that match the search information. For example, in the variable area associated with the fixed information "product", the search information "device" is entered. After the query, the query result displays each data item that includes "device" in the field value corresponding to the "product" field in the target database. Reference Figure 3 , the display area shows the data corresponding to "AA device", "AB device", etc.
[0045] Specifically, the search information includes at least one search data group. Each search data group is composed of a search item and a search value. The search item corresponds to the fixed information, and the search value corresponds to the variable information input in the variable area.
[0046] It is understood that the data types displayed in the display area can be pre-configured. For example, in addition to displaying the name of the product, the product number, the expiration date of the product, etc. can also be displayed.
[0047] Step S204: query the configuration data stored in the local database for reference information corresponding to the search information, and generate request information based on the identification information corresponding to the reference information.
[0048] The local database is a database stored in the terminal. The configuration data stored in the local database is part of the data stored in the target database (i.e., the target data). The local database can be, for example, an indexDB database. That is, the configuration data includes the target data in the target database that is pre-received from the server. Before performing a data query, the configuration data has been pre-saved in the local database. Exemplarily, the terminal maintains a long connection with the server. When the target data in the target database changes, the changed data can be sent to the terminal via the long connection to update the corresponding data in the configuration data. Optionally, all fields in the local database can be indexed to improve the efficiency of queries in the local database.
[0049] The reference information includes at least one record in the local database. Each record includes at least one data item. Each record in the reference information has a data item that matches the search information. Specifically, for a record, a field value corresponding to a field in the record that matches the search item matches a search value in the search information.
[0050] Exemplarily, the fields corresponding to the configuration data include at least one identification field. An identification field is a field used to uniquely identify each record in a database table. The identification information includes the field values corresponding to each identification field in each record. Once reference information corresponding to the search information is found, the identification information corresponding to the reference information can be determined. A request message is then generated based on the identification information. Based on the identification information, the server can determine data matching the search information.
[0051] Optionally, in addition to storing the identification fields, the configuration data also stores the indexes corresponding to the identification fields. In this case, the identification information includes the field values and index values corresponding to each identification field in each record. Based on the identification fields and their corresponding field values and index values, matching data is retrieved from the target database. Combined with indexing technology, this can improve database query speed.
[0052] Understandably, to reduce the burden on terminal data queries, the local database doesn't store data corresponding to all field types. In this case, if the search term in the search information doesn't belong to a field type stored in the local database, the search term and its corresponding search value cannot be matched in the local database. In this case, the search information is directly sent to the target database for querying.
[0053] Step S206: Send the request information to the server, so that the server searches the target database for corresponding query results based on the identification information.
[0054] The request message carries identification information. When performing a fuzzy query, the request message carries at least one identification data set. Each identification data set includes a field value and an index value corresponding to at least one identification field. After receiving the field value and index value corresponding to the identification field, the server can quickly identify matching records in the target database based on the field value and index value corresponding to the identification field.
[0055] It can be understood that when the received identification data group includes field values corresponding to multiple identification fields, in each record in the query results queried from the target database, the field value corresponding to the identification field is the same as the field value corresponding to the corresponding identification field in the identification data group.
[0056] Step S208: Receive and display the query result sent by the server.
[0057] For example, the server sends the query results to the terminal, and after receiving the query results, the terminal displays the query results on a page. The query results can be displayed in the form of a list.
[0058] In the above-mentioned data query method, by obtaining search information, reference information corresponding to the search information is retrieved from the configuration data stored in the local database of the terminal. Then, based on the identification information corresponding to the reference information, a request message is generated. That is, the request message carries the identification information. After receiving the identification information, the server queries the corresponding query result based on the identification information and sends the query result to the terminal for display on the terminal. In this way, the search information can be converted into identification information based on the operating capabilities of the terminal. The process of querying data from the target database based on the identification information can improve the efficiency of the query and reduce the operational pressure of the server querying the target database compared to the process of directly querying data from the target database based on the search information. In addition, the configuration data stored in the terminal is related to the identification information, and data unrelated to the identification information is not stored in the terminal. This can also control the data stored in the terminal within a certain range, thereby ensuring the efficiency of the terminal querying the database.
[0059] In an exemplary embodiment, the local database stores part of the data in the target database, so the search information may include search items that are not stored in the local database. For example, the local database stores personal information and job-related information. If there is a search item that searches for company-related data in the database, then no relevant data can be found in the local database. Therefore, before performing a query operation on the local database, the search items and corresponding search values in the search information that can be searched in the local database can be determined. Figure 4 As shown, the configuration data stored in the local database is searched for reference information corresponding to the search information, and the request information is generated based on the identification information corresponding to the reference information, including steps S402 to S408.
[0060] Step S402: Determine the search item and search value corresponding to the search information.
[0061] It can be understood that search information includes at least one search item and a corresponding search value. For example, the search information is "(Name: Zhou)(Position: Technology)(Remarks: Honorary Title A)." The corresponding search items are: Name, Position, and Remarks. The search value corresponding to the search item "Name" is: Zhou. The search value corresponding to the search item "Position" is: Technology. The search value corresponding to the search item "Remarks" is: Honorary Title A.
[0062] Step S404: determining searchable items from the search items.
[0063] The searchable items belong to the configuration fields corresponding to the configuration data. As mentioned above, some data is stored in the local database. Exemplarily, the terminal compares the search items corresponding to the search information with the configuration fields to determine the searchable items in the search information that belong to the configuration fields.
[0064] For example, if the configuration fields include "name" and "position", the searchable items determined from the search information "(name: Zhou) (position: Technology) (remarks: Honorary Title A)" are "name" and "position".
[0065] Optionally, after building the local database, you can establish an association between the names of search terms on the page and the names of configuration fields in the local database. For example, if the search terms are "name," "position," and "notes," and the configuration fields include "name" and "job," the pre-stored associations can be used to determine that "name" corresponds to the "name" field, and "position" corresponds to the "job" field.
[0066] Step S406: Determine target field data that matches the search value from the searchable field data corresponding to the searchable item in the local database.
[0067] The searchable field data corresponding to the searchable item is data stored in the local database. The searchable field data corresponding to the searchable item is the field data corresponding to the searchable field in the local database. In other words, the searchable item corresponds to the search information, and the searchable field corresponds to the database. It can be understood that the searchable field data is a column of field values corresponding to the searchable item.
[0068] Illustratively, determining target field data that matches a search value includes: comparing searchable field data with the search value, and determining the target field data based on the searchable field data including the search value. For example, the searchable field data includes "AAA," "AAB," "BAB," "BAA," and "AB." The search value is "AA." "AA" is compared with "AAA," "AAB," "BAB," "BAA," and "AB," and the searchable field data including "AA" is determined to be "AAA," "AAB." The target field data is then "AAA," "AAB," and "BAA."
[0069] Step S408: Generate request information based on the identification information corresponding to the target field data.
[0070] Identification information uniquely identifies a record in a database. In the target database, corresponding identification fields are set for some fields. For example, an identification field corresponding to "name" (e.g., the nameid field) is set in the target database. The field value corresponding to the identification field is also stored in the local database.
[0071] Exemplarily, generating the request information based on the identification information corresponding to the target field data includes: obtaining the field value of the identification field corresponding to the target field data from the local database, and generating the request information based on the field value of the identification field. Optionally, the request information includes the field value of the identification field.
[0072] For example, the configuration data stored in the local database is as follows: (001, AAA, job1) (002, AAB, job1) (003, ABA, job2). "001," "002," and "003" are the data items corresponding to the identifier fields in the record. The determined target field data is "AAA" and "AAB." The corresponding determined identifier information is "001" and "002." The generated request information carries "001" and "002."
[0073] In this embodiment, by determining the search term and search value corresponding to the search information, determining the searchable items belonging to the configuration field corresponding to the configuration data from the search term, and determining the target field data that matches the search value from the field data corresponding to the searchable item in the local database, a request message carrying the identification information can be generated based on the identification information corresponding to the target field data. This allows the terminal to query the identification information corresponding to the search information, facilitating subsequent queries of the target database based on the identification information, thereby reducing the query pressure on the server. Furthermore, since the volume of configuration data on the terminal is not large, querying the local database will not cause terminal operation to be slow.
[0074] In actual applications, various types of fields are stored in the database. In order to better distinguish each record and reduce the amount of data stored in the database, the fields can be classified based on the field type. For example, the fields belonging to personal information are summarized as basic data fields, and the field values of the basic data fields corresponding to different people are different. The basic data fields can uniquely identify a record in the database. In this way, in order to improve the query speed, it is not necessary to set each field in the database as a primary key, which can reduce the storage pressure of the database. In response to this situation, in some embodiments, the target field data that matches the search value is determined from the searchable field data corresponding to the searchable item in the local database, including: determining the searchable field corresponding to the searchable item; dividing the searchable field into at least one searchable field set based on the identification field corresponding to the searchable field; determining the target field data set that matches the search value set corresponding to the searchable field set from the searchable field data corresponding to the searchable item in the local database, and generating request information based on at least one identification field corresponding to the target field data set.
[0075] Among them, an identification field is associated with at least one configuration field. When the search information includes multiple searchable fields, and some searchable fields correspond to different identification fields, these searchable fields can be divided into at least one searchable field set. Among them, a searchable field set corresponds to an identification field. A searchable field set includes at least one searchable field and these searchable fields are associated with the same identification field. The field values of the identification field can uniquely identify the corresponding record. For example, the field value is a string of numbers, similar to an ID number.
[0076] After obtaining at least one searchable field set, a corresponding search value set can be obtained. The search term set corresponding to the search value set matches the searchable field set. Then, based on the search value set, a matching target field data set is retrieved from the local database. After determining the target field data set, the corresponding identification fields can be determined. For each target field data item, corresponding request information is generated based on the field value combination of the corresponding identification fields.
[0077] For example, the search items corresponding to the search information include: name, gender, age, department, and length of service. The corresponding search values are: week, male, 2, technology, 1. Among them, name, gender, and age belong to the same category, and length of service and department belong to the same category. The corresponding searchable fields are consistent with the names of the search items. Therefore, two searchable field sets can be divided, namely {name, gender, age} and {length of service, department}. From the field data corresponding to the fields "name, gender, age, department, length of service" in the local database, the target field data that matches {week, male, 2} and {technology, 1} is determined. In other words, when performing data queries, the search value set is used as the matching unit. It can be understood that in each record of the queried target field data, the value of the name field includes week, the value of the gender field includes male, the value of the age field includes 2, the value of the department field includes technology, and the value of the length of service field includes 1. In addition, each record corresponds to two identification fields. For each record, the corresponding identification information is the field values of the two identification fields. Therefore, the obtained identification information includes multiple data sets consisting of the field values of the two identification fields, for example: {(1001, 6789), (1002, 6790), ...}.
[0078] In this embodiment, by dividing the searchable fields into at least one searchable field set, the target field data that matches the corresponding search value set is determined based on the searchable field set. In this way, each record in the database can be matched with multiple search values. Compared with matching on a single field basis, the number of matches can be reduced, thereby improving the efficiency of determining the target field data from the local database.
[0079] It is understood that when the searchable field set corresponding to the searchable field includes only one searchable field, at least one target field data that matches the search value of the search item corresponding to the searchable field can be determined from the field data corresponding to the searchable field in the local database. Request information is then generated based on the field value of the identification field corresponding to each target field data.
[0080] It can be understood that in addition to storing the field data corresponding to the searchable fields, the local database also stores the field data corresponding to the identification fields associated with these searchable fields.
[0081] Furthermore, an index can be established for the identification field in the target database. Index-related information can also be sent to the terminal via the server for storage in the terminal's local database. In this case, request information can be generated based on the field value of the identification field and the corresponding index value, thereby increasing the speed of queries in the target database.
[0082] In some embodiments, the identification field associated with the searchable field may be a parent field to which the searchable field belongs. That is, in the process of acquiring configuration data, in addition to the data corresponding to the selected configuration field, the data corresponding to the parent field to which the configuration field belongs is also added. Exemplarily, based on the identification field corresponding to the searchable field, the searchable field is divided into at least one searchable field set, including: determining the parent field to which the searchable field belongs; dividing the searchable field into at least one searchable field set based on the parent field; each searchable field set includes at least one field; and different searchable field sets correspond to different types of parent fields.
[0083] In this embodiment, by using the parent field to which the field belongs as the identification field, the query operation can be simplified by associating the parent fields in subsequent queries without constructing complex query statements, thereby improving query efficiency.
[0084] The above content describes the query process corresponding to the searchable items determined from the search items. In actual applications, there are some search items that are not stored in the local database. For such non-searchable items, the search data corresponding to the non-searchable items can be directly sent to the server to perform related searches based on the server. In some embodiments, the search items include both searchable items and non-searchable items. Therefore, after determining the search items and search values corresponding to the search information, the non-searchable items and the corresponding search data are determined from the search items, and the non-searchable items do not belong to the configuration fields; based on the identification information corresponding to the search data and the target field data, a request information is generated; the request information is sent to the server, so that the server performs a first type of query on the target database based on the search data to obtain a first query result, and the server performs a second type of query on the target database based on the field data corresponding to the searchable field in the target field data to obtain a second query result, and the query result is determined based on the first query result and the second query result; the query result sent by the server is received and displayed.
[0085] The first type of query may be a fuzzy query. For example, a query may be performed using the like operator in conjunction with search data. The second type of query may be a set query. Since there may be multiple records matching the fuzzy information, there may also be multiple field values corresponding to the identification field sent to the server. In this case, the in operator can be used to perform the query. It can be understood that the query result is the union of the first query result and the second query result. In the actual query process, the query statement is directly constructed by combining the unsearchable items and the corresponding search data and identification information to obtain the query result.
[0086] In this embodiment, by performing fuzzy query on non-searchable items in the search information and performing precise query on searchable items, the query speed can be improved and the query pressure on the server side can be reduced compared to performing fuzzy query directly based on the search information.
[0087] In actual applications, while it is possible to pre-determine the corresponding identification information from a local database, which facilitates the server's acquisition of results matching the search information from the target database based on the identification information, if the amount of identification information sent by the terminal to the server exceeds a preset value, this may affect communication efficiency between the two terminals, resulting in slow query speeds. Therefore, before generating a request message based on the identification information corresponding to the reference information, if the amount of reference information obtained from the query exceeds a preset amount, a request message is generated based on the search information and sent to the server, causing the server to perform a first-type query on the target database.
[0088] For example, the reference information corresponding to the search information retrieved includes 1001 records. The preset information volume sets the upper limit of the number of records corresponding to the reference information at 1000. In this case, it is determined that the reference information retrieved by the query exceeds the preset information volume. To ensure normal communication between the terminal and the server and reduce slow interaction between the two ends due to excessive data transmission, a request message is directly generated based on the search information and sent to the server, causing the server to perform a fuzzy query on the target database based on the search information.
[0089] In this embodiment, by making a relevant judgment on the amount of reference information, when the amount of information is too much, fuzzy information is sent to perform a fuzzy search on the server side, thereby reducing the phenomenon of slow query speed caused by transmitting too much data.
[0090] In an exemplary embodiment, in order to reduce the pressure on the server to perform data query and improve the efficiency of data query, Figure 5 As shown, the following steps can be performed:
[0091] First, the terminal can obtain search information. For example, after the user enters the page and enters the search keyword on the page, the search information can be obtained after clicking the search button on the page. Figure 5 If the front-end search function is enabled in the terminal, front-end search can be performed. If the front-end search function is disabled in the terminal, only back-end search can be performed. By setting the switch, the operability of the data query system can be improved.
[0092] Next, the terminal determines a search term and a search value corresponding to the search information, determines a searchable term from the search term, and determines a searchable field corresponding to the searchable term, wherein the searchable term belongs to a configuration field corresponding to the configuration data.
[0093] If the search item belongs to a configuration field, determine the parent field to which the searchable field belongs, and based on the parent field, divide the searchable field into at least one searchable field set. From the searchable field data corresponding to the searchable item in the local database, determine the target field data that matches the search value set corresponding to the searchable field set, and generate request information based on at least one identification field corresponding to the target field data.
[0094] In practical applications, the number of search terms in the search information can be determined first. If there is only one search term, a single-field search branch can be executed. Within the basic data field (i.e., the parent field) corresponding to the search term, the field information and the unique identifier ID of the basic data are retrieved. This information is then combined to create new data that is then used to match the user-entered keyword. The IDs of all basic data matching the search term's search value are obtained. The relevant index query identifier can then be sent to the server. If there are multiple search terms, a full-field search branch can be executed. Essentially, the full-field search branch differs from the full-field search branch in that the full-field search branch additionally categorizes the searchable fields corresponding to the search terms, allowing search values corresponding to search terms belonging to the same category to be queried as a single entity in the local database. This means that the searched fields on the terminal must be distinguished between fields belonging to the same basic data field, and searchable fields belonging to the same basic data field are combined into a single data set. Ultimately, the search results (i.e., identification information) for the full search contain the IDs of one or more basic data types. This reduces the number of local matches and improves local query speed.
[0095] Optionally, after querying the local database and obtaining reference information, if the reference information obtained exceeds a preset amount of information, a request message is generated based on the search information and sent to the server, causing the server to perform a first type of query on the target database, i.e., a like search. If the amount of information does not exceed the preset amount, an in search may be performed.
[0096] In addition, in the all-field search branch, the search items may include search items that do not belong to the configured fields. In this case, the unsearchable items and the corresponding search data can be determined from the search items, and the unsearchable items do not belong to the configured fields; based on the identification information corresponding to the search data and the target field data, a request message is generated; the request message is sent to the server, so that the server performs a first type of query on the target database based on the search data to obtain a first query result, and the server performs a second type of query on the target database based on the field data corresponding to the searchable fields in the target field data to obtain a second query result, and the query result is determined based on the first query result and the second query result; the query result sent by the server is received and displayed. In other words, the request parameters for all searches will be composed of multiple situations: there is no end-side search field, and all fields are fuzzy searched; the end-side search field and the cloud search field coexist, and the original request parameters are split into two parts: the end-side fields are divided into basic data types and index query identifiers are added, and the fuzzy query remains unchanged; if all are end-side search fields, the index query identifiers are directly added according to the basic data types.
[0097] Taking the procurement field as an example, sub-user A adds a product named test112002 in the browser of terminal A and clicks Save (refer to Figure 6 After saving, the information of product test112002 will be sent to the server via terminal A, and a new record matching product test112002 will be added to the server's database. Terminal B of primary user B maintains a persistent connection with the server. When the configuration data in the server changes, the corresponding changed data is sent to terminal B and stored in the database of terminal B to ensure data consistency and accuracy. Figure 7 After user A adds the product test112002, terminal B will receive a notification about the newly added product test112002. When user B confirms, terminal B will store the relevant data of product test112002 (refer to Figure 8 After adding product test112002, user A can continue to add purchase requisition records for the product test112002. Main user B queries and approves purchase requisition records submitted by each sub-user on Terminal B. When main user B enters a purchase order with the search information test112002 in the purchase order list displayed on Terminal B, Terminal B searches the local database for the identification information corresponding to test112002. A request message carrying the identification information is sent to the server, allowing the server to perform a query based on the identification information. Figure 9 , the value corresponding to "frontValue" in the request information is the identification information, and the value corresponding to "Compare" is the query type ( Figure 9 (This is the second type of query)
[0098] Alternatively, as Figure 5 As shown, in this embodiment, after determining that the search term is an unsearchable term, it is further determined whether the unsearchable term is a document code. If it is a document code, the second type of query can be performed. If it is not a document code, the first type of query can be performed.
[0099] In simple terms, for example, refer to Figure 10 After a user enters a search keyword on a terminal, the terminal searches the browser cache and converts the search keyword into an index ID on the server. It then constructs a request parameter based on the index ID, requesting the server to search based on the index ID. The server constructs a search statement based on the index ID and retrieves the query results from the data server. The terminal receives the query results returned by the server and displays them.
[0100] In this embodiment, the user enters a search keyword, and the browser queries the local database to obtain the ID of some basic information. This ID is used as a parameter to request a search in the cloud, allowing the cloud database to search for information using the ID as an index. This allows the terminal to utilize the resources of the terminal and organize the searched information into an index in the cloud database, greatly reducing the pressure on the cloud database and improving the query speed.
[0101] It should be understood that, although the steps in the flowcharts of the above embodiments are shown in sequence as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the flowcharts of the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily to be performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0102] Based on the same inventive concept, embodiments of the present application also provide a data query device for implementing the aforementioned data query method. The implementation solution provided by this device is similar to the implementation solution described in the aforementioned method. Therefore, the specific limitations of one or more data query device embodiments provided below can be found in the above-mentioned limitations of the data query method and will not be repeated here.
[0103] In an exemplary embodiment, Figure 11 As shown, a data query device 1100 is provided, comprising: an acquisition module 1101, a query module 1102, a communication module 1103 and a display module 1104, wherein:
[0104] Acquisition module 1101, used to acquire search information;
[0105] A query module 1102 is configured to query the configuration data stored in the local database for reference information corresponding to the search information, and generate request information based on identification information corresponding to the reference information;
[0106] Communication module 1103, configured to send the request information to the server, so that the server can query the target database for the corresponding query result based on the identification information, wherein the configuration data includes the target data in the target database received in advance from the server, and the configuration data is used to be pre-stored in the local database;
[0107] The display module 1104 is configured to receive and display the query result sent by the server.
[0108] In some embodiments, in querying reference information corresponding to the search information from the configuration data stored in the local database, and generating request information based on identification information corresponding to the reference information, the query module 1102 is also used to: determine the search terms and search values corresponding to the search information; determine searchable items from the search terms, the searchable items belonging to the configuration fields corresponding to the configuration data; determine target field data that matches the search value from the searchable field data corresponding to the searchable items in the local database; and generate request information based on identification information corresponding to the target field data.
[0109] In some embodiments, in terms of determining target field data that matches the search value from the searchable field data corresponding to the searchable item in the local database, and generating request information based on the identification information corresponding to the target field data, the query module 1102 is also used to: determine the searchable field corresponding to the searchable item; divide the searchable field into at least one searchable field set based on the identification field corresponding to the searchable field; determine target field data that matches the search value set corresponding to the searchable field set from the searchable field data corresponding to the searchable item in the local database; and generate request information based on at least one identification field corresponding to the target field data.
[0110] In some embodiments, in terms of dividing the searchable fields into at least one searchable field set based on the identification fields corresponding to the searchable fields, the query module 1102 is also used to: determine the parent field to which the searchable field belongs; based on the parent field, divide the searchable fields into at least one searchable field set; each searchable field set includes at least one field; different searchable field sets correspond to different types of parent fields.
[0111] In some embodiments, after determining the search terms and search values corresponding to the search information, the data query device is also used to: determine unsearchable items and corresponding search data from the search terms, where the unsearchable items do not belong to the configuration fields; generate request information based on identification information corresponding to the search data and the target field data; send the request information to the server, so that the server performs a first type of query on the target database based on the search data to obtain a first query result, and the server performs a second type of query on the target database based on the field data corresponding to the searchable field in the target field data to obtain a second query result, and determines the query result based on the first query result and the second query result; receives and displays the query result sent by the server.
[0112] In some embodiments, before generating request information based on identification information corresponding to the reference information, the data query device is also used to: if the reference information obtained by the query exceeds the preset amount of information, generate request information based on the search information, and send the request information to the server, so that the server performs a first type of query on the target database.
[0113] Each module in the above-mentioned data query device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.
[0114] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 12 As shown. The computer device includes a processor, memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals via wired or wireless means, and the wireless means can be implemented via Wi-Fi, a mobile cellular network, near-field communication (NFC), or other technologies. When executed by the processor, the computer program implements a data query method. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse.
[0115] Those skilled in the art will understand that Figure 12 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0116] In an exemplary embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.
[0117] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0118] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in each of the above-described method embodiments. It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, and displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of the relevant data must comply with relevant regulations.
[0119] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. In particular, any reference to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile memory 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 various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the various embodiments provided herein may be, but are not limited to, general-purpose processors, central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), programmable logic devices (PLDs), quantum computing-based data processing logic devices, artificial intelligence (AI) processors, and the like.
[0120] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, 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 application.
[0121] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A data query method, characterized in that: The method comprises: Get search information; Querying the configuration data stored in the local database for reference information corresponding to the search information, and generating request information based on identification information corresponding to the reference information; Sending the request information to a server, so that the server queries a target database for a corresponding query result based on the identification information, wherein the configuration data includes target data in the target database received in advance from the server, and the configuration data is used to be pre-stored in the local database; Receive and display the query result sent by the server.
2. The method according to claim 1, characterized in that The step of searching for reference information corresponding to the search information from configuration data stored in the local database and generating request information based on identification information corresponding to the reference information includes: Determining a search term and a search value corresponding to the search information; determining a searchable item from the search items, where the searchable item belongs to a configuration field corresponding to the configuration data; Target field data matching the search value is determined from the searchable field data corresponding to the searchable item in the local database, and the request information is generated based on identification information corresponding to the target field data.
3. The method according to claim 2, characterized in that The step of determining target field data matching the search value from the searchable field data corresponding to the searchable item in the local database, and generating the request information based on identification information corresponding to the target field data, includes: Determining a searchable field corresponding to the searchable item; Dividing the searchable fields into at least one searchable field set based on identification fields corresponding to the searchable fields; Determining, from the searchable field data corresponding to the searchable item in the local database, target field data that matches the search value set corresponding to the searchable field set; The request information is generated based on at least one identification field corresponding to the target field data.
4. The method according to claim 3, characterized in that The dividing the searchable fields into at least one searchable field set based on the identification fields corresponding to the searchable fields includes: Determining the parent field to which the searchable field belongs; Based on the parent field, the searchable field is divided into at least one searchable field set; each searchable field set includes at least one field; different searchable field sets correspond to different types of the parent field.
5. The method according to claim 2, characterized in that After determining the search term and search value corresponding to the search information, the method further includes: determining an unsearchable item and corresponding search data from the search items, the unsearchable item not belonging to the configuration field; Generate request information based on the search data and identification information corresponding to the target field data; Sending the request information to the server, so that the server performs a first type of query on the target database based on the search data to obtain a first query result, and the server performs a second type of query on the target database based on the field data corresponding to the searchable field in the target field data to obtain a second query result, and determining the query result based on the first query result and the second query result; Receive and display the query result sent by the server.
6. The method according to claim 1, characterized in that Before generating the request information based on the identification information corresponding to the reference information, the method further includes: If the reference information obtained by the query exceeds a preset amount of information, the request information is generated based on the search information, and the request information is sent to the server, so that the server performs a first type of query on the target database.
7. A data query device, characterized in that: The device comprises: Acquisition module, used to obtain search information; a query module, configured to query reference information corresponding to the search information from configuration data stored in a local database, and generate request information based on identification information corresponding to the reference information; a communication module, configured to send the request information to a server, so that the server queries a target database for a corresponding query result based on the identification information, wherein the configuration data includes target data in the target database received in advance from the server, and the configuration data is used to be pre-stored in the local database; The display module is used to receive and display the query result sent by the server.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Information query method and device
CN110162543A
Data retrieval method and device for offline application, computer equipment and storage medium
CN112347337A
Data caching method and system based on web browser and storage medium
CN115442438A
Data query method and device, electronic equipment and storage medium
CN119441284A
User interface and method in a local search system with multiple-field comparison
US20090132645A1