CN109213775B - Search method, search device, computer equipment and storage medium - Google Patents

Search method, search device, computer equipment and storage medium Download PDF

Info

Publication number
CN109213775B
CN109213775B CN201811089558.6A CN201811089558A CN109213775B CN 109213775 B CN109213775 B CN 109213775B CN 201811089558 A CN201811089558 A CN 201811089558A CN 109213775 B CN109213775 B CN 109213775B
Authority
CN
China
Prior art keywords
data
search
nodes
query request
searching
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811089558.6A
Other languages
Chinese (zh)
Other versions
CN109213775A (en
Inventor
蔡健
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
OneConnect Financial Technology Co Ltd Shanghai
Original Assignee
OneConnect Financial Technology Co Ltd Shanghai
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by OneConnect Financial Technology Co Ltd Shanghai filed Critical OneConnect Financial Technology Co Ltd Shanghai
Priority to CN201811089558.6A priority Critical patent/CN109213775B/en
Publication of CN109213775A publication Critical patent/CN109213775A/en
Application granted granted Critical
Publication of CN109213775B publication Critical patent/CN109213775B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to a searching method and device based on big data, computer equipment and a storage medium. The method comprises the following steps: acquiring a data query request; determining a search field according to the data query request; searching nodes corresponding to each search field from a pre-established data structure chart; generating a data search instruction corresponding to the data query request according to the relation between the queried nodes; and searching corresponding data from the database according to the data searching instruction. The searching method greatly improves the searching efficiency, supports cross-table logic query, and effectively solves the problem that only single-table query is supported in the traditional technology, because the data corresponding to different searching fields are stored in different tables and can be directly queried at one time.

Description

Search method, search device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a search method, an apparatus, a computer device, and a storage medium.
Background
With the development of computer technology, data is more and more redundant, and rapid query and search of data becomes a technical problem needing to be researched. In the conventional technology, when data is searched, matching search is performed on keywords in a search statement. However, when data search is performed, the database is traversed according to the keyword in the search statement to find whether the database stores data successfully matched with the keyword, and the search method cannot realize cross-table search and is low in search efficiency.
Disclosure of Invention
In view of the above, it is necessary to provide a search method, apparatus, computer device and storage medium capable of implementing cross-table search and improving search efficiency.
A method of searching, the method comprising:
acquiring a data query request;
determining a search field according to the data query request;
searching nodes corresponding to each search field from a pre-established data structure chart;
generating a data search instruction corresponding to the data query request according to the relationship between the queried nodes;
and searching corresponding data from a database according to the data searching instruction.
In one embodiment, the generating a data search instruction corresponding to the data query request according to the relationship between the queried nodes includes: when the nodes corresponding to the search fields have relations in the data structure diagram, determining the connection paths of the nodes having relations; taking the node connection path with the shortest path as a search path; and generating a data search instruction corresponding to the data query request according to the nodes contained in the search path and the parameters of the nodes.
In one embodiment, after searching the corresponding data from the database according to the data search instruction, the method further includes: and displaying the searched data in a terminal in a chart mode.
In one embodiment, the step of establishing the data structure diagram includes: acquiring a data extraction module; establishing connection between the data extraction module and a source database; acquiring data parameters of each data table in the source database through the data extraction module; and establishing a data structure diagram corresponding to the source database according to the data parameters.
In one embodiment, the obtaining, by the data extraction module, the data parameters of each data table in the source database includes: when the corresponding annotation text exists in the data table in the source database, acquiring the annotation text of the data table; establishing a data structure diagram corresponding to the source database according to the data parameters, wherein the data structure diagram comprises the following steps: and taking the annotation text of the data table as the alias of the node corresponding to the data table.
In one embodiment, after the obtaining, by the data extraction module, the data parameters of each data table in the source database, the method further includes: acquiring a data reconstruction template, wherein the data reconstruction template defines a data format and a hierarchical relationship; filling the data parameters of each data table into the data reconstruction template according to the data format; determining the node hierarchical relationship of the data parameters in the data structure diagram according to the hierarchical relationship; the step of storing the data parameters in a graph mode to obtain a corresponding data structure graph comprises the following steps: determining each node contained in the data structure diagram and the hierarchical relationship among the nodes according to the node hierarchical relationship of the data parameters in the data structure diagram; and obtaining a data structure diagram corresponding to the source database according to each node contained in the data structure diagram and the hierarchical relationship among the nodes.
In one embodiment, the method further comprises: acquiring a Chinese query request; performing word segmentation processing on the Chinese query request through a word segmentation model to obtain a plurality of Chinese search fields; searching nodes corresponding to each Chinese search field from the pre-established data structure chart; generating a data search instruction corresponding to the Chinese query request according to the relation between the queried nodes; and searching corresponding data from a database according to the data searching instruction corresponding to the Chinese query request.
A search apparatus, the apparatus comprising:
the query request acquisition module is used for acquiring a data query request;
the search instruction generation module is used for determining a search field according to the data query request; searching nodes corresponding to each search field from a pre-established data structure chart; generating a data search instruction corresponding to the data query request according to the relationship between the queried nodes;
and the second searching module is used for searching corresponding data from a database according to the data searching instruction.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program: acquiring a data query request; determining a search field according to the data query request; searching nodes corresponding to each search field from a pre-established data structure chart; generating a data search instruction corresponding to the data query request according to the relationship between the queried nodes; and searching corresponding data from a database according to the data searching instruction.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of: acquiring a data query request; determining a search field according to the data query request; searching nodes corresponding to each search field from a pre-established data structure chart; generating a data search instruction corresponding to the data query request according to the relationship between the queried nodes; and searching corresponding data from a database according to the data searching instruction.
According to the searching method, the searching device, the computer equipment and the storage medium, the data query request is obtained, the node where each search field is located is found from the pre-established data structure chart according to the search field contained in the data query request, and the data corresponding to the node can be directly searched according to the path of the node in the database, so that the searching efficiency is greatly improved.
Drawings
FIG. 1 is a diagram of an application scenario of a search method in one embodiment;
FIG. 2 is a schematic flow chart diagram of a search method in one embodiment;
FIG. 3 is a flowchart illustrating the steps of generating data search instructions corresponding to a data query request based on relationships between queried nodes in one embodiment;
FIG. 4 is a flow chart illustrating the steps of building a data structure diagram in one embodiment;
FIG. 5 is a diagram illustrating data parameters of a data structure diagram in one embodiment;
FIG. 6 is a flowchart illustrating steps performed after obtaining data parameters of each data table in the source database by the data extraction module in one embodiment;
FIG. 7 is a flowchart illustrating further steps included in the search method in one embodiment;
FIG. 8 is a block diagram showing the construction of a search apparatus according to an embodiment;
FIG. 9 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The searching method provided by the application can be applied to the application environment shown in fig. 1. Wherein the terminal 110 communicates with the server 120 through a network. The search engine in the server 120 may obtain, through the network, a data query request triggered by the user through the terminal, so that a corresponding search instruction may be generated according to a search field in the data query request, and corresponding data may be searched from a database of the server according to the search instruction. The server 120 may also transmit the searched data to the terminal 110 through the network for display. The terminal 110 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, and the server 120 may be implemented by an independent server or a server cluster formed by a plurality of servers.
In one embodiment, as shown in fig. 2, a searching method is provided, which is described by taking the method as an example applied to the server in fig. 1, and includes the following steps:
step 202, a data query request is obtained.
Step 204, determining a search field according to the data query request.
Step 206, searching nodes corresponding to each search field from the pre-established data structure diagram.
The data query request refers to a query request for data to be known, which is input through a terminal. The data query request may be a Chinese query statement. For example, the data query request may be "Shanghai Male employment post". The data query request may be triggered by a user through the terminal, and further, the data query request may be triggered by a preset application installed on the terminal. When a user inputs a data query request through a preset application, a search engine may obtain one or more search fields included in a data query statement. For example, if the data query request is "shanghai male employment post", the search engine may obtain that the search fields included in the data query request include: "shanghai", "male", "employment post", whereby the search engine may look up the nodes corresponding to each search field from a data structure diagram built from the data in the database. The data structure diagram is a structure diagram established according to data in the source database, and the data structure diagram contains nodes corresponding to each data table contained in the source database and relationships between the nodes corresponding to each data table.
And step 208, generating a data search instruction corresponding to the data query request according to the queried relationship between the nodes.
And step 210, searching corresponding data from the database according to the data searching instruction.
When the search engine finds the nodes corresponding to the search fields from the pre-established data structure chart according to the search fields contained in the data query request, the search engine can also obtain the closing instructions between the nodes corresponding to the search fields. The data search instruction is a computer language, and after the search engine generates the data search instruction, the search engine can search corresponding data from a database according to the data search instruction.
That is to say, after a data query request input by a user is obtained, two query operations are performed, the first query is to search for a corresponding node from the data structure diagram according to the data query request, so that a real data search instruction can be generated according to the searched node, and the second query is to search for actual data from the data according to the generated data search instruction. The first time is to inquire the catalog of the data, and the second time can quickly find the actual data content from the database according to the catalog. For example, if the data query request is "employment post of shanghai male", the search fields determined according to the data query request have "shanghai", "male", and "employment post". When data is queried, nodes corresponding to three search fields of Shanghai, male and employment posts are queried from a data structure diagram, and the relationship among the three nodes is determined, so that a real data search instruction can be generated, and the generated data search instruction can include paths of all the nodes in a database, so that data corresponding to the nodes can be directly searched according to the paths of the nodes in the database, and the corresponding data can be quickly searched from the database according to the data search instruction.
In one embodiment, as shown in fig. 3, generating a data search instruction corresponding to the data query request according to the relationship between the queried nodes includes:
step 302, when the nodes corresponding to the search field have a relationship in the data structure diagram, determining the node connection path having the relationship.
And step 304, taking the node connection path with the shortest path as a search path.
And step 306, generating a data search instruction corresponding to the data query request according to the nodes contained in the search path and the parameters of the nodes.
The data structure chart comprises a plurality of nodes corresponding to the data table in the source database, all the nodes are connected through node relations, and some nodes can be connected through other nodes. For example, there is a node relationship 1 between node a and node B, that is, node a and node B are connected. Node B and node C have node relationship 2, but node a and node C do not have node relationship, i.e. node a and node C are not directly connected, but can be considered to be on the path of ABC. That is, after the node a is found, the node B can be found through the node relation 1, and then the node C can be found through the node relation 2. Therefore, node A → node B → node C can be considered a search path. In this way, all node connection paths of the search field included in the data query request can be acquired according to the data structure diagram. Assuming that the search field is "shanghai", "male", or "employment position", the data structure diagram can be used to search for the node "region" corresponding to the search field "shanghai", the node "gender" corresponding to the search field "male", and the node "position" corresponding to the search field "employment position", and there may be node connection paths between these three nodes: region-gender-position, region-node a-gender-node B-node C-position, \ 8230 ], and so on. After a plurality of node connection paths are obtained according to the data structure diagram, the length of each node connection path can be determined, and the node connection path with the shortest path can be used as a search path, so that the search efficiency can be effectively improved.
In one embodiment, after searching the corresponding data from the database according to the data search instruction, the method further comprises: and displaying the searched data in a terminal in a chart mode.
After the data search instruction corresponding to the data query request is generated, corresponding data can be searched from the database according to the data search instruction, and the searched data can be displayed on the terminal. In order to display the searched data more clearly, the searched data may be displayed on a search result display page of a preset application in a graph manner. For example, it may be in the form of a table, a tree, or a statistical chart.
The searching method does not directly traverse all data storage tables containing all search fields in the database, but obtains the data query request, finds out the node where each search field is located from the pre-established data structure chart according to the search fields contained in the data query request, and directly searches the data corresponding to the node according to the path of the node in the database, thereby greatly improving the searching efficiency.
In one embodiment, as shown in fig. 4, the step of establishing the data structure diagram includes:
step 402, a data extraction module is obtained.
Step 404, the data extraction module is connected with the source database.
And 406, acquiring data parameters of each data table in the source database through the data extraction module.
And step 408, storing the data parameters in a data structure diagram mode to obtain a data structure diagram corresponding to the source database.
The data extraction module is a module for predefining data structure extraction parameters, and the data structure extraction parameters refer to data parameters which need to be extracted when the data tables of the source database are extracted. The data parameter, i.e., the data structure extraction parameter, may be at least one of a library name, a table name, a field name, or an enumerated value. After the data extraction module is obtained, the data extraction module can be connected with the source database, so that the data extraction module can obtain data parameters of each data table of the source database. The data table refers to data in a source database stored in a table form, and is therefore called a data table.
As shown in fig. 5, the source database is assumed to be a database S, and the database S includes a data table a and a data table B. The source database contains the table names and creation time of the data tables, and the data tables are associated through connection relations. Taking the data table a as an example, the data table a may include a plurality of fields, such as field 1 and field 2, each of which has a corresponding field name and a corresponding type. An alias may also be set for the field, which may be a Chinese comment for the field, such as a "comment" for the field comment. An alias is another name of a field, and the field corresponding to the alias can also be searched by searching the alias. When an enumeration exists in a field, an enumeration value contained in the field may be obtained. Therefore, when the data extraction module is used to obtain the data parameters of each data table in the source database, the database name, table name, field name, enumeration value, or the like included in the source database may be obtained, so that the data parameters may be stored in a data structure diagram manner to obtain a data structure diagram corresponding to the source database.
In one embodiment, the obtaining, by the data extraction module, data parameters of each data table in the source database includes: and when the corresponding annotation text exists in the data table in the source database, acquiring the annotation text of the data table. Establishing a data structure diagram corresponding to the source database according to the data parameters, wherein the data structure diagram comprises the following steps: and taking the annotation text of the data table as the alias of the node corresponding to the data table.
When the data table in the source database has the annotation text, the annotation text of the data table can be obtained, and then the annotation text can be used as an alternative name of the data table when the data structure diagram is established. Further, when there is a corresponding comment text in a field in the data table, the comment text of the field may also be acquired, and when the data structure diagram is established, the comment text of the field is used as an alias of the field.
When the data structure chart is established, each data table corresponds to one node in the data structure chart, and the nodes are connected through the node connection relation. Under each node, a plurality of child nodes may also be included. For example, if the node corresponding to the data table a in the data structure diagram is the node a, the node a may further include a plurality of child nodes A1, A2, A3, and the like, where the child nodes refer to nodes corresponding to fields in the data table. If the data table a contains 10 fields, the number of child nodes contained in the node a is considered to be 10. If the enumerated value contained in the field of the data table a is included in a child node included under the node a. In this way, a data structure diagram corresponding to the data contained in the source database can be created. The data structure in the source database is included in the data structure diagram, and not all the specific data in the source database, that is, the data structure diagram includes the relationships between the nodes and the nodes corresponding to the data tables in the source database, and the attributes of the nodes include the paths of the nodes in the source database. After the node is found, the specific data content corresponding to the node can be found from the source database according to the data path included in the attribute of the node. For example, if the enumerated value included in the node "region" includes "beijing", "shanghai", and "shenzhen", then when the node "region" in the data structure diagram is found, the specific data corresponding to each of "beijing", "shanghai", and "shenzhen", such as population distribution, population age, and the like of "beijing", may be directly obtained when the specific data needs to be known, and the data path of the enumerated value "beijing" in the source database may be obtained, and then the specific data corresponding to the node "region" and having the enumerated value "beijing" may be searched from the source database. Therefore, the established data structure diagram is actually considered to be a directory index table, and the nodes corresponding to the search fields can be quickly found through the established data structure diagram, so that the corresponding data can be quickly found according to the nodes without traversing all the data. For example, in the above example, the conventional technology needs to traverse all data including "beijing" and then perform data screening. In this embodiment, the search efficiency can be effectively improved by the established data structure diagram.
In an embodiment, as shown in fig. 6, after the data extraction module obtains the data parameters of each data table in the source database, the method further includes:
step 602, a data reconstruction template is obtained, and the data reconstruction template defines a data format and a hierarchical relationship.
And step 604, filling the data parameters of each data table into a data reconstruction template according to the data format.
And 606, determining the node hierarchical relationship of the data parameters in the data structure chart according to the hierarchical relationship.
Storing the data parameters in a graph mode to obtain a corresponding data structure graph, wherein the data structure graph comprises the following steps: determining each node contained in the data structure chart and the hierarchical relationship among the nodes according to the node hierarchical relationship of the data parameters in the data structure chart; and obtaining a data structure diagram corresponding to the source database according to each node contained in the data structure diagram and the hierarchical relationship among the nodes.
The data reconstruction template refers to a template of a predefined data structure, and a hierarchical relationship between a data format and data is defined in the data reconstruction template. The data format included in the data reconstruction template is defined according to the data parameters defined in the data extraction module, and generally, the data format in the data reconstruction template is the data parameters included in the data extraction module. Therefore, after the data extraction module establishes connection with the source database, the extracted data parameters of each data table can be filled into the data reconstruction template, and the data parameters are filled according to the data format defined in the data reconstruction template. When defining the data format in the data reconstruction template, the hierarchical relationship of the data is also defined. The hierarchical relationship of the data is the hierarchical relationship between the data contained in the data table, for example, if the data table a contains a plurality of fields, the fields are the sub-levels of the data table a, and when the data structure diagram is established, the data table a is the master node, and the fields are the sub-nodes of the nodes corresponding to the data table a.
After the extracted data structure is filled into the data reconstruction template, the node corresponding to the corresponding data parameter, the byte point of the node corresponding to the data parameter, the node relationship between the node and the nodes corresponding to other data parameters can be determined according to the data hierarchy relationship defined in the data reconstruction template, and a corresponding data structure diagram can be established according to the determined node and the relationship between the nodes. The node hierarchy relationship refers to determining a main node and a child node.
In one embodiment, as shown in fig. 7, the method further includes:
step 702, obtain a Chinese query request.
Step 704, performing word segmentation processing on the Chinese query request through the word segmentation model to obtain a plurality of Chinese search fields.
Step 706, searching the nodes corresponding to each Chinese search field from the pre-established data structure chart.
Step 708, generating a data search instruction corresponding to the Chinese query request according to the relationship between the queried nodes.
Step 710, searching corresponding data from a database according to a data search instruction corresponding to the Chinese query request.
The data query request may be a Chinese query request, i.e., the query text contained in the data query request is Chinese. When the data query request is a Chinese query request, the Chinese query request can be participled through a participle model to obtain a plurality of Chinese search fields. For example, a Chinese query request can be segmented by NLP (Natural Language Processing), and a plurality of chinese search fields can be obtained. The Chinese search field is one expression form of the search field contained in the data query request, the nodes corresponding to the Chinese search fields can be searched from the pre-established data structure chart, and the data search instruction corresponding to the Chinese query request is determined according to the relation between the searched nodes. Whether the query sentence contained in the data query request is Chinese or English, the corresponding search field in the query sentence can be obtained firstly, the nodes corresponding to each search field can be searched from the pre-established data structure chart, so that the data search instruction corresponding to the Chinese query request can be determined according to the relation between the queried nodes, the corresponding data can be searched from the database according to the generated data search instruction, and the searched data can be displayed on the interface of the preset application installed on the terminal. The searching mode greatly improves the searching efficiency.
It should be understood that although the various steps in the flow diagrams of fig. 2-7 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not limited to being performed in the exact order illustrated and, unless explicitly stated herein, may be performed in other orders. Moreover, at least some of the steps in fig. 2-7 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performing the sub-steps or stages is not necessarily sequential, but may be performed alternately or alternatingly with other steps or at least some of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 8, there is provided a search apparatus including: the device comprises a query request acquisition module, a search instruction generation module and a second search module, wherein:
a query request obtaining module 802, configured to obtain a data query request.
A search instruction generating module 804, configured to determine a search field according to the data query request; searching nodes corresponding to each search field from a pre-established data structure chart; and generating a data search instruction corresponding to the data query request according to the relationship between the queried nodes.
And a second searching module 806, configured to search corresponding data from the database according to the data searching instruction.
In an embodiment, the search instruction generating module 804 is further configured to determine a node connection path having a relationship when the node corresponding to the search field has a relationship in the data structure diagram; taking the node connection path with the shortest path as a search path; and generating a data search instruction corresponding to the data query request according to the nodes contained in the search path and the parameters of the nodes.
In one embodiment, the apparatus further includes a display module (not shown in the figure) for displaying the searched data in a graph manner on the terminal.
In one embodiment, the apparatus further includes a structure establishing module (not shown in the figure) for obtaining the data extracting module; establishing connection between the data extraction module and a source database; acquiring data parameters of each data table in a source database through a data extraction module; and establishing a data structure diagram corresponding to the source database according to the data parameters.
In an embodiment, the structure building module is further configured to obtain the comment text of the data table when the corresponding comment text exists in the data table in the source database. Establishing a data structure diagram corresponding to the source database according to the data parameters, wherein the data structure diagram comprises the following steps: and taking the annotation text of the data table as an alias of the node corresponding to the data table.
In one embodiment, the structure establishing module is further configured to obtain a data reconstruction template, where the data reconstruction template defines a data format and a hierarchical relationship; filling the data parameters of each data table into a data reconstruction template according to the data format; and determining the node hierarchical relation of the data parameters in the data structure chart according to the hierarchical relation. Storing the data parameters in a graph mode to obtain a corresponding data structure graph, wherein the data structure graph comprises the following steps: determining each node contained in the data structure diagram and the hierarchical relationship among the nodes according to the node hierarchical relationship of the data parameters in the data structure diagram; and obtaining a data structure diagram corresponding to the source database according to each node contained in the data structure diagram and the hierarchical relationship among the nodes.
In one embodiment, the apparatus further includes a Chinese query module (not shown) for obtaining a Chinese query request; performing word segmentation processing on the Chinese query request through a word segmentation model to obtain a plurality of Chinese search fields; searching nodes corresponding to each Chinese search field from a pre-established data structure chart; generating a data search instruction corresponding to the Chinese query request according to the relation between the queried nodes; and searching corresponding data from the database according to the data searching instruction corresponding to the Chinese query request.
For the specific limitations of the search apparatus, reference may be made to the limitations of the search method described above, and details are not repeated here. The modules in the above search device may be implemented in whole or in part by software, hardware, and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, and the internal structure thereof may be as shown in fig. 9. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing data of the data structure diagram, data of the data reconstruction template and the like. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a search method.
It will be appreciated by those skilled in the art that the configuration shown in fig. 9 is a block diagram of only a portion of the configuration associated with the present application, and is not intended to limit the computing device to which the present application may be applied, and that a particular computing device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, there is provided a computer device comprising a memory storing a computer program and a processor implementing the following steps when the processor executes the computer program: acquiring a data query request; determining a search field according to the data query request; searching nodes corresponding to each search field from a pre-established data structure chart; generating a data search instruction corresponding to the data query request according to the relationship between the queried nodes; and searching corresponding data from the database according to the data searching instruction.
In one embodiment, generating a data search instruction corresponding to the data query request according to the relationship between the queried nodes includes: when the nodes corresponding to the search fields have a relationship in the data structure chart, determining a node connection path with the relationship; taking the node connection path with the shortest path as a search path; and generating a data searching instruction corresponding to the data query request according to the nodes contained in the searching path and the parameters of the nodes.
In one embodiment, after searching the corresponding data from the database according to the data search instruction, the processor when executing the computer program further implements the following steps: and displaying the searched data in a terminal in a chart mode.
In one embodiment, the processor, when executing the computer program, further performs the step of establishing the data structure diagram, including: acquiring a data extraction module; establishing connection between the data extraction module and a source database; acquiring data parameters of each data table in a source database through a data extraction module; and establishing a data structure diagram corresponding to the source database according to the data parameters.
In one embodiment, the obtaining, by the data extraction module, data parameters of each data table in the source database includes: and when the corresponding annotation text exists in the data table in the source database, acquiring the annotation text of the data table. Establishing a data structure diagram corresponding to the source database according to the data parameters, wherein the data structure diagram comprises the following steps: and taking the annotation text of the data table as an alias of the node corresponding to the data table.
In one embodiment, after the data parameters of each data table in the source database are obtained by the data extraction module, the processor executes the computer program to further implement the following steps: acquiring a data reconstruction template, wherein the data reconstruction template defines a data format and a hierarchical relationship; filling the data parameters of each data table into a data reconstruction template according to the data format; and determining the node hierarchical relation of the data parameters in the data structure chart according to the hierarchical relation. Storing the data parameters in a graph mode to obtain a corresponding data structure graph, wherein the data structure graph comprises the following steps: determining each node contained in the data structure chart and the hierarchical relationship among the nodes according to the node hierarchical relationship of the data parameters in the data structure chart; and obtaining a data structure diagram corresponding to the source database according to each node contained in the data structure diagram and the hierarchical relationship among the nodes.
In one embodiment, the processor, when executing the computer program, further performs the steps of: acquiring a Chinese query request; performing word segmentation processing on the Chinese query request through a word segmentation model to obtain a plurality of Chinese search fields; searching nodes corresponding to each Chinese search field from a pre-established data structure chart; generating a data search instruction corresponding to the Chinese query request according to the relation between the queried nodes; and searching corresponding data from the database according to the data searching instruction corresponding to the Chinese query request.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, performs the steps of: acquiring a data query request; determining a search field according to the data query request; searching nodes corresponding to each search field from a pre-established data structure chart; generating a data search instruction corresponding to the data query request according to the relation between the queried nodes; and searching corresponding data from the database according to the data searching instruction.
In one embodiment, generating a data search instruction corresponding to the data query request according to the relation between the queried nodes comprises: when the nodes corresponding to the search fields have a relationship in the data structure chart, determining a node connection path with the relationship; taking the node connection path with the shortest path as a search path; and generating a data searching instruction corresponding to the data query request according to the nodes contained in the searching path and the parameters of the nodes.
In one embodiment, the computer program when executed by the processor further performs the following steps after searching the corresponding data from the database according to the data search instruction: and displaying the searched data in a terminal in a chart mode.
In one embodiment, the computer program when executed by the processor further performs the step of establishing a data structure diagram, comprising: acquiring a data extraction module; establishing connection between the data extraction module and a source database; acquiring data parameters of each data table in a source database through a data extraction module; and establishing a data structure diagram corresponding to the source database according to the data parameters.
In one embodiment, the obtaining, by the data extraction module, data parameters of each data table in the source database includes: and when the corresponding annotation text exists in the data table in the source database, acquiring the annotation text of the data table. Establishing a data structure diagram corresponding to the source database according to the data parameters, wherein the data structure diagram comprises the following steps: and taking the annotation text of the data table as an alias of the node corresponding to the data table.
In one embodiment, after the data parameters of the data tables in the source database are obtained by the data extraction module, the computer program when executed by the processor further implements the following steps: acquiring a data reconstruction template, wherein the data reconstruction template defines a data format and a hierarchical relationship; filling the data parameters of each data table into a data reconstruction template according to the data format; and determining the node hierarchical relation of the data parameters in the data structure chart according to the hierarchical relation. Storing the data parameters in a graph mode to obtain a corresponding data structure graph, wherein the data structure graph comprises the following steps: determining each node contained in the data structure diagram and the hierarchical relationship among the nodes according to the node hierarchical relationship of the data parameters in the data structure diagram; and obtaining a data structure diagram corresponding to the source database according to each node contained in the data structure diagram and the hierarchical relationship among the nodes.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring a Chinese query request; performing word segmentation processing on the Chinese query request through a word segmentation model to obtain a plurality of Chinese search fields; searching nodes corresponding to each Chinese search field from a pre-established data structure chart; generating a data search instruction corresponding to the Chinese query request according to the relation between the queried nodes; and searching corresponding data from the database according to the data searching instruction corresponding to the Chinese query request.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above may be implemented by hardware instructions of a computer program, which may be stored in a non-volatile computer-readable storage medium, and when executed, may include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include non-volatile and/or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), rambus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method of searching, the method comprising:
acquiring a data query request;
determining a search field according to the data query request;
searching nodes corresponding to each search field from a pre-established data structure chart, wherein the data structure chart is a structure chart established according to data in a source database, and the data structure chart comprises the nodes corresponding to each data table contained in the source database and the relationship between the nodes corresponding to each data table;
generating a data search instruction corresponding to the data query request according to the relationship between the queried nodes;
searching corresponding data from a database according to the data searching instruction;
the step of establishing the data structure diagram comprises the following steps:
acquiring a data extraction module;
establishing connection between the data extraction module and a source database;
acquiring data parameters of each data table in the source database through the data extraction module;
acquiring a data reconstruction template, wherein the data reconstruction template defines a data format and a hierarchical relationship;
filling the data parameters of each data table into the data reconstruction template according to the data format;
determining the node hierarchical relationship of the data parameters in the data structure diagram according to the hierarchical relationship;
determining each node contained in the data structure diagram and the hierarchical relationship among the nodes according to the node hierarchical relationship of the data parameters in the data structure diagram;
and obtaining a data structure diagram corresponding to the source database according to each node contained in the data structure diagram and the hierarchical relationship among the nodes.
2. The method according to claim 1, wherein the generating a data search instruction corresponding to the data query request according to the relationship between the queried nodes comprises:
when the nodes corresponding to the search fields have relations in the data structure diagram, determining the connection paths of the nodes having relations;
taking the node connection path with the shortest path as a search path;
and generating a data search instruction corresponding to the data query request according to the nodes contained in the search path and the parameters of the nodes.
3. The method of claim 1, after searching the corresponding data from the database according to the data search instruction, further comprising: and displaying the searched data in a terminal in a chart mode.
4. The method according to claim 1, wherein obtaining the data parameters of each data table in the source database through the data extraction module includes:
when a corresponding annotation text exists in a data table in the source database, acquiring the annotation text of the data table;
establishing a data structure diagram corresponding to the source database according to the data parameters, wherein the data structure diagram comprises the following steps: and taking the annotation text of the data table as the alias of the node corresponding to the data table.
5. The method of claim 1, further comprising:
acquiring a Chinese query request;
performing word segmentation processing on the Chinese query request through a word segmentation model to obtain a plurality of Chinese search fields;
searching nodes corresponding to each Chinese search field from the pre-established data structure chart;
generating a data search instruction corresponding to the Chinese query request according to the relation between the queried nodes;
and searching corresponding data from a database according to the data searching instruction corresponding to the Chinese query request.
6. A search apparatus, characterized in that the apparatus comprises:
the query request acquisition module is used for acquiring a data query request;
the search instruction generation module is used for determining a search field according to the data query request; searching nodes corresponding to each search field from a pre-established data structure diagram, wherein the data structure diagram is a structure diagram established according to data in a source database, and the data structure diagram comprises the nodes corresponding to each data table contained in the source database and the relationship between the nodes corresponding to each data table; generating a data search instruction corresponding to the data query request according to the relationship between the queried nodes;
the second searching module is used for searching corresponding data from a database according to the data searching instruction;
the structure establishing module is used for acquiring the data extracting module; establishing connection between the data extraction module and a source database; acquiring data parameters of each data table in the source database through the data extraction module; acquiring a data reconstruction template, wherein the data reconstruction template defines a data format and a hierarchical relationship; filling the data parameters of each data table into the data reconstruction template according to the data format; determining the node hierarchical relationship of the data parameters in the data structure chart according to the hierarchical relationship; determining each node contained in the data structure diagram and the hierarchical relationship among the nodes according to the node hierarchical relationship of the data parameters in the data structure diagram; and obtaining a data structure diagram corresponding to the source database according to each node contained in the data structure diagram and the hierarchical relationship among the nodes.
7. The apparatus according to claim 6, wherein the structure building module is further configured to, when there exists a corresponding comment text in a data table in the source database, obtain a comment text of the data table; and taking the annotation text of the data table as the alias of the node corresponding to the data table.
8. The apparatus of claim 6, further comprising:
the Chinese query module is used for acquiring a Chinese query request; performing word segmentation processing on the Chinese query request through a word segmentation model to obtain a plurality of Chinese search fields; searching nodes corresponding to each Chinese search field from the pre-established data structure chart; generating a data search instruction corresponding to the Chinese query request according to the relation between the queried nodes; and searching corresponding data from a database according to the data searching instruction corresponding to the Chinese query request.
9. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 5 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 5.
CN201811089558.6A 2018-09-18 2018-09-18 Search method, search device, computer equipment and storage medium Active CN109213775B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811089558.6A CN109213775B (en) 2018-09-18 2018-09-18 Search method, search device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811089558.6A CN109213775B (en) 2018-09-18 2018-09-18 Search method, search device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109213775A CN109213775A (en) 2019-01-15
CN109213775B true CN109213775B (en) 2022-11-01

Family

ID=64984332

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811089558.6A Active CN109213775B (en) 2018-09-18 2018-09-18 Search method, search device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109213775B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110580333A (en) * 2019-08-26 2019-12-17 杭州城市大数据运营有限公司 data table processing method, searching method, device, equipment and storage medium
CN113821533B (en) * 2021-09-30 2023-09-08 北京鲸鹳科技有限公司 Method, device, equipment and storage medium for data query
CN114925118B (en) * 2022-06-09 2023-05-16 北京百度网讯科技有限公司 Cross-table searching method, device, equipment and storage medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5241738B2 (en) * 2008-01-28 2013-07-17 株式会社ターボデータラボラトリー Method and apparatus for building tree structure data from tables
CN102135972A (en) * 2010-07-30 2011-07-27 华为软件技术有限公司 Service tree data processing method, system, client and server
CN105550241B (en) * 2015-12-07 2019-06-25 珠海多玩信息技术有限公司 Multi-dimensional database querying method and device
CN107908657A (en) * 2017-10-17 2018-04-13 平安科技(深圳)有限公司 Querying method, device, computer equipment and the storage medium of bordereau

Also Published As

Publication number Publication date
CN109213775A (en) 2019-01-15

Similar Documents

Publication Publication Date Title
WO2019136993A1 (en) Text similarity calculation method and device, computer apparatus, and storage medium
WO2021120627A1 (en) Data search matching method and apparatus, computer device, and storage medium
WO2021114810A1 (en) Graph structure-based official document recommendation method, apparatus, computer device, and medium
CN111666370B (en) Semantic indexing method and device for multi-source heterogeneous space data
CN109213775B (en) Search method, search device, computer equipment and storage medium
WO2020007027A1 (en) Online question-answer method, apparatus, computer equipment and storage medium
CN111310427A (en) Service data configuration processing method and device, computer equipment and storage medium
WO2021217846A1 (en) Interface data processing method and apparatus, and computer device and storage medium
CN102982095B (en) A kind of body automatic creation system based on thesaurus and method thereof
CN108563694B (en) SQL execution method and device for logic deletion, computer equipment and storage medium
CN107766396B (en) Resource data management method and device
CN112131295A (en) Data processing method and device based on Elasticissearch
WO2020052162A1 (en) Disease data mapping method and device, computer device and storage medium
CN112883030A (en) Data collection method and device, computer equipment and storage medium
WO2021258853A1 (en) Vocabulary error correction method and apparatus, computer device, and storage medium
CN111460254A (en) Webpage crawling method, device, storage medium and equipment based on multithreading
CN109656947B (en) Data query method and device, computer equipment and storage medium
CN108595437B (en) Text query error correction method and device, computer equipment and storage medium
CN112115328B (en) Page flow map construction method and device and computer readable storage medium
WO2021047327A1 (en) Method and apparatus for constructing target concept map, computer device, and storage medium
WO2019148797A1 (en) Natural language processing method, device, computer apparatus, and storage medium
CN109410069A (en) Settlement data processing method, device, computer equipment and storage medium
CN111949684B (en) SQL sentence execution method, device, equipment and storage medium
CN112016297B (en) Intention recognition model testing method and device, computer equipment and storage medium
CN111796830B (en) Protocol analysis processing method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant