Data retrieval method, system and equipment and medium

Through pre-constructed search models and search templates, the data retrieval and sorting logic is unified and standardized, and the problem of low data retrieval and development in the software system is solved, and efficient data retrieval and sorting development is achieved.

CN119025611APending Publication Date: 2024-11-26DEEP BLUE RUIZHI (HANGZHOU) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410871150.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-01
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

The data retrieval and sorting development in the software system is inefficient, which leads to the client and the server need to design and develop data retrieval interfaces and interfaces separately, which takes a lot of time.

Method used

Create a search model instance through a pre-built search model, including search conditions and search sorting instances, the client parses and obtains the search template, the user inputs the search parameters, the server checks and generates the target search instance for searching, realizing data retrieval and sorting logic unified and standardized.

Benefits of technology

It reduces the need for clients and servers to design and develop interfaces and logic for each data retrieval, improves the efficiency and accuracy of data retrieval and development, and reduces the maintenance costs and the risk of system abnormalities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119025611A_ABST
    Figure CN119025611A_ABST
Patent Text Reader

Abstract

The invention relates to a data retrieval method, system and device and a medium, and the method comprises the steps: receiving a retrieval request in response to a server, and creating an initial retrieval condition instance and an initial retrieval sorting instance according to the retrieval request; according to a pre-constructed retrieval model, verifying the initial retrieval condition instance and the initial retrieval sorting instance, and obtaining a target retrieval condition instance and a target retrieval sorting instance which pass verification; the client analyzes the target retrieval condition instance and the target retrieval sorting instance to obtain a retrieval template comprising a retrieval condition and a retrieval sorting; and responding to the retrieval parameter received by the client, generating a retrieval parameter instance based on the retrieval template, and performing retrieval based on the retrieval parameter instance to obtain a retrieval result. According to the method, interfaces and retrieval logics are designed and developed for data retrieval without needing a client side and a server side. The problem of low efficiency of data retrieval and development in related technologies is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data retrieval, and in particular to a data retrieval method, system, device and medium. Background Art

[0002] The software system development process involves a large number of data retrieval and sorting functions. Each type of data retrieval and sorting requires a lot of time on the retrieval interface, interface, data format design, development and testing. In the era of big data, each software system has a variety of data to display, and each data display interface requires data retrieval, sorting and display.

[0003] However, in various software systems, data retrieval and sorting interfaces, retrieval conditions and sorting and interfaces are currently designed and developed separately on the client and server sides, which consumes a lot of time and has low development efficiency.

[0004] Therefore, there is a problem of low efficiency in data retrieval development in current related technologies. Summary of the invention

[0005] The embodiments of the present application provide a data retrieval method, system, device and medium to at least solve the problem of low efficiency in data retrieval development in the related art.

[0006] In a first aspect, an embodiment of the present application provides a data retrieval method, the method comprising:

[0007] Creating a retrieval model instance according to a pre-built retrieval model, wherein the retrieval model instance includes a retrieval condition instance and a retrieval ranking instance;

[0008] In response to a request from a client to obtain the retrieval model instance, the client parses the retrieval condition instance and the retrieval ranking instance to obtain a retrieval template including the retrieval condition and the retrieval ranking;

[0009] In response to the user's search request, the client obtains the search parameter instance input by the user through the search condition and sorting component, wherein the search parameter instance includes the condition parameter instance and the sorting parameter instance.

[0010] The server responds to receiving the client's search request, verifies the search parameter instance according to the search model, and obtains a target search instance that passes the verification; the target search instance includes a target condition instance and a target search ranking instance;

[0011] The server performs a search based on the target search instance to obtain a search result.

[0012] In one embodiment, the client parses the target search condition instance and the target search ranking instance to obtain a search template including the search condition and the search ranking;

[0013] Parsing the target retrieval condition instance and the target retrieval sorting instance through the parsing model to obtain the field name, field type, optional value, comparison action of the retrieval condition data structure and the field name and sorting action of the retrieval sorting data structure;

[0014] Through the component generator, based on the field name, field type, optional value, comparison action of the retrieval condition data structure and the field name and sorting action of the retrieval sorting data structure, a retrieval template including retrieval conditions and retrieval sorting is obtained.

[0015] In one embodiment, the pre-built retrieval model includes a retrieval condition model and a retrieval ranking model;

[0016] The search condition model is used to define search condition instances and determine search requests that meet the preset search conditions;

[0017] The search ranking model is used to define a search ranking instance and determine a search request that meets the preset search ranking. In one embodiment, the step of verifying the search parameter instance according to the search model and obtaining a target search instance that passes the verification includes:

[0018] Determine whether the field name, type and comparison action in the condition parameter instance conform to the preset search condition in the search model;

[0019] When the preset search condition is met, obtaining a target condition instance;

[0020] Determine whether the field name and sorting action in the sorting parameter instance conform to the preset search sorting in the search model;

[0021] In the case of meeting the preset search ranking, a target ranking instance is obtained.

[0022] In one embodiment, the comparison action represents a search condition comparison, and the comparison action includes equal to, not equal to, less than, less than or equal to, greater than, greater than or equal to, contains, does not contain, is in a list, is not in a list;

[0023] The sorting action represents searching for a positive or negative order condition.

[0024] In one embodiment, in response to a user search request, the client obtains a search parameter instance input by the user through a search condition and a sorting component, wherein the search parameter instance includes a condition parameter instance and a sorting parameter instance, including:

[0025] The search request is parsed, and a condition parameter instance and a sort parameter instance are obtained respectively through the search condition and the sort component, wherein the condition parameter instance includes a field name, a comparison action and a value, and the sort parameter instance includes a field name and a sort action.

[0026] Condition parameter example Sorting parameter example Condition parameter example Sorting parameter example Condition parameter example Sorting parameter example

[0027] In one embodiment, the parsing of the search request and obtaining the condition parameter instance and the sorting parameter instance respectively through the search condition and the sorting component includes: based on the search parameter, obtaining the parameter instance and the sorting parameter instance through the parameter generator and the search template.

[0028] In a second aspect, the system includes a retrieval model instance creation module, a retrieval template module, a retrieval parameter instance module, a target retrieval instance module and a retrieval result module, wherein:

[0029] The retrieval model instance creation module is used to create a retrieval model instance according to a pre-built retrieval model, wherein the retrieval model instance includes a retrieval condition instance and a retrieval ranking instance;

[0030] The retrieval template module is used to respond to a request from a client to obtain the retrieval model instance, the client parsing the retrieval condition instance and the retrieval ranking instance, and obtaining a retrieval template including the retrieval condition and the retrieval ranking;

[0031] The retrieval parameter instance module is used to respond to the user's retrieval request. The client obtains the retrieval parameter instance input by the user through the retrieval condition and sorting component. The retrieval parameter instance includes a condition parameter instance and a sorting parameter instance.

[0032] The target retrieval instance module is used for the server to respond to the client retrieval request, verify the retrieval parameter instance according to the retrieval model, and obtain the target retrieval instance that passes the verification; the target retrieval instance includes a target condition instance and a target retrieval ranking instance;

[0033] The retrieval result module is used by the server to perform retrieval based on the target retrieval instance and obtain retrieval results.

[0034] In a third aspect, an embodiment of the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, a data retrieval method as described in the first aspect above is implemented.

[0035] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a data retrieval method as described in the first aspect above.

[0036] A data retrieval method, system, device and medium provided by the embodiments of the present application have at least the following technical effects.

[0037] In response to receiving a retrieval request from the server, a retrieval model instance is created according to a pre-built retrieval model, and the retrieval model instance includes a retrieval condition instance and a retrieval sorting instance; in response to a request from a client to obtain a retrieval model instance, the client parses the retrieval condition instance and the retrieval sorting instance, and obtains a retrieval template including the retrieval condition and the retrieval sorting instance; in response to a user retrieval request, the client obtains a retrieval parameter instance input by the user through the retrieval condition and sorting components, and the retrieval parameter instance includes a condition parameter instance and a sorting parameter instance; the server responds to receiving the client retrieval request, verifies the retrieval parameter instance according to the retrieval model, and obtains a target retrieval instance that passes the verification; the target retrieval instance includes a target condition instance and a target retrieval sorting instance; the server performs a retrieval based on the target retrieval instance, and obtains the retrieval result, so that the client and the server do not need to design and develop interfaces and retrieval logic for each data retrieval. The problem of low efficiency in data retrieval development in related technologies is solved.

[0038] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0040] Figure 1 is a flow chart of a data retrieval method;

[0041] Figure 2 is a flowchart of obtaining a target retrieval instance according to an exemplary embodiment;

[0042] Figure 3 is a flowchart of obtaining a search template according to an exemplary embodiment;

[0043] Figure 4 is a structural block diagram of a data retrieval system according to an exemplary embodiment;

[0044] Figure 5 It is a structural block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0046] Obviously, the drawings described below are only some examples or embodiments of the present application. For ordinary technicians in this field, the present application can also be applied to other similar scenarios based on these drawings without creative work. In addition, it can also be understood that although the efforts made in this development process may be complicated and lengthy, for ordinary technicians in this field related to the content disclosed in this application, some changes in design, manufacturing or production based on the technical content disclosed in this application are just conventional technical means, and should not be understood as insufficient content disclosed in this application.

[0047] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.

[0048] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantitative limitation, and may represent the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.

[0049] In a first aspect, an embodiment of the present application provides a data retrieval method. Figure 1 is a flow chart of a data retrieval method, such as Figure 1 As shown, a data retrieval method includes:

[0050] Step S101: Create a retrieval model instance according to a pre-built retrieval model. The retrieval model instance includes a retrieval condition instance and a retrieval ranking instance.

[0051] Step S102: In response to the client's request to obtain a retrieval model instance, the client parses the retrieval condition instance and the retrieval ranking instance to obtain a retrieval template including the retrieval condition and the retrieval ranking.

[0052] Step S103: In response to the user's search request, the client obtains the search parameter instance input by the user through the search condition and sorting component. The search parameter instance includes a condition parameter instance and a sorting parameter instance.

[0053] Step S104, the server responds to the received search request from the client, verifies the search parameter instance according to the search model, and obtains the target search instance that passes the verification; the target search instance includes the target condition instance and the target search sort instance.

[0054] Step S105: The server performs a search based on the target search instance to obtain a search result.

[0055] In summary, the data retrieval method provided by the embodiment of the present application is to create a retrieval model instance according to a pre-built retrieval model in response to a retrieval request received by the server, and the retrieval model instance includes a retrieval condition instance and a retrieval sorting instance; in response to a request from a client to obtain a retrieval model instance, the client parses the retrieval condition instance and the retrieval sorting instance, and obtains a retrieval template including the retrieval condition and the retrieval sorting instance; in response to a user retrieval request, the client obtains a retrieval parameter instance input by the user through the retrieval condition and sorting components, and the retrieval parameter instance includes a condition parameter instance and a sorting parameter instance; the server responds to receiving the client retrieval request, verifies the retrieval parameter instance according to the retrieval model, and obtains a target retrieval instance that passes the verification; the target retrieval instance includes a target condition instance and a target retrieval sorting instance; the server performs retrieval based on the target retrieval instance, and obtains the retrieval result, so that the client and the server do not need to design and develop interfaces and retrieval logic for each data retrieval. The problem of low efficiency in data retrieval development in the related art is solved.

[0056] In one embodiment, in response to a user search request, the client obtains a search parameter instance input by the user through a search condition and a sorting component, and the search parameter instance includes a condition parameter instance and a sorting parameter instance. Specifically, it includes:

[0057] Parse the search request and obtain the condition parameter instance and the sort parameter instance based on the pre-built search model, wherein the condition parameter instance includes the field name, comparison action and value, and the sort parameter instance includes the field name and sort action.

[0058] Optionally, the server parses the parameters in the HTTP request received from the client. The parameters include the search field, comparison action, and corresponding value selected by the user. And according to the pre-built search model, the condition parameter instance and sort parameter instance are obtained respectively. For example, if the user wants to find products whose product names contain "apple", the server will parse the condition parameter instance with productName as the field name, ic as the comparison action, and "apple" as the value. The server also parses the sort parameter in the request, where the parameters include the field name selected by the user and the sort action. For example, the user may request to sort in descending order by amount. Create a sort object representing "descending order by amount".

[0059] By responding to user search requests, the client obtains the search parameter instance input by the user through the search condition and sorting components. The search parameter instance includes a condition parameter instance and a sorting parameter instance. It can flexibly create search conditions and search sorting instances according to the user's specific search request, thereby improving the search accuracy and efficiency.

[0060] In one embodiment, the pre-built retrieval model includes a retrieval condition model and a retrieval ranking model;

[0061] A search condition model is used to define search condition instances and determine search requests that meet the preset search conditions;

[0062] The search ranking model is used to define search ranking instances and determine search requests that meet the preset search ranking.

[0063] Optionally, the retrieval model includes a retrieval condition model and a retrieval ranking model, and the retrieval model is used for retrieval and sorting rules, ranges, formats, etc. The server program and the client program design the program logic according to the specifications of the retrieval model; the server program and the client program follow the specifications of the same retrieval model. Among them, the retrieval condition model is used to select the retrieval field and retrieval method, including field name, data type, optional value, and comparison action. The retrieval ranking model is used to select the sorting field and sorting method, including field name and sorting action. When a retrieval request is received, the retrieval condition model is used to determine the retrieval request that meets the preset retrieval condition. The retrieval ranking model is used to determine the retrieval request that meets the preset retrieval ranking. It is worth noting that the retrieval model is a set of rules, formats or procedures; you can pre-create or define retrieval model instances based on the retrieval model (the conditions and sorting for retrieving certain data, where the conditions and sorting refer to what fields are allowed to be used for retrieval or sorting, and define the field type, range, retrieval action, etc.), if retrieving student data is a retrieval instance, retrieving student grades is a retrieval instance,...; you can also verify the retrieval conditions requested by the user based on the retrieval model, that is, verify whether the retrieval conditions requested by the user comply with the model rules, such as whether the field is allowed to be retrieved, whether the type is correct, whether the range is correct, whether the retrieval action is within the allowed range, etc.

[0064] Through the pre-built retrieval model including the retrieval condition model and the retrieval ranking model, the retrieval model instance (such as the initial retrieval condition instance and the initial retrieval ranking instance) can be pre-created or defined according to the retrieval model, which can filter out the retrieval requests that meet the retrieval conditions and retrieval ranking, and make the server and the client follow the same set of retrieval model specifications (i.e., the retrieval model), thereby ensuring the consistency of data retrieval and sorting logic, reducing errors caused by misunderstandings, and improving the reliability and stability of the system.

[0065] Figure 2 is a flowchart of obtaining a target retrieval instance according to an exemplary embodiment. Figure 2 As shown, according to the retrieval model, the retrieval parameter instance is verified, and the target retrieval instance that passes the verification is obtained. Specifically, the following steps are included:

[0066] Step S1021: Determine whether the field name, type and comparison action in the condition parameter instance conform to the preset search conditions in the search model.

[0067] Step S1022: When the preset search conditions are met, obtain the target condition instance.

[0068] Step S1023: determine whether the field name and sorting action in the sorting parameter instance conform to the preset search sorting in the search model.

[0069] Step S1024: When the preset search ranking is met, obtain the target ranking instance.

[0070] Optionally, determine whether the field name, type and comparison action in the condition parameter instance conform to the preset search condition in the retrieval model, wherein the preset search condition includes the standard field name, type and comparison action. It should be noted that not only the field name, type and comparison action are verified, but also whether the field value conforms to the preset data format and range requirements, such as the correctness of the date format, the rationality of the numerical range, etc. The condition parameter instance that conforms to the preset search condition is obtained as the target condition instance. Determine whether the field name and sorting action in the sorting parameter instance conform to the preset search sort in the retrieval model, wherein the preset search sort includes the standard or correct field name and sorting action. Obtain the sorting parameter instance that conforms to the preset search sort as the target sorting instance. In addition, it is also possible to determine whether there are duplications in the field name, type, and comparison condition in the condition parameter instance, and whether there are logical errors in the field name, type, and comparison condition in the condition parameter instance. If there are duplications or logic, an error is prompted.

[0071] According to the retrieval model, the retrieval parameter instance is verified, and the target retrieval instance that passes the verification is obtained. This ensures that all retrieval requests meet the specifications and reduces system anomalies caused by erroneous requests.

[0072] In one embodiment, the search field name is the name of the data field used for retrieval, such as product name (productName), age (age), etc. The search field type is the data type of the data field used for retrieval, and the search field types include string, integer, floating point number, date, time, Boolean type, enumeration type, etc. It can also be represented by string, int, float, date, time, boolean, enum, etc. The server can limit the comparison action for each search field, and not every search field supports all comparison actions. For example, it is stipulated that the comparison actions supported by the product name (productName) include equal, contain and do not contain, and other comparison actions are not supported. The sorting search field name is the name of the data field that can be used for sorting, such as amount (amount), order time (orderTime), star rating (rating). By determining the search field name, type and supported comparison actions, and specifying the fields that can be used for sorting, the accuracy, efficiency and security of data retrieval are improved, and the user experience is also improved.

[0073] In one embodiment, the comparison action represents the comparison of search conditions, and the comparison actions include equal to, not equal to, less than, less than or equal to, greater than, greater than or equal to, contain, not contain, in the list, and not in the list; the sorting action represents the search conditions in positive or reverse order.

[0074] Optionally, the comparison action is a conditional comparison for retrieval, including equal to, not equal to, less than, less than or equal to, greater than, greater than or equal to, contained, not contained, in a list, not in a list, etc. In this implementation, eq, ne, lt, le, gt, ge, ic, ni, in, and nin are used to represent them respectively. The sorting action represents ascending or descending order, and is used in conjunction with the sorting field name, such as sorting by amount in descending order or by order time in ascending order. Some instances use + or - to represent ascending or descending order, respectively. It is worth noting that the sorting action is not involved in the retrieval model of some instances, to indicate that the sorting of the field is not restricted to ascending or descending order. By defining the comparison action and the sorting action in detail, not only the functionality, usability, and efficiency of the retrieval system are improved,

[0075] Figure 3 is a flowchart of obtaining a search template according to an exemplary embodiment. Figure 3 As shown, the client parses the target retrieval condition instance and the target retrieval ranking instance to obtain a retrieval template including the retrieval condition and the retrieval ranking.

[0076] S1031. Parse the target search condition instance and the target search sort instance through the parsing model to obtain the field name, field type, optional value, comparison action of the search condition data structure and the field name and sort action of the search sort data structure.

[0077] S1032. Obtain a search template including search conditions and search sorts through a component generator based on the field name, field type, optional value, comparison action of the search condition data structure and the field name and sorting action of the search sort data structure.

[0078] Optionally, the target retrieval condition instance and the target retrieval sorting instance are parsed by the parsing model to determine the fields or attributes involved in the specific retrieval of the query, and identify the data type of each field, such as string, integer, date, etc. If applicable, extract the value or value range allowed for a specific field. Determine each comparison action, such as equal to, not equal to, greater than, less than, etc. Determine which fields (field name, sorting action) are used for sorting and the direction of sorting, such as ascending by creation time or descending by score. Using the field name, field type, optional value, comparison action and field name and sorting action of the retrieval sorting data structure, the component generator is combined with the parsing results to render the user interaction control in the corresponding component library to the user interface. Specifically, the user interface component is dynamically created according to the component generator. For example, a text input box is generated for a text field, a drop-down menu is generated for a field of an enumeration type, corresponding operator selections (such as equal to, greater than, etc.) are added according to the comparison action, and corresponding buttons or options are set for sorting. Through the component generator, combined with the parsing results, an interactive retrieval template is generated, and the user can directly enter the query condition on this template, select the sorting method, and then submit the query request. By parsing the target retrieval condition instance and the target retrieval sort instance, a retrieval template is generated, which can adapt to different data models and changes in query requirements without manually modifying the front-end code, greatly reducing maintenance costs.

[0079] In one embodiment, the server responds to receiving a search request from the client, verifies the search parameter instance according to the search model, obtains a target search instance that passes the verification, and performs a search based on the target search instance to obtain a search result, specifically including:

[0080] Based on the search parameters, a search parameter instance is generated through a parameter generator and a search template. Search is performed based on the search parameter instance to obtain search results.

[0081] Optionally, the program parameter generator generates conditional instances according to a conditional model. A conditional instance contains multiple conditional instance items, and each conditional instance item consists of a retrieval field name, a comparison action, and a comparison value defined by the conditional model. Some instances form a conditional instance item by connecting the retrieval field name and the comparison action with a double underscore "__", and then connecting it with the comparison value using an equal sign "=". Multiple conditional instance items are connected with "&" to form the entire conditional instance. For example, productName__ic=apple&amount__gt=20 represents data where the product name (productName) contains "apple" and the amount (amount) is greater than 20. In addition, "or" or parentheses are also supported to support more complex combinations of conditional instance items. The parameter generator generates sorting instances according to a sorting model. A sorting instance contains one or more sorting instance items, and each sorting instance item consists of a sorting action and a sorting field name. "orderTime" or "+orderTime" can be used to represent ascending sorting by order time, and "-rating" can be used to represent descending sorting by star rating.

[0082] After the user fills in specific query conditions (such as keywords, date range, category selection, etc.) and sorting requirements on the generated retrieval template, the client collects this information as retrieval parameters. Generate a retrieval parameter instance: Create a retrieval parameter instance based on the retrieval conditions and sorting options input by the user. It contains all the necessary information for the query, such as field names, corresponding values, comparison operators, and sorting instructions, etc. Pass the retrieval parameter instance to the server side. The server side constructs a retrieval program according to the retrieval parameters (such as constructing an SQL query statement, or other query languages, depending on the data retrieval program, database, and search engine used), executes the query operation, and retrieves matching records from the database. After the query is completed, the server side organizes the retrieved data into a suitable data structure (such as a list, dictionary, etc.) and returns it to the client side. This realizes a fast query of the retrieval request and improves the retrieval efficiency.

[0083] In one example, the server program defines a retrieval model instance for each data type through the definition module in the retrieval model; designs and implements interface parameters through the interface module; matches and verifies the parameters and model definitions through the data verification module; and converts the parameters into an executable retrieval program through the data conversion module. The interface module includes an interface for obtaining model instances and a data retrieval interface. The interface for obtaining model instances returns the retrieval model instance of a specific data type defined by the server to the client, and the client generates a retrieval condition interface that can interact with the user based on the retrieval model instance. The data retrieval interface receives the retrieval parameter instance submitted by the client, and the server program executes the retrieval program based on the retrieval parameter instance and returns the result to the client. The interface for obtaining model instances carries a data type parameter, and the client obtains the data retrieval model instance of a specific data type by calling the interface, and transmits it to the client program in XML or JSON format.

[0084] The practical application of the retrieval method is as follows:

[0085] 1. The model is defined in JSON format, with each data type in a separate file. For example, the student model is defined in the student.json file.

[0086] 2. The field types supported by the model include string, int, float, date, datetime, and enum, which represent string, integer, floating point number, date, time, and enumeration types respectively.

[0087] 3. The model supports eq, ne, lt, le, gt, ge, ic, ni, in, and nin, which respectively represent equal to, not equal to, less than, less than or equal to, greater than, greater than or equal to, included, not included, in list, and not in list.

[0088] 4. The model supports limiting optional values, such as gender can only be M or F.

[0089] 5. The model defines a list of sorting fields that are supported, without limiting the sorting method, that is, each sorting field can be sorted in either ascending or descending order.

[0090] 6. Client program, design and develop a set of components that support string, int, float, date, datetime, enum types, and support eq, ne, lt, le, gt, ge, ic, ni, in, nin comparison methods;

[0091] 7. After the client obtains and parses the student model instance, it generates a search condition interface.

[0092] 8. The server program of this example provides an http search interface and uses the http request protocol to pass search parameters. The search parameters of this example are: http: / / localhost:8080 / api / v1 / students?age__le=12&age__ge=10&gender__eq=M&ord er_by=-birthDate

[0093] The interface address for retrieving students is http: / / localhost:8080 / api / v1 / students. The search parameters are: age greater than or equal to 10 and less than or equal to 12, and gender is M, and the data is sorted in descending order of birthDate.

[0094] The code for the student.json retrieval model is as follows:

[0095]

[0096] In summary, the data retrieval method provided by the embodiment of the present application is to create an initial retrieval condition instance and an initial retrieval ranking instance according to the retrieval request in response to the server receiving the retrieval request; verify the initial retrieval condition instance and the initial retrieval ranking instance according to the pre-built retrieval model, and obtain the target retrieval condition instance and the target retrieval ranking instance that pass the verification; the client parses the target retrieval condition instance and the target retrieval ranking instance to obtain a retrieval template including the retrieval condition and the retrieval ranking; in response to the client receiving the retrieval parameter, generate a retrieval parameter instance based on the retrieval template, perform retrieval based on the retrieval parameter instance, and obtain the retrieval result. It is realized that there is no need for the client and the server to design and develop interfaces and retrieval logic for each data retrieval. A set of retrieval models, server and client programs are implemented at one time and can be reused. There is no need to develop client and server retrieval logic separately for each data retrieval function, which greatly improves the development efficiency of the data retrieval function. It solves the problem of low efficiency in data retrieval development in related technologies.

[0097] In a second aspect, an embodiment of the present application provides a data retrieval system. Figure 4 FIG. 1 is a block diagram of a data retrieval system according to an exemplary embodiment. Figure 4 As shown, the system includes a retrieval model instance creation module, a retrieval template module, a retrieval parameter instance module, a target retrieval instance module and a retrieval result module, wherein:

[0098] A retrieval model instance creation module is used to create a retrieval model instance according to a pre-built retrieval model, wherein the retrieval model instance includes a retrieval condition instance and a retrieval ranking instance;

[0099] A retrieval template module, which is used to respond to a request from a client to obtain a retrieval model instance, and the client parses the retrieval condition instance and the retrieval ranking instance to obtain a retrieval template including the retrieval condition and the retrieval ranking;

[0100] The retrieval parameter instance module is used to respond to the user's retrieval request. The client obtains the retrieval parameter instance input by the user through the retrieval condition and sorting component. The retrieval parameter instance includes the condition parameter instance and the sorting parameter instance.

[0101] The target retrieval instance module is used for the server to respond to the client's retrieval request, verify the retrieval parameter instance according to the retrieval model, and obtain the target retrieval instance that passes the verification; the target retrieval instance includes the target condition instance and the target retrieval sorting instance;

[0102] The retrieval result module is used by the server to perform retrieval based on the target retrieval instance and obtain the retrieval results.

[0103] In summary, the present application provides a data retrieval system. By creating a retrieval model instance module, a retrieval template module, a retrieval parameter instance module, a target retrieval instance module and a retrieval result module. Specifically, by responding to a retrieval request received by the server, an initial retrieval condition instance and an initial retrieval ranking instance are created according to the retrieval request; according to a pre-built retrieval model, the initial retrieval condition instance and the initial retrieval ranking instance are verified, and the target retrieval condition instance and the target retrieval ranking instance that pass the verification are obtained; the client parses the target retrieval condition instance and the target retrieval ranking instance, and obtains a retrieval template including the retrieval condition and the retrieval ranking; in response to the client receiving the retrieval parameter, a retrieval parameter instance is generated based on the retrieval template, and a retrieval is performed based on the retrieval parameter instance to obtain the retrieval result. It is achieved that there is no need for the client and the server to design and develop interfaces and retrieval logic for each data retrieval. It solves the problem of low efficiency in data retrieval development in related technologies.

[0104] It should be noted that the data retrieval system provided in this embodiment is used to implement the above-mentioned implementation mode, and the descriptions that have been made will not be repeated. As used above, the terms "module", "unit", "subunit" and the like can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the above embodiment is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also conceivable.

[0105] In a third aspect, an embodiment of the present application provides an electronic device, Figure 5 FIG. 1 is a block diagram of an electronic device according to an exemplary embodiment. Figure 5 As shown, the electronic device may include a processor 51 and a memory 52 storing computer program instructions.

[0106] Specifically, the processor 51 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0107] Among them, the memory 52 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 52 may include a hard disk drive (HDD), a floppy disk drive, a solid state drive (SSD), a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 52 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 52 may be inside or outside the data processing device. In a specific embodiment, the memory 52 is a non-volatile memory. In a specific embodiment, the memory 52 includes a read-only memory (ROM) and a random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (Programmable Read-Only Memory, PROM for short), an erasable PROM (Erasable ProgrammableRead-Only Memory, EPROM for short), an electrically erasable PROM (Electrically Erasable ProgrammableRead-Only Memory, EEPROM for short), an electrically alterable ROM (Electrically Alterable Read-Only Memory, EAROM for short) or a flash memory (FLASH) or a combination of two or more of these. Under appropriate circumstances, the RAM can be a static random access memory (SRAM) or a dynamic random access memory (DRAM), wherein the DRAM can be a fast page mode dynamic random access memory (FPMDRAM), an extended data output dynamic random access memory (EDODRAM), a synchronous dynamic random access memory (SDRAM), etc.

[0108] The memory 52 may be used to store or cache various data files required for processing and / or communication, as well as possible computer program instructions executed by the processor 51 .

[0109] The processor 51 implements any one of the data retrieval methods in the above embodiments by reading and executing computer program instructions stored in the memory 52 .

[0110] In one embodiment, a data retrieval device may further include a communication interface 53 and a bus 50. Figure 5 As shown, the processor 51, the memory 52, and the communication interface 53 are connected via a bus 50 and communicate with each other.

[0111] The communication interface 53 is used to implement communication between the modules, devices, units and / or equipment in the embodiment of the present application. The communication port 53 can also implement data communication with other components such as: external devices, image / data acquisition equipment, databases, external storage, and image / data processing workstations.

[0112] The bus 50 includes hardware, software or both, and couples the components of a data retrieval device to each other. The bus 50 includes, but is not limited to, at least one of the following: a data bus, an address bus, a control bus, an expansion bus, and a local bus. By way of example and not limitation, bus 50 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses or a combination of two or more of these. Where appropriate, bus 50 may include one or more buses. Although embodiments of the present application describe and illustrate a particular bus, the present application contemplates any suitable bus or interconnect.

[0113] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a program stored thereon, and when the program is executed by a processor, a data retrieval method provided in the first aspect is implemented.

[0114] The readable storage medium may include but is not limited to: a portable disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical storage device, a magnetic storage device or any suitable combination of the above.

[0115] In a possible implementation manner, the present invention can also be implemented in the form of a program product, which includes program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute steps of a data retrieval method provided in the first aspect.

[0116] Among them, the program code for executing the present invention can be written in any combination of one or more programming languages, and the program code can be executed completely on the user device, partially on the user device, as an independent software package, partially on the user device and partially on a remote device, or completely on the remote device.

[0117] The technical features of the above embodiments may be arbitrarily combined. 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 specification.

[0118] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A data retrieval method, characterized in that: The method comprises: Creating a retrieval model instance according to a pre-built retrieval model, wherein the retrieval model instance includes a retrieval condition instance and a retrieval ranking instance; In response to a request from a client to obtain the retrieval model instance, the client parses the retrieval condition instance and the retrieval ranking instance to obtain a retrieval template including the retrieval condition and the retrieval ranking; In response to the user's search request, the client obtains the search parameter instance input by the user through the search condition and sorting component, wherein the search parameter instance includes the condition parameter instance and the sorting parameter instance; The server responds to receiving the client's search request, verifies the search parameter instance according to the search model, and obtains a target search instance that passes the verification; the target search instance includes a target condition instance and a target search ranking instance; The server performs a search based on the target search instance to obtain a search result.

2. The method according to claim 1, characterized in that: The client parses the target search condition instance and the target search ranking instance to obtain a search template including the search condition and the search ranking; Parsing the target retrieval condition instance and the target retrieval sorting instance through the parsing model to obtain the field name, field type, optional value, comparison action of the retrieval condition data structure and the field name and sorting action of the retrieval sorting data structure; Through the component generator, based on the field name, field type, optional value, comparison action of the retrieval condition data structure and the field name and sorting action of the retrieval sorting data structure, a retrieval template including retrieval conditions and retrieval sorting is obtained.

3. The method according to claim 1, characterized in that: The pre-built retrieval model includes a retrieval condition model and a retrieval ranking model; The search condition model is used to define search condition instances and determine search requests that meet the preset search conditions; The retrieval ranking model is used to define retrieval ranking instances and determine retrieval requests that meet the preset retrieval ranking.

4. The method according to claim 1, characterized in that: The step of verifying the retrieval parameter instance according to the retrieval model and obtaining a target retrieval instance that passes the verification includes: Determine whether the field name, type and comparison action in the condition parameter instance conform to the preset search condition in the search model; When the preset search condition is met, obtaining a target condition instance; Determine whether the field name and sorting action in the sorting parameter instance conform to the preset search sorting in the search model; In the case of meeting the preset search ranking, a target ranking instance is obtained.

5. The method according to claim 4, characterized in that The comparison action represents a comparison of search conditions, and the comparison actions include equal to, not equal to, less than, less than or equal to, greater than, greater than or equal to, contains, does not contain, is in the list, and is not in the list; The sorting action represents searching for a positive or negative order condition.

6. The method according to claim 1, characterized in that: In response to the user's search request, the client obtains the search parameter instance input by the user through the search condition and sorting component, and the search parameter instance includes the condition parameter instance and the sorting parameter instance, including: The search request is parsed, and a condition parameter instance and a sort parameter instance are obtained respectively through the search condition and the sort component, wherein the condition parameter instance includes a field name, a comparison action and a value, and the sort parameter instance includes a field name and a sort action.

7. The method according to claim 6, characterized in that: The parsing of the search request and obtaining the condition parameter instance and the sorting parameter instance respectively through the search condition and the sorting component include: Based on the search parameters, parameter instances and sorting parameter instances are obtained through the parameter generator and the search template.

8. A data retrieval system, characterized in that: The system includes a retrieval model instance creation module, a retrieval template module, a retrieval parameter instance module, a target retrieval instance module and a retrieval result module, wherein: The retrieval model instance creation module is used to create a retrieval model instance according to a pre-built retrieval model, wherein the retrieval model instance includes a retrieval condition instance and a retrieval ranking instance; The retrieval template module is used to respond to a request from a client to obtain the retrieval model instance, the client parsing the retrieval condition instance and the retrieval ranking instance, and obtaining a retrieval template including the retrieval condition and the retrieval ranking; The retrieval parameter instance module is used to respond to the user's retrieval request. The client obtains the retrieval parameter instance input by the user through the retrieval condition and sorting component. The retrieval parameter instance includes a condition parameter instance and a sorting parameter instance. The target retrieval instance module is used for the server to respond to the client retrieval request, verify the retrieval parameter instance according to the retrieval model, and obtain the target retrieval instance that passes the verification; the target retrieval instance includes a target condition instance and a target retrieval ranking instance; The retrieval result module is used by the server to perform retrieval based on the target retrieval instance and obtain retrieval results.

9. An electronic device, characterized in that: The method comprises a memory and a processor, a computer program stored in the memory and executable on the processor, and the processor implements a data retrieval method as claimed in any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, a data retrieval method according to any one of claims 1 to 7 is implemented.