Data search method and device, computer device, and storage medium
By receiving data search requests, obtaining the user's row-level permission set, and performing isomorphic processing to construct full-domain search conditions, the problem of full-text search engines being unable to achieve user authentication is solved, enabling full-domain data retrieval while ensuring database data security.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING PERCENT INFORMATION TECH CO LTD
- Filing Date
- 2022-12-01
- Publication Date
- 2026-07-24
Smart Images

Figure CN116089996B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a data search method, apparatus, computer equipment, and storage medium. Background Technology
[0002] Currently, in the field of data governance, the main carrier of the governance results data is data tables, and these data tables are the core data assets.
[0003] In related technologies, when conducting full-domain searches, the search method is usually based on a full-text search engine. Data is stored in the full-text search engine, and when searching data, users can enter search criteria at a unified data search portal. The system then performs a full-text search based on the search criteria and returns the search results to the user.
[0004] However, while full-text search engines can enable full-domain data searches, they cannot authenticate users' search behavior, resulting in poor data security. Summary of the Invention
[0005] This application provides a data search method, apparatus, computer device, and storage medium. It enables full-domain search of data in a database and allows user authentication based on row-level permissions. This ensures that the data retrieved based on the full-domain search criteria matches the user's row-level permissions and the search keywords within the entire database, thus achieving full-domain data retrieval while guaranteeing data security within the database. The technical solution is as follows.
[0006] On the one hand, a data search method is provided, the method comprising:
[0007] Receive a data search request; the data search request contains user information and data search keywords; the user information is the information of the user corresponding to the client that sent the data search request;
[0008] Based on the user information, obtain the user's row-level permission set; the row-level permission set contains at least one row-level permission granted to the user; the row-level permission is used to indicate the level of the data row in the data table that the user can query;
[0009] Traverse the set of row-level permissions, perform isomorphism processing on each row-level permission in the set of row-level permissions, and obtain the isomorphism result corresponding to each row-level permission; the isomorphism result includes the source table information of the data corresponding to the row-level permission and the row-level permission field information corresponding to the row-level permission;
[0010] Based on the homogenization results corresponding to each row-level permission and the data search keywords, construct global search conditions;
[0011] Data is searched in the database based on the global search criteria; the data in the database is stored based on the target data structure; the target data structure corresponds to the data structure of the isomorphism result.
[0012] On the other hand, a data search device is provided, the device comprising:
[0013] A request receiving module is used to receive data search requests; the data search request includes user information and data search keywords; the user information is the information of the user corresponding to the client that sent the data search request;
[0014] The first acquisition module is used to acquire a set of row-level permissions for the user based on the user information; the set of row-level permissions includes at least one row-level permission granted to the user; the row-level permissions are used to indicate the level of the data rows in the data table that the user can query;
[0015] The processing module is used to traverse the row-level permission set, perform isomorphism processing on each row-level permission in the row-level permission set, and obtain the isomorphism result corresponding to each row-level permission; the isomorphism result includes the source table information of the data corresponding to the row-level permission and the row-level permission field information corresponding to the row-level permission;
[0016] The condition construction module is used to construct global search conditions based on the homogenization results corresponding to each of the row-level permissions and the data search keywords;
[0017] The data search module is used to perform data searches in the database based on the global search conditions; the data in the database is stored based on a target data structure; the target data structure corresponds to the data structure of the isomorphism result.
[0018] In one possible implementation, the device further includes:
[0019] The second acquisition module is used to acquire a set of user-level permissions based on the user information; the set of user-level permissions includes at least one level permission granted to the user; the level permission is used to indicate the level of data table that the user can query;
[0020] The score determination module is used to determine the user's overall hierarchical score based on the hierarchical permission score corresponding to each of the aforementioned hierarchical permissions.
[0021] The condition construction module is used to construct the global search conditions based on the global hierarchical score, the isomorphism results corresponding to each of the row-level permissions, and the data search keywords.
[0022] In one possible implementation, the condition construction module is used for,
[0023] Based on the OR relationship, construct global row-level search conditions according to the homogenization results corresponding to each row-level permission;
[0024] Construct global hierarchical search conditions based on the global hierarchical scores;
[0025] Based on the AND relationship, the global search conditions are constructed using the global row-level search conditions, the global hierarchical search conditions, and the data search keywords.
[0026] In one possible implementation, the score of the hierarchical permission is inversely proportional to the level of the hierarchical permission;
[0027] The score determination module is used to determine the smallest value among the scores of each group of hierarchical permissions as the user's overall hierarchical score.
[0028] In one possible implementation, the target data structure includes a row-level permission field, a hierarchical permission field, a data information field, and a data content field; the row-level permission field is used to set the row-level permissions of the data row, the hierarchical permission field is used to set the hierarchical level of the data table corresponding to the data row, the data information field is used to store basic data information, and the data content field is used to store field information and field value information; the field information refers to the information composed of field names of the same data row, and the field value information refers to the information composed of field values of the same data row.
[0029] In one possible implementation, the data search module is used to match the user's hierarchical permissions with the hierarchical permission field and the user's row-level permissions with the row-level permission field based on the global search conditions.
[0030] Data that successfully matches the user's hierarchical permissions with the hierarchical permission field, and the user's row-level permissions with the row-level permission field, and that matches the data search keywords, is determined as the search results;
[0031] The search results are returned to the client corresponding to the data search request.
[0032] On the other hand, a computer device is provided, the computer device including a processor and a memory, the memory storing at least one computer program, the at least one computer program being loaded and executed by the processor to implement the above-described data search method.
[0033] On the other hand, a computer-readable storage medium is provided, wherein at least one computer program is stored in the computer program, which is loaded and executed by a processor to implement the above-described data search method.
[0034] On the other hand, a computer program product is provided, the computer program product comprising at least one computer program, the computer program being loaded and executed by a processor to implement the data search method provided in the various alternative implementations described above.
[0035] The technical solution provided in this application may include the following beneficial effects:
[0036] The data search method provided in this application embodiment, under the premise of storing data in the database according to the target data structure, when a data search request is received, queries the row-level permission set of the user corresponding to the user information based on the user information contained in the data search request. After isomorphizing each row-level permission contained in the row-level permission set to obtain isomorphic results, a global search condition is constructed based on the isomorphic results of each row-level permission and the search keywords. A global search of data in the database is achieved based on the global search condition. At the same time, user authentication can be achieved based on the user's row-level permissions, so that the data obtained by searching based on the global search condition is the data in the global data of the database that matches the row-level permissions held by the user and matches the search keywords. Thus, while realizing global data retrieval, the data security of the database is guaranteed.
[0037] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0038] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0039] Figure 1 A flowchart illustrating a data search method provided in an exemplary embodiment of this application is shown;
[0040] Figure 2 A flowchart illustrating another data search method provided by an exemplary embodiment of this application is shown;
[0041] Figure 3A block diagram of a data search apparatus provided in an exemplary embodiment of this application is shown;
[0042] Figure 4 This is a structural block diagram of a computer device according to an exemplary embodiment;
[0043] Figure 5 This is a structural block diagram of a computer device according to an exemplary embodiment. Detailed Implementation
[0044] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0045] Figure 1 This application illustrates a flowchart of a data search method provided in an exemplary embodiment. This data search method can be executed by a data search device, which can be implemented as a server or terminal with data search functionality, such as... Figure 1 As shown, the data search method may include the following steps.
[0046] Step 110: Receive a data search request; the data search request contains user information and data search keywords; the user information is the information of the user corresponding to the client that sent the data search request.
[0047] The data search request can be generated by the user entering search keywords based on the search entry provided in the client interface; the data search request can contain user information, which may refer to user login information, such as the account and password information used by the user when logging into the client.
[0048] The data search request may contain one or more search keywords, and this application does not limit the number of search keywords.
[0049] Step 120: Based on the user information, obtain the user's row-level permission set; the row-level permission set contains at least one row-level permission granted to the user; the row-level permission is used to indicate the level of the data rows in the data table that the user can query.
[0050] In this embodiment, the data search device can query the row-level permissions granted to a user based on the user information contained in the data search request. A single user can have multiple row-level permissions, which can be granted based on user attributes. For example, user attributes may include the user's geographical location, job title, etc. For instance, if the user attribute includes the user's geographical location, a user in geographical location A can be granted row-level permissions to the data table corresponding to geographical location A and the data table corresponding to geographical location B, i.e., query permissions to each data row in data table A and data table B. The type of user attributes and the row-level permissions corresponding to each user attribute can be set according to actual needs, and this application does not impose any restrictions on this.
[0051] Step 130: Traverse the row-level permission set, perform isomorphism processing on each row-level permission in the row-level permission set, and obtain the isomorphism result corresponding to each row-level permission; the isomorphism result contains the source table information of the data corresponding to the row-level permission and the row-level permission field information corresponding to the row-level permission.
[0052] In this embodiment of the application, isomorphic processing of row-level permissions refers to converting the row-level permission representation in the initial format into the row-level permission representation in the target format, so as to realize the search of data stored in the database through the target data structure based on the isomorphic row-level permissions.
[0053] Step 140: Based on the homogenization results corresponding to each row-level permission and the data search keywords, construct the global search conditions.
[0054] Step 150: Perform a data search in the database based on the global search criteria; the data in the database is stored based on the target data structure; the target data structure corresponds to the data structure of the isomorphic result.
[0055] In this embodiment, the data in the database is stored based on a target data structure. This data can originate from tables with different table structures. In other words, after homogenization, data from tables with different structures are converted to the target data structure and stored in the database. Therefore, in this embodiment, to achieve a full-domain search, the format of row-level permissions is modified when constructing the full-domain search criteria to correspond to the target data structure used for data storage in the database.
[0056] Because the global search criteria contain a homogeneous structure of the user's various row-level permissions, therefore
[0057] In summary, the data search method provided in this application, under the premise of storing data in the database according to the target data structure, upon receiving a data search request, queries the row-level permission set of the user corresponding to the user information based on the user information contained in the data search request. After isomorphizing each row-level permission in the row-level permission set to obtain isomorphic results, a global search condition is constructed based on the isomorphic results of each row-level permission and the search keywords. A global search of data in the database is achieved based on the global search condition. At the same time, user authentication can be achieved based on the user's row-level permissions, so that the data obtained by searching based on the global search condition is data in the global data of the database that matches the row-level permissions possessed by the user and matches the search keywords. Thus, while realizing global data retrieval, the data security of the database is guaranteed.
[0058] Figure 2 The flowchart shown is another data search method provided by an exemplary embodiment of this application. This data search method can be executed by a data search device, which can be implemented as a server or terminal with data search functionality, such as... Figure 2 As shown, the data search method may include the following steps.
[0059] Step 210: Receive a data search request; the data search request contains user information and data search keywords; the user information is the information of the user corresponding to the client that sent the data search request.
[0060] Step 220: Based on the user information, obtain the user's row-level permission set; the row-level permission set contains at least one row-level permission granted to the user; row-level permissions are used to indicate the level of data rows in the data table that the user can query.
[0061] Optionally, the row-level permissions in the set of row-level permissions obtained by the data search device are stored in a first format, which is illustrative. When row-level permissions are used to indicate the user's query permissions for data rows in the household registration information table, the set of row-level permissions can be represented as [Household Registration Information Table (Place of Origin = City A), Household Registration Information Table (Place of Origin = City B)], where "Household Registration Information Table (Place of Origin = City A)" and "Household Registration Information Table (Place of Origin = City B)" are row-level permissions, and this set of row-level permissions indicates that the user has query permissions for data rows corresponding to City A in the household registration information table, and also has query permissions for data rows corresponding to City B in the household registration information table.
[0062] It is understood that the structure of each row-level permission in the above row-level permission set is illustrative, and the row-level permission set can also be presented in different forms based on different structural settings, which is not restricted in this application.
[0063] Step 230: Traverse the row-level permission set, perform isomorphism processing on each row-level permission in the row-level permission set, and obtain the isomorphism result corresponding to each row-level permission; the isomorphism result contains the source table information of the data corresponding to the row-level permission and the row-level permission field information corresponding to the row-level permission.
[0064] The data search device performs isomorphic processing on each row-level permission in the row-level permission set, converting it into a target format that is compatible with the target data structure of the data stored in the database. In this embodiment, the isomorphic result of the target format can indicate the data table and row-level permission field corresponding to the row-level permission. Schematic, the target format can be represented as: [Source table = XXXX table and row-level permission field 1 = XX and source table = XXXX table and row-level permission field 2 = XX ...]; Taking the row-level permission set used to indicate the user's query permission for data rows in the household registration information table as an example, the isomorphic result of the row-level permission set can be represented as: [Source table = household registration information table and row-level permission field 1 = city A, source table = household registration information table and row-level permission field 2 = city B].
[0065] It should be noted that the data tables corresponding to different row-level permissions can be different. In other words, the source table in the homogenization result of the target format can contain multiple different data tables.
[0066] Step 240: Based on the user information, obtain the user's hierarchical permission set; the hierarchical permission set contains at least one hierarchical permission granted to the user; the hierarchical permission is used to indicate the level of data tables that the user can query.
[0067] In this embodiment, the data search device can query a user's hierarchical permissions based on user information. These hierarchical permissions can indicate the level of data tables a user can query. The level of a data table can indicate its confidentiality level. Depending on actual needs, data tables can be divided into several levels; this application does not limit the level division of data tables. In this embodiment, a user's hierarchical permissions can be granted based on user roles or directly to the user. The hierarchical permissions a user possesses are the union of their own permissions and the user's hierarchical permissions. For example, if a user is an ordinary citizen, they will be automatically granted the permission to query public data tables; if the user is also an employee of an organization (i.e., has an organizational role), they will be granted the permission to query data tables with a certain level of confidentiality.
[0068] Step 250: Determine the user's overall hierarchical score based on the hierarchical permission scores corresponding to each hierarchical permission.
[0069] In this embodiment, the hierarchical permission score is inversely proportional to the level of the hierarchical permission. Therefore, when determining a user's overall hierarchical score, the data search device can determine the smallest score among the hierarchical permission scores corresponding to each group of hierarchical permissions as the user's overall hierarchical score. That is, when a user has multiple hierarchical permissions, the user's overall hierarchical permission is determined by the smallest hierarchical permission score.
[0070] Alternatively, in another possible implementation, the hierarchical permission score is directly proportional to the level of the hierarchical permission; in this case, the device can determine the user's overall hierarchical score as the highest value among the hierarchical permission scores corresponding to each hierarchical permission; in this case, it is also necessary to set the upper limit of hierarchical permissions and the upper limit of hierarchical permission scores.
[0071] In the embodiments of this application, the correspondence between data permission scores and hierarchical permissions can be set by relevant personnel based on actual needs, and this application does not impose any restrictions on this.
[0072] Step 260: Based on the overall hierarchical score, the homogenization results corresponding to each row-level permission, and the data search keywords, construct the overall search conditions.
[0073] Optionally, the process of constructing global search conditions can be implemented as follows:
[0074] Based on the OR relationship, construct global row-level search conditions according to the homogenization results corresponding to each row-level permission;
[0075] Construct global hierarchical search conditions based on global hierarchical scores;
[0076] Based on the AND relationship, construct the overall search criteria by considering the overall row-level search criteria, the overall hierarchical search criteria, and the data search keywords.
[0077] Taking the row-level permission set used to indicate a user's query permissions for data rows in the household registration information table as an example, the global row-level search condition constructed according to the OR relationship can be expressed as: (Source table = Household registration information table and row-level permission field 1 = City A) or (Source table = Household registration information table and row-level permission field 2 = City B).
[0078] Taking the inverse relationship between the hierarchical permission score and the hierarchical permission level as an example, the global hierarchical search condition based on the global hierarchical score can be expressed as: the hierarchical level score of the data table ≥ the global hierarchical score.
[0079] The global search conditions constructed according to the AND relationship can be expressed as: search keyword AND data table hierarchical score ≥ global hierarchical score AND ((source table = household registration information table AND row-level permission field 1 = city A) OR (source table = household registration information table AND row-level permission field 2 = city B)).
[0080] It should be noted that this application does not restrict the order of combination of global row-level search conditions, global hierarchical search conditions, and data search keywords in the global search criteria.
[0081] Step 270: Perform a data search in the database based on the global search criteria; the data in the database is stored based on the target data structure; the target data structure corresponds to the data structure of the isomorphic result.
[0082] The target data structure includes row-level permission fields, hierarchical permission fields, data information fields, and data content fields. The row-level permission fields are used to set the row-level permissions of the data rows, the hierarchical permission fields are used to set the hierarchical level of the data table corresponding to the data rows, the data information fields are used to store basic data information, and the data content fields are used to store field information and field value information. Field information refers to the information composed of field names in the same data row, and field value information refers to the information composed of field values in the same data row.
[0083] In this example, the data in the data information field can be used to describe the primary key, title, category, source table, etc., to describe the basic information of the data table.
[0084] This data content field describes the data content using a generic structure. This structure stores the data through two fields: one for field information, which is obtained by concatenating the field names in the same data row using a target delimiter, and stores the field names corresponding to the data content; and the other for field value information, which is obtained by concatenating the field values in the same data row using a target delimiter, and stores the field values corresponding to the data content. Combining the field information and the field value information yields the complete data.
[0085] Indicatively, the data content stored based on this target data structure can be represented as follows:
[0086] Title: User A
[0087] Source table: Personnel information
[0088] Grading level: 2
[0089] Database name: database_1
[0090] Field information (delimited by target delimiter): identifies gender, age, and place of origin.
[0091] Field value information (delimited by target delimiter): 1 male 18 Beijing
[0092] Row-level permission field 1: Beijing
[0093] The process of searching a database based on global search criteria can be implemented as follows:
[0094] Based on the global search criteria, the user's hierarchical permissions and hierarchical permission fields, and the user's row-level permissions and row-level permission fields are matched respectively.
[0095] Data that successfully matches the user's hierarchical permissions with the hierarchical permission field and the user's row-level permissions with the row-level permission field, and that matches the data search keywords, is identified as the search results.
[0096] The search results are returned to the client that made the data search request.
[0097] In this context, matching a user's hierarchical permissions with the hierarchical permission field can mean that the hierarchical score corresponding to the hierarchical level indicated by the data hierarchical permission field is greater than or equal to the user's global hierarchical score indicated in the global search conditions; matching a user's row-level permissions with the row-level permission field can mean that the information contained in the data's row-level permission field is the same as the information contained in the row-level permission field in the global search conditions.
[0098] In this embodiment of the application, when searching the database using global search conditions, it is possible to obtain search data while also authenticating user hierarchical and row-level permissions. This ensures that the obtained search data is within the user's permission range and meets the user's needs, thus protecting the security of data information in the database while ensuring global search.
[0099] Since multiple search results may be obtained during the global search process, and these search results may come from the same data table or different data tables, in this embodiment of the application, after obtaining the search results based on the global search conditions, the data search device will also integrate and encapsulate the search results according to the source table group to feed back the global search structure to the client, thereby reducing the user operations required when viewing the search results.
[0100] Optionally, the encapsulation process may include: paginating the search results so that they are returned in a paginated manner; and converting the data content format. For example, a portion of the data information field and the data content field can be integrated into a JSON structure, and the integrated result can be returned to the client in a paginated manner so that the client can display the search results. Taking the search results containing the data content of user A as an example, the encapsulated data can be represented as follows:
[0101]
[0102] In summary, the data search method provided in this application, under the premise of storing data in the database according to the target data structure, upon receiving a data search request, queries the row-level permission set of the user corresponding to the user information based on the user information contained in the data search request. After isomorphizing each row-level permission in the row-level permission set to obtain isomorphic results, a global search condition is constructed based on the isomorphic results of each row-level permission and the search keywords. A global search of data in the database is achieved based on the global search condition. At the same time, user authentication can be achieved based on the user's row-level permissions, so that the data obtained by searching based on the global search condition is data in the global data of the database that matches the row-level permissions possessed by the user and matches the search keywords. Thus, while realizing global data retrieval, the data security of the database is guaranteed.
[0103] In addition, hierarchical search conditions based on user-defined permissions can be added to the global search criteria, thereby enabling multi-level verification of user permissions during the data search process and further improving data security in the database.
[0104] Figure 3 A block diagram of a data search apparatus provided in an exemplary embodiment of this application is shown, which can perform the functions described above. Figure 1 or Figure 2 All or part of the steps shown in any embodiment, such as Figure 3 As shown, the data search device may include:
[0105] The request receiving module 310 is used to receive a data search request; the data search request includes user information and data search keywords; the user information is the information of the user corresponding to the client that sent the data search request;
[0106] The first acquisition module 320 is used to acquire a set of row-level permissions for the user based on the user information; the set of row-level permissions includes at least one row-level permission granted to the user; the row-level permissions are used to indicate the level of the data rows in the data table that the user can query;
[0107] Processing module 330 is used to traverse the row-level permission set, perform isomorphism processing on each row-level permission in the row-level permission set, and obtain isomorphism results corresponding to each row-level permission; the isomorphism results include source table information of the data corresponding to the row-level permission and row-level permission field information corresponding to the row-level permission;
[0108] The condition construction module 340 is used to construct global search conditions based on the homogenization results corresponding to each of the row-level permissions and the data search keywords;
[0109] The data search module 350 is used to perform data search in the database based on the global search conditions; the data in the database is stored based on a target data structure; the target data structure corresponds to the data structure of the isomorphism result.
[0110] In one possible implementation, the device further includes:
[0111] The second acquisition module is used to acquire a set of user-level permissions based on the user information; the set of user-level permissions includes at least one level permission granted to the user; the level permission is used to indicate the level of data table that the user can query;
[0112] The score determination module is used to determine the user's overall hierarchical score based on the hierarchical permission score corresponding to each of the aforementioned hierarchical permissions.
[0113] The condition construction module 340 is used to construct the global search conditions based on the global hierarchical score, the homogenization results corresponding to each of the row-level permissions, and the data search keywords.
[0114] In one possible implementation, the condition construction module 340 is used to,
[0115] Based on the OR relationship, construct global row-level search conditions according to the homogenization results corresponding to each row-level permission;
[0116] Construct global hierarchical search conditions based on the global hierarchical scores;
[0117] Based on the AND relationship, the global search conditions are constructed using the global row-level search conditions, the global hierarchical search conditions, and the data search keywords.
[0118] In one possible implementation, the score of the hierarchical permission is inversely proportional to the level of the hierarchical permission;
[0119] The score determination module is used to determine the smallest value among the scores of each group of hierarchical permissions as the user's overall hierarchical score.
[0120] In one possible implementation, the target data structure includes a row-level permission field, a hierarchical permission field, a data information field, and a data content field; the row-level permission field is used to set the row-level permissions of the data row, the hierarchical permission field is used to set the hierarchical level of the data table corresponding to the data row, the data information field is used to store basic data information, and the data content field is used to store field information and field value information; the field information refers to the information composed of field names of the same data row, and the field value information refers to the information composed of field values of the same data row.
[0121] In one possible implementation, the data search module 350 is used to match the user's hierarchical permissions with the hierarchical permission field and the user's row-level permissions with the row-level permission field based on the global search conditions.
[0122] Data that successfully matches the user's hierarchical permissions with the hierarchical permission field, and the user's row-level permissions with the row-level permission field, and that matches the data search keywords, is determined as the search results;
[0123] The search results are returned to the client corresponding to the data search request.
[0124] In summary, the data search device provided in this application embodiment, under the premise of storing data in the database according to the target data structure, when receiving a data search request, queries the row-level permission set of the user corresponding to the user information based on the user information contained in the data search request. After isomorphizing each row-level permission contained in the row-level permission set to obtain isomorphic results, a full-domain search condition is constructed based on the isomorphic results of each row-level permission and the search keywords. A full-domain search of the data in the database is realized based on the full-domain search condition. At the same time, user authentication can be realized based on the user's row-level permissions, so that the data obtained by searching based on the full-domain search condition is the data in the full-domain data of the database that matches the row-level permissions possessed by the user and matches the search keywords. Thus, while realizing full-domain data retrieval, the data security in the database is guaranteed.
[0125] In addition, hierarchical search conditions based on user-defined permissions can be added to the global search criteria, thereby enabling multi-level verification of user permissions during the data search process and further improving data security in the database.
[0126] Figure 4This is a structural block diagram of a computer device 400 according to an exemplary embodiment. This computer device can be implemented as the data search device described above in this application. The computer device 400 includes a Central Processing Unit (CPU) 401, a system memory 404 including Random Access Memory (RAM) 402 and Read-Only Memory (ROM) 403, and a system bus 405 connecting the system memory 404 and the CPU 401. The computer device 400 also includes a mass storage device 406 for storing an operating system 409, application programs 410, and other program modules 411.
[0127] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented using any method or technology for storing information such as computer-readable instructions, data structures, program modules, or other data. Computer storage media include RAM, ROM, erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other solid-state memory technologies, CD-ROM, digital versatile disc (DVD) or other optical storage, magnetic tape cassettes, magnetic tape, disk storage, or other magnetic storage devices. Of course, those skilled in the art will recognize that the computer storage media are not limited to the above-mentioned types. The system memory 404 and mass storage device 406 described above can be collectively referred to as memory.
[0128] According to various embodiments of this application, the computer device 400 can also be connected to a remote computer on a network, such as the Internet. That is, the computer device 400 can be connected to a network 408 via a network interface unit 407 connected to the system bus 405, or the network interface unit 407 can be used to connect to other types of networks or remote computer systems (not shown).
[0129] The memory also includes at least one instruction, at least one program, code set, or instruction set, which are stored in the memory. The central processing unit 401 executes the at least one instruction, at least one program, code set, or instruction set to implement all or part of the steps in the data search methods shown in the above embodiments.
[0130] Figure 5 This is a structural block diagram of a computer device 500 according to an exemplary embodiment. The computer device 500 can be implemented as the aforementioned data search device, such as a smartphone, tablet computer, laptop computer, desktop computer, smartwatch, and television. The computer device 500 may also be referred to as a user device, portable terminal, laptop terminal, desktop terminal, or other names.
[0131] Typically, computer device 500 includes a processor 501 and a memory 502.
[0132] In some embodiments, the computer device 500 may also optionally include a peripheral device interface 503 and at least one peripheral device. The processor 501, memory 502, and peripheral device interface 503 can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface 503 via a bus, signal line, or circuit board. Specifically, the peripheral device includes at least one of the following: a radio frequency circuit 504, a display screen 505, a camera assembly 506, an audio circuit 507, and a power supply 508.
[0133] In some embodiments, the computer device 500 further includes one or more sensors 509. The one or more sensors 509 include, but are not limited to, an accelerometer 510, a gyroscope 511, a pressure sensor 512, an optical sensor 513, and a proximity sensor 514.
[0134] Those skilled in the art will understand that Figure 5 The structure shown does not constitute a limitation on the computer device 500, and may include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0135] In one exemplary embodiment, a computer-readable storage medium is also provided, which stores at least one computer program that is loaded and executed by a processor to implement all or part of the steps in the data search method described above. For example, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), magnetic tape, floppy disk, or optical data storage device, etc.
[0136] In one exemplary embodiment, a computer program product is also provided, comprising at least one computer program that is loaded and executed by a processor. Figure 1 or Figure 2 All or part of the steps of the data search method shown in any embodiment.
[0137] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the claims.
[0138] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A data search method, characterized in that, The method includes: Receive a data search request; the data search request contains user information and data search keywords; the user information is the information of the user corresponding to the client that sent the data search request; Based on the user information, obtain the user's row-level permission set; the row-level permission set contains at least one row-level permission granted to the user; the row-level permission is used to indicate the level of the data row in the data table that the user can query; Traverse the set of row-level permissions, perform isomorphism processing on each row-level permission in the set of row-level permissions, and obtain the isomorphism result corresponding to each row-level permission; the isomorphism result includes the source table information of the data corresponding to the row-level permission and the row-level permission field information corresponding to the row-level permission; Based on the user information, obtain the user's hierarchical permission set; the hierarchical permission set contains at least one hierarchical permission granted to the user; the hierarchical permission is used to indicate the level of the data table that the user can query; Based on the level permission scores corresponding to each of the aforementioned level permissions, determine the user's overall level score; Based on the overall hierarchical score, the isomorphism results corresponding to each row-level permission, and the data search keywords, construct the overall search conditions; Data is searched in the database based on the global search criteria; the data in the database is stored based on the target data structure; the target data structure corresponds to the data structure of the isomorphism result.
2. The method according to claim 1, characterized in that, The process of constructing the global search conditions based on the overall hierarchical score, the isomorphism results corresponding to each row-level permission, and the data search keywords includes: Based on the OR relationship, construct global row-level search conditions according to the homogenization results corresponding to each row-level permission; Construct global hierarchical search conditions based on the global hierarchical scores; Based on the AND relationship, the global search conditions are constructed using the global row-level search conditions, the global hierarchical search conditions, and the data search keywords.
3. The method according to claim 1, characterized in that, The score for the hierarchical permission is inversely proportional to the level of the hierarchical permission. The step of determining the user's overall hierarchical score based on the hierarchical permission scores corresponding to each of the hierarchical permissions includes: The smallest value among the hierarchical permission scores corresponding to each group of hierarchical permissions is determined as the user's overall hierarchical score.
4. The method according to any one of claims 1 to 3, characterized in that, The target data structure includes row-level permission fields, hierarchical permission fields, data information fields, and data content fields. The row-level permission fields are used to set the row-level permissions of data rows, the hierarchical permission fields are used to set the hierarchical level of the data table corresponding to the data row, the data information fields are used to store basic data information, and the data content fields are used to store field information and field value information. The field information refers to the information composed of field names in the same data row, and the field value information refers to the information composed of field values in the same data row.
5. The method according to claim 4, characterized in that, The data search in the database based on the global search criteria includes: Based on the global search conditions, the user's hierarchical permissions and hierarchical permission fields are matched respectively, and the user's row-level permissions and row-level permission fields are matched respectively; Data that successfully matches the user's hierarchical permissions with the hierarchical permission field, and the user's row-level permissions with the row-level permission field, and that matches the data search keywords, is determined as the search results; The search results are returned to the client corresponding to the data search request.
6. A data search device, characterized in that, The device includes: A request receiving module is used to receive data search requests; the data search request includes user information and data search keywords; the user information is the information of the user corresponding to the client that sent the data search request; The first acquisition module is used to acquire a set of row-level permissions for the user based on the user information; the set of row-level permissions includes at least one row-level permission granted to the user; the row-level permissions are used to indicate the level of the data rows in the data table that the user can query; The processing module is used to traverse the row-level permission set, perform isomorphism processing on each row-level permission in the row-level permission set, and obtain the isomorphism result corresponding to each row-level permission; the isomorphism result includes the source table information of the data corresponding to the row-level permission and the row-level permission field information corresponding to the row-level permission; The second acquisition module is used to acquire a set of user-level permissions based on the user information; the set of user-level permissions includes at least one level permission granted to the user; the level permission is used to indicate the level of data table that the user can query; The score determination module is used to determine the user's overall hierarchical score based on the hierarchical permission score corresponding to each of the aforementioned hierarchical permissions. The condition construction module is used to construct global search conditions based on the global hierarchical score, the isomorphism results corresponding to each row-level permission, and the data search keywords. The data search module is used to perform data searches in the database based on the global search conditions; the data in the database is stored based on a target data structure; the target data structure corresponds to the data structure of the isomorphism result.
7. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one computer program, which is loaded and executed by the processor to implement the data search method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one computer program, which is loaded and executed by a processor to implement the data search method as described in any one of claims 1 to 5.