CN112783952A - Method for constructing result set based on electronic official document keyword query - Google Patents
Method for constructing result set based on electronic official document keyword query Download PDFInfo
- Publication number
- CN112783952A CN112783952A CN202110279388.3A CN202110279388A CN112783952A CN 112783952 A CN112783952 A CN 112783952A CN 202110279388 A CN202110279388 A CN 202110279388A CN 112783952 A CN112783952 A CN 112783952A
- Authority
- CN
- China
- Prior art keywords
- redis
- query
- electronic document
- electronic
- constructing
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 31
- 238000010586 diagram Methods 0.000 claims abstract description 15
- 238000012217 deletion Methods 0.000 claims description 3
- 230000037430 deletion Effects 0.000 claims description 3
- 238000011161 development Methods 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/28—Databases characterised by their database models, e.g. relational or object models
- G06F16/284—Relational databases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/248—Presentation of query results
Abstract
The invention discloses a method for constructing a result set based on electronic official document keyword query, which relates to the technical field of relational databases and is realized by the following steps: constructing tuple storage information of the electronic document keywords based on the electronic document titles of the relational database, and storing the tuple storage information into redis; acquiring an incidence relation of a pattern diagram in a relational database, storing the incidence relation into redis, and constructing a query structure set based on a main foreign key relation between tables by the redis; based on the keywords of the electronic document title, inquiring in redis to obtain related tuple storage information, and combining to obtain a new data table; based on the incidence relation of the pattern diagram in the redis, inquiring to obtain a data table set related to the new data table and a main foreign key relation among tables in the set; and automatically constructing a query sql engine based on the main foreign key relation between the tables, and querying a relational database by the query sql engine based on sql sentences of the main table and the connection slave table to obtain a result set of the input keywords. The invention can quickly inquire and obtain the required content from the massive electronic documents.
Description
Technical Field
The invention relates to the technical field of relational databases, in particular to a method for constructing a result set based on keyword query of electronic documents.
Background
With the rapid development of informatization, electronic office becomes a main mode of daily work communication in the government and enterprise industry, and electronic documents become an important form of information transmission, communication and storage of the government and enterprise. How to enable users to quickly and comprehensively find required complete contents from massive electronic documents at any time becomes important.
At present, business data of the electronic official document system are stored through a relational database, and complete data are dispersedly stored in a plurality of relational tables. The query requirement of an ordinary user on data is an important aspect for embodying the value of the data. The traditional query method for the relational database has the main problems that: the query based on the keywords has limited and fuzzy query intentions and the accuracy of the result obtained by the keyword query is not high; in addition, because the ambiguity of the natural language is large, the inquiry mode based on the natural language makes the computer processing difficult, and the practicability is poor.
Based on this, in order to accurately query the required content, a developer needs to design different sql from the database level according to the requirements to complete the query, different users have different requirements, and from the development perspective, the query is undoubtedly a continuous modification and continuous improvement process, which will greatly increase the workload of the developer.
Disclosure of Invention
Aiming at the requirements and the defects of the prior art development, the invention provides a method for constructing a result set based on the keyword query of an electronic official document, and solves the problems of low accuracy of the conventional query result and complicated query process.
The invention discloses a method for constructing a result set based on electronic official document keyword query, which adopts the following technical scheme for solving the technical problems:
a method for constructing a result set based on an electronic official document keyword query realizes the following contents:
s1, constructing tuple storage information of the electronic document keywords based on the electronic document titles of the relational database, and storing the tuple storage information into redis;
s2, acquiring the incidence relation of the pattern diagram in the relational database, storing the incidence relation into redis, and constructing a query structure set based on the main foreign key relation between the table and the table in the pattern diagram by the redis;
step S3, based on the keywords of the electronic official document title, inquiring in redis to obtain related tuple storage information, and combining the tuple storage information to obtain a new data table;
step S4, based on the association relationship of the pattern diagram in the redis, inquiring to obtain a data table set related to the new data table and a main foreign key relationship between the tables in the data table set;
and step S5, automatically constructing a query sql engine based on the main foreign key relation between the tables in the data table set, and querying the relational database by the query sql engine based on the sql sentences of the main table and the connection slave table to obtain a result set of the input keywords.
Optionally, step S1 is executed to construct tuple storage information of the electronic document keyword, where the specific operation flow is as follows:
s1.1, calling redis to store the title and the information of the electronic document when the electronic document is created;
and S1.2, calling redis to judge whether the electronic document has the table information or not, judge whether the table information of the electronic document is consistent with the tuple identification or not and update or insert the table information of the electronic document when the tuple identification is inconsistent in the electronic document circulation process.
Preferably, the electronic document information includes information contained in the electronic document information table and record identifiers of the electronic document information table.
Further optionally, when deletion operation is involved in the process of transferring the related electronic documents, the related cache of the redis is directly deleted.
Further optionally, step S2 is executed, when acquiring the association relationship of the pattern diagram in the relationship database, specifically acquiring the primary key and the foreign key of the table and the name of the table associated with the foreign key, and storing the acquired information through a hash storage structure of redis, where the name tableName of the table is used as a key value, the field value is the table name associated with the foreign key, and the value is the primary key of the primary table and the foreign key of the association table.
Further optionally, step S3 is executed, based on the keywords of the electronic document titles, related tuple storage information is obtained through querying in the redis, in this process, a loop query is performed on the selected keywords of one or more electronic document titles, and the electronic document titles are in one-to-one correspondence with the database table.
Further optionally, when querying is performed in the redis based on the keyword of the electronic document title, if the query is not completed, null is returned, otherwise, the name tableName of the table and the tuple identifier id are stored, and finally tuple storage information related to the keyword is returned.
Further optionally, step S5 is executed, and based on the main foreign key relationship between the tables in the data table set, an inner join select is performed through the electronic document information table, so as to automatically construct a query sql engine.
Preferably, the query sql engine calls the link of the JDBC to query the relational database based on the sql statement of the link slave table of the master table.
Compared with the prior art, the method for constructing the result set based on the keyword query of the electronic official document has the beneficial effects that:
the invention can obtain the required complete content from the massive electronic documents in the relational database by the searching mode of the keywords of the electronic documents, and establish the result set based on the query content, thereby improving the query efficiency and reducing the workload.
Drawings
FIG. 1 is a schematic diagram of an implementation architecture of the present invention.
Detailed Description
In order to make the technical scheme, the technical problems to be solved and the technical effects of the present invention more clearly apparent, the following technical scheme of the present invention is clearly and completely described with reference to the specific embodiments.
The first embodiment is as follows:
with reference to fig. 1, this embodiment provides a method for constructing a result set based on an electronic official document keyword query, and the implementation content includes:
step S1, based on the electronic document title of the relational database, constructing tuple storage information of the electronic document key words, and storing the tuple storage information into redis, wherein the specific operation flow is as follows:
s1.1, calling redis to store the title of the electronic document and the electronic document information when the electronic document is created, wherein the electronic document information comprises information contained in an electronic document information table and record identification of the electronic document information table;
s1.2, calling redis to judge whether the electronic document has the table information or not, judge whether the table information of the electronic document is consistent with the tuple identification or not and update or insert the table information of the electronic document when the tuple identification is inconsistent in the process of transferring the electronic document;
and S1.3, when deletion operation is involved in the electronic document circulation process, directly deleting the relevant cache of the redis.
And step S2, acquiring the incidence relation of the pattern diagram in the relational database, storing the incidence relation into redis, and constructing a query structure set based on the main foreign key relation between the table and the table in the pattern diagram by the redis.
In this step, when obtaining the association relationship of the pattern diagram in the relationship database, specifically obtaining the primary key and the foreign key of the table and the name of the table associated with the foreign key, and storing the obtained information through the hash storage structure of redis, at this time, the name tableName of the table is used as the key value, the field value is the table name associated with the foreign key, and the value is the primary key of the primary table and the foreign key of the association table.
And step S3, based on the keywords of the electronic official document title, inquiring in redis to obtain related tuple storage information, and combining the tuple storage information to obtain a new data table.
In the process, the key words of one or more selected electronic official document titles are circularly inquired, and the electronic official document titles are in one-to-one correspondence with the database tables.
When the query is carried out in the redis based on the key words of the electronic official document title, if the query is not available, null is returned, otherwise, the name tableName of the table and the tuple identification id are stored, and finally tuple storage information related to the key words is returned.
And step S4, based on the association relationship of the schema diagram in the redis, inquiring to obtain a data table set related to the new data table and a main foreign key relationship between tables in the data table set.
And step S5, performing inner join selection through the electronic official document information table based on the main foreign key relation between the tables in the data table set, automatically constructing a query sql engine, calling the connection of JDBC by the query sql engine based on the sql statement of the main table connected with the slave table, and querying the relational database to obtain a result set of the input keywords.
In summary, by adopting the method for constructing the result set based on the electronic official document keyword query, the required complete content can be obtained from the massive electronic official documents in the relational database by the search mode of the electronic official document keywords, and the result set based on the query content is established, so that the query efficiency is improved, and the workload is reduced.
The principles and embodiments of the present invention have been described in detail using specific examples, which are provided only to aid in understanding the core technical content of the present invention. Based on the above embodiments of the present invention, those skilled in the art should make any improvements and modifications to the present invention without departing from the principle of the present invention, and therefore, the present invention should fall into the protection scope of the present invention.
Claims (9)
1. A method for constructing a result set based on keyword query of an electronic official document is characterized in that the implementation content comprises the following steps:
s1, constructing tuple storage information of the electronic document keywords based on the electronic document titles of the relational database, and storing the tuple storage information into redis;
s2, acquiring the incidence relation of the pattern diagram in the relational database, storing the incidence relation into redis, and constructing a query structure set based on the main foreign key relation between the table and the table in the pattern diagram by the redis;
step S3, based on the keywords of the electronic official document title, inquiring in redis to obtain related tuple storage information, and combining the tuple storage information to obtain a new data table;
step S4, based on the association relationship of the pattern diagram in the redis, inquiring to obtain a data table set related to the new data table and a main foreign key relationship between the tables in the data table set;
and step S5, automatically constructing a query sql engine based on the main foreign key relation between the tables in the data table set, and querying the relational database by the query sql engine based on the sql sentences of the main table and the connection slave table to obtain a result set of the input keywords.
2. The method for constructing a result set based on an electronic official document keyword query as claimed in claim 1, wherein step S1 is executed to construct tuple storage information of the electronic official document keyword, and the specific operation flow is as follows:
s1.1, calling redis to store the title and the information of the electronic document when the electronic document is created;
and S1.2, calling redis to judge whether the electronic document has the table information or not, judge whether the table information of the electronic document is consistent with the tuple identification or not and update or insert the table information of the electronic document when the tuple identification is inconsistent in the electronic document circulation process.
3. The method of claim 2, wherein the electronic document information comprises information contained in an electronic document information table and record identifiers of the electronic document information table.
4. The method for constructing a result set based on an electronic official document keyword query as claimed in claim 2, wherein when deletion operation is involved in the electronic official document circulation process, the relevant cache of redis is directly deleted.
5. The method as claimed in claim 3, wherein the step S2 is executed to specifically obtain the main key and the foreign key of the table and the name of the table associated with the foreign key when obtaining the association relationship of the pattern diagram in the relational database, and store the obtained information through a hash storage structure of redis, where the table name tableName of the table is used as a key value, the field value is the table name associated with the foreign key, and the value is the main key of the main table and the foreign key of the association table.
6. The method for constructing result set based on electronic document keyword query as claimed in claim 5, wherein step S3 is executed, the related tuple storage information is obtained by querying in redis based on the keywords of the electronic document titles, in this process, the selected keywords of one or more electronic document titles are queried cyclically, and the electronic document titles are in one-to-one correspondence with the database tables.
7. The method as claimed in claim 6, wherein when querying is performed on the basis of the keyword of the electronic document title in redis, if the query is not completed, null is returned, otherwise, the table name tableName and the tuple identifier id are stored, and finally tuple storage information related to the keyword is returned.
8. The method for constructing result set based on electronic official document keyword query as claimed in any one of claims 1-7, characterized in that step S5 is executed, and the query sql engine is automatically constructed by performing inner join select through the electronic official document information table based on the main foreign key relationship between the tables and the table in the data table set.
9. The method of claim 8, wherein the query sql engine invokes a link of JDBC to query the relational database based on sql statements of the linked slave tables of the master table.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110279388.3A CN112783952A (en) | 2021-03-16 | 2021-03-16 | Method for constructing result set based on electronic official document keyword query |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110279388.3A CN112783952A (en) | 2021-03-16 | 2021-03-16 | Method for constructing result set based on electronic official document keyword query |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112783952A true CN112783952A (en) | 2021-05-11 |
Family
ID=75762608
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110279388.3A Pending CN112783952A (en) | 2021-03-16 | 2021-03-16 | Method for constructing result set based on electronic official document keyword query |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112783952A (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104573039A (en) * | 2015-01-19 | 2015-04-29 | 北京航天福道高技术股份有限公司 | Keyword search method of relational database |
US20150120775A1 (en) * | 2013-10-24 | 2015-04-30 | Microsoft Corporation | Answering relational database queries using graph exploration |
CN105975488A (en) * | 2016-04-25 | 2016-09-28 | 哈尔滨工程大学 | Method for querying keyword based on topic cluster unit in relational database |
-
2021
- 2021-03-16 CN CN202110279388.3A patent/CN112783952A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150120775A1 (en) * | 2013-10-24 | 2015-04-30 | Microsoft Corporation | Answering relational database queries using graph exploration |
CN104573039A (en) * | 2015-01-19 | 2015-04-29 | 北京航天福道高技术股份有限公司 | Keyword search method of relational database |
CN105975488A (en) * | 2016-04-25 | 2016-09-28 | 哈尔滨工程大学 | Method for querying keyword based on topic cluster unit in relational database |
Non-Patent Citations (1)
Title |
---|
戴经国等: "关系数据库的关键词检索", 《计算机系统应用》 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109299102B (en) | HBase secondary index system and method based on Elastcissearch | |
EP2605158B1 (en) | Mixed join of row and column database tables in native orientation | |
US11893022B2 (en) | Computer-implemented method for improving query execution in relational databases normalized at level 4 and above | |
US10311055B2 (en) | Global query hint specification | |
US9390115B2 (en) | Tables with unlimited number of sparse columns and techniques for an efficient implementation | |
US7769769B2 (en) | Methods and transformations for transforming metadata model | |
US7707168B2 (en) | Method and system for data retrieval from heterogeneous data sources | |
US8412746B2 (en) | Method and system for federated querying of data sources | |
CN102929878B (en) | A kind of databases comparison management method and device | |
US20100299367A1 (en) | Keyword Searching On Database Views | |
US9665607B2 (en) | Methods and apparatus for organizing data in a database | |
US20060036633A1 (en) | System for indexing ontology-based semantic matching operators in a relational database system | |
US20220083618A1 (en) | Method And System For Scalable Search Using MicroService And Cloud Based Search With Records Indexes | |
CN105975617A (en) | Multi-partition-table inquiring and processing method and device | |
WO2014169265A1 (en) | Storing and querying graph data in a key-value store | |
EP1081610A2 (en) | Methods for transforming metadata models | |
US20080114733A1 (en) | User-structured data table indexing | |
CN112231321B (en) | Oracle secondary index and index real-time synchronization method | |
US10592506B1 (en) | Query hint specification | |
US7299224B2 (en) | Method and infrastructure for processing queries in a database | |
Chaudhuri et al. | Storing XML (with XSD) in SQL databases: Interplay of logical and physical designs | |
CN112783952A (en) | Method for constructing result set based on electronic official document keyword query | |
Carey et al. | Data access interoperability in the IBM database family | |
Höpfner et al. | Towards Trie-Based Query Caching in Mobile DBS | |
Blakeley et al. | Distributed/heterogeneous query processing in Microsoft SQL server |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20210511 |
|
RJ01 | Rejection of invention patent application after publication |