Methods and systems for constructing formatted documents, and methods and systems for text search.

By using an embedded database to build an index in the layout document, the problem of low search efficiency in traditional layout documents is solved, enabling fast keyword search and full-text retrieval, thus improving search speed.

CN115934879BActive Publication Date: 2026-03-06AEROSPACE FOXIT SOFTWARE (BEIJING) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-19
Publication Date
2026-03-06

AI Technical Summary

Technical Problem

Traditional document layouts suffer from low keyword search efficiency and a lack of keyword indexing mechanisms, resulting in slow search speeds.

Method used

An embedded database is used to build the index, and index data tables and page index tables are built through word segmentation. Combined with a full-text search engine, it enables fast keyword search in layout documents.

Benefits of technology

It improves the search speed for keywords in formatted documents by an order of magnitude, and facilitates full-text search functionality in offline scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115934879B_ABST
    Figure CN115934879B_ABST
Patent Text Reader

Abstract

This invention belongs to the field of data indexing, and particularly relates to a method and system for constructing formatted documents, and a method and system for text search. The method includes: recording each keyword and the text object containing each keyword to construct an index data table; constructing a page index table using the text object containing each keyword and the page number of each text object; recording document verification information, index data generation time, and word segmentation method parameters when the formatted document is indexed as an index parameter table; and embedding an embedded database consisting of the index data table, index parameter table, and page index table as a document attachment into the formatted document to construct the formatted document. By utilizing a local embedded database combined with a full-text search engine, rapid keyword search within the formatted document is achieved. Its search speed is orders of magnitude faster than traditional linear text matching methods, and full-text retrieval functionality can be easily implemented in offline scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of data indexing, and particularly relates to methods and systems for constructing formatted documents and methods and systems for text search. Background Technology

[0002] Traditional keyword search in layout document applications relies on conventional text matching, linearly matching keywords across the entire document. When the document content is large, keyword search efficiency is very low. This is primarily due to the lack of a keyword indexing mechanism, resulting in slow search speeds. Summary of the Invention

[0003] The technical problem to be solved by the present invention is to provide a method and system for constructing formatted documents and a method and system for text search.

[0004] The technical solution of this invention to solve the above-mentioned technical problems is as follows: A method for constructing formatted documents using an embedded database, comprising:

[0005] Step 1: By segmenting all text content in the layout document into words, record each keyword obtained and the text object containing each keyword, and build an index data table;

[0006] Step 2: Construct a page index table using the text object containing each keyword and the page number where each text object is located;

[0007] Step 3: The document modification time and document version number of the layout document when the index data table is built by word segmentation constitute document verification information. The document verification information, the index data generation time of the index data table, and the word segmentation method parameters are used to construct an index parameter table. The embedded database composed of the index data table, the index parameter table, and the page index table is embedded as a document attachment into the layout document to construct a layout document that supports text search using the embedded index database.

[0008] The beneficial effects of this invention are: by utilizing a local embedded database combined with a full-text search engine, it enables rapid keyword searching within formatted documents. Its search speed is orders of magnitude faster than traditional linear text matching methods, and it can conveniently implement full-text retrieval functionality in offline scenarios.

[0009] Based on the above technical solution, the present invention can be further improved as follows.

[0010] Furthermore, the index data table also includes: the location information of the text object containing each keyword.

[0011] Furthermore, after constructing the document verification information from the document modification time and document version number when the index data table is created through word segmentation, the document also includes:

[0012] The document verification information consisting of the document modification time and document version number recorded in the index parameter table when generating the index data is used as the baseline verification data, and the actual modification time and document version number of the current version document are used as the actual verification data. The baseline verification data and the actual verification data are compared to confirm the validity of the index data table.

[0013] Alternatively, the index generation time recorded in the index parameter table can be used as the index base time, the modification time of the current version document can be obtained as the document modification time, and it can be determined whether the index base time is later than the document modification time to confirm the validity of the index data table.

[0014] When the index data table of the layout document is valid, the index data table is determined to be an index data table that allows text search.

[0015] Furthermore, the process for determining the benchmark verification data is as follows:

[0016] The first document modification time and the first document version number of the formatted document are defined as the benchmark verification data.

[0017] Alternatively, the modification time and version number of the second document after the text content of the formatted document supporting text search using an embedded index database can be defined as the benchmark verification data.

[0018] Furthermore, the process for determining the index reference time is as follows:

[0019] The time when the text content is segmented and indexed after the version update of the document is completed is defined as the index baseline time.

[0020] Alternatively, the time when the keyword list is updated after modifying the content of the formatted document to support text search using an embedded index database, and then the time of creating the new index data is defined as the index baseline time.

[0021] Another technical solution of the present invention to solve the above-mentioned technical problems is as follows: A text search method, comprising:

[0022] Determine whether a layout document constructed using a layout document construction method that uses an embedded database supports text search using an embedded index database.

[0023] When the determination result is that it supports text search using an embedded index database, it is determined whether the embedded database in the layout document that supports text search using an embedded index database contains a valid index data table and a valid page index table.

[0024] When the judgment result is that it contains a valid index data table and a valid page index table, obtain the text data to be searched entered by the user;

[0025] Based on the word segmentation method for layout documents that support text search using embedded index databases, the text data to be searched is segmented to obtain a keyword list;

[0026] Based on the keyword list, search the index data table for the text object containing each keyword in the keyword list;

[0027] Based on the text object containing each keyword, search the page index table for the page number where the text object containing each keyword is located;

[0028] Render the page corresponding to the page number where the text object containing each keyword is located, and highlight the keyword.

[0029] The beneficial effects of this invention are: by utilizing a local embedded database combined with a full-text search engine, it enables rapid keyword searching within formatted documents. Its search speed is orders of magnitude faster than traditional linear text matching methods, and it can conveniently implement full-text retrieval functionality in offline scenarios.

[0030] Another technical solution of the present invention to solve the above-mentioned technical problems is as follows: A formatted document building system using an embedded database, comprising:

[0031] The first module is used to: segment all text content of the layout document, record each keyword and the text object containing each keyword, and build an index data table;

[0032] The second module is used to: construct a page index table using the text object containing each keyword and the page number where each text object is located;

[0033] The construction module is used to: construct document verification information by taking the document modification time and document version number when the index data table is built through word segmentation of the layout document; construct an index parameter table by combining the document verification information, the index data generation time of the index data table, and the word segmentation method parameters; and embed the embedded database composed of the index data table, the index parameter table, and the page index table as a document attachment into the layout document to construct a layout document that supports text search using the embedded index database.

[0034] The beneficial effects of this invention are: by utilizing a local embedded database combined with a full-text search engine, it enables rapid keyword searching within formatted documents. Its search speed is orders of magnitude faster than traditional linear text matching methods, and it can conveniently implement full-text retrieval functionality in offline scenarios.

[0035] Furthermore, the index data table also includes: the location information of the text object containing each keyword.

[0036] Furthermore, it also includes:

[0037] The verification module is used to: use the document verification information consisting of the document modification time and document version number recorded in the index parameter table when generating the index data as the benchmark verification data, use the actual modification time and document version number of the current version document as the actual verification data, compare the benchmark verification data and the actual verification data to confirm the validity of the index data table.

[0038] Alternatively, the index generation time recorded in the index parameter table can be used as the index base time, the modification time of the current version document can be obtained as the document modification time, and it can be determined whether the index base time is later than the document modification time to confirm the validity of the index data table.

[0039] When the index data table of the layout document is valid, the index data table is determined to be an index data table that allows text search.

[0040] Furthermore, the process for determining the benchmark verification data is as follows:

[0041] The first document modification time and the first document version number of the formatted document are defined as the benchmark verification data.

[0042] Alternatively, the modification time and version number of the second document after the text content of the formatted document supporting text search using an embedded index database can be defined as the benchmark verification data.

[0043] Furthermore, the process for determining the index reference time is as follows:

[0044] The time when the text content is segmented and indexed after the version update of the document is completed is defined as the index baseline time.

[0045] Alternatively, the time when the keyword list is updated after modifying the content of the formatted document to support text search using an embedded index database, and then the time of creating the new index data is defined as the index baseline time.

[0046] Another technical solution of the present invention to solve the above-mentioned technical problems is as follows: A text search system, comprising:

[0047] The determination module is used to determine whether a layout document constructed by a layout document construction method that uses an embedded database supports text search using an embedded index database.

[0048] The first result module is used to: when the determination result is that text search using an embedded index database is supported, determine whether the embedded database in the layout document that supports text search using an embedded index database contains a valid index data table and a valid page index table;

[0049] The second result module is used to: obtain the user-inputted text data when the judgment result is that it contains a valid index data table and a valid page index table;

[0050] The processing module is used to: perform word segmentation on the text data to be searched based on the word segmentation method for the layout document that supports text search using an embedded index database, and obtain a keyword list;

[0051] The first search module is used to: search the index data table for the text object containing each keyword in the keyword list, based on the keyword list;

[0052] The second search module is used to: search the page index table for the page number where the text object containing each keyword is located, based on the text object containing each keyword.

[0053] The rendering module is used to render the page corresponding to the page number where the text object containing each keyword is located, and to highlight the keyword.

[0054] The beneficial effects of this invention are: by utilizing a local embedded database combined with a full-text search engine, it enables rapid keyword searching within formatted documents. Its search speed is orders of magnitude faster than traditional linear text matching methods, and it can conveniently implement full-text retrieval functionality in offline scenarios.

[0055] Another technical solution of the present invention to solve the above-mentioned technical problems is as follows: a storage medium storing instructions, wherein when a computer reads the instructions, the computer executes the method described in any of the above-mentioned methods.

[0056] The beneficial effects of this invention are: by utilizing a local embedded database combined with a full-text search engine, it enables rapid keyword searching within formatted documents. Its search speed is orders of magnitude faster than traditional linear text matching methods, and it can conveniently implement full-text retrieval functionality in offline scenarios.

[0057] Another technical solution of the present invention to solve the above-mentioned technical problems is as follows: an electronic device, including the above-mentioned storage medium and a processor that executes the instructions in the above-mentioned storage medium.

[0058] The beneficial effects of this invention are: by utilizing a local embedded database combined with a full-text search engine, it enables rapid keyword searching within formatted documents. Its search speed is orders of magnitude faster than traditional linear text matching methods, and it can conveniently implement full-text retrieval functionality in offline scenarios. Attached Figure Description

[0059] Figure 1 This is a flowchart illustrating an embodiment of a layout document construction method using an embedded database according to the present invention.

[0060] Figure 2 This is a flowchart illustrating an embodiment of a text search method according to the present invention.

[0061] Figure 3 This is a structural framework diagram of a layout document building system using an embedded database according to the present invention.

[0062] Figure 4 This is a structural framework diagram provided for an embodiment of a text search system according to the present invention;

[0063] Figure 5 This is a simplified diagram illustrating the construction process of a layout document construction method using an embedded database, as provided in an embodiment of the present invention. Detailed Implementation

[0064] The principles and features of the present invention are described below. The examples given are only for explaining the present invention and are not intended to limit the scope of the present invention.

[0065] like Figure 1 As shown, a method for constructing formatted documents using an embedded database includes:

[0066] Step 1: By segmenting all text content in the layout document into words, record each keyword obtained and the text object containing each keyword, and build an index data table;

[0067] Step 2: Construct a page index table using the text object containing each keyword and the page number where each text object is located;

[0068] Step 3: The document modification time and document version number of the layout document when the index data table is built by word segmentation constitute document verification information. The document verification information, the index data generation time of the index data table, and the word segmentation method parameters are used to construct an index parameter table. The embedded database composed of the index data table, the index parameter table, and the page index table is embedded as a document attachment into the layout document to construct a layout document that supports text search using the embedded index database.

[0069] In some possible implementations, a local embedded database combined with a full-text search engine can be used to achieve fast keyword searching in formatted documents. This search speed is orders of magnitude faster than traditional linear text matching methods and can be easily implemented in offline scenarios.

[0070] It's important to note that the word segmentation method parameters record the word segmentation module used and its necessary parameters. In full-text search applications, the word segmentation module uses a predefined word segmentation algorithm to cut and extract multiple meaningful keywords from continuous text. Recording the word segmentation method parameters is crucial because after a user inputs the text to be searched, the same word segmentation module and method parameters must be used to segment the user's input text to ensure matching with keywords recorded in the embedded index database.

[0071] This invention is applicable to large, formatted documents with substantial text content. If the file is larger than 200MB, the response time for text search may exceed 10 seconds, resulting in a degraded user experience. This applies to specialized reference books such as the Cihai dictionary.

[0072] In layout documents, text objects typically refer to the content of each page, described by page objects. A page object contains one or more content objects, such as text objects and image objects, depending on the content to be displayed (text, images, or others). The content objects define specific information such as the displayed text content, position, font size, and color.

[0073] like Figure 5 As shown, the method and specifications for embedding database files in layout documents are as follows:

[0074] Layout documents often allow for the addition of application-required data as attachments. This attachment data may be unrelated to the document's rendering effect; it only defines the associated application or purpose of the attachment. The following is a specification for designing an embedded index database using an attachment mechanism:

[0075] 1. Embed the attachment description file in the document root node.

[0076] The root node of the document should define a description file containing the embedded database file attachments. Taking the root node of an OFD document, Document.xml, as an example, the Attachments node defines the description file for the attachment files, as follows:

[0077] <?xml version="1.0"encoding="UTF-8"?>

[0078] <ofd:document xmlns:ofd="http: / / www.ofdspec.org">

[0079] <ofd:commondata>

[0080] <ofd:pagearea>

[0081] <ofd:physicalbox> 0 0 215.899994 279.399994< / ofd:physicalbox>

[0082] < / ofd:pagearea>

[0083] <ofd:maxunitid> 210< / ofd:maxunitid>

[0084] <ofd:publicres> PublicRes.xml< / ofd:publicres>

[0085] <ofd:documentres> DocumentRes.xml< / ofd:documentres>

[0086] < / ofd:commondata>

[0087] <ofd:pages>

[0088] <ofd:page ID="1" BaseLoc="Pages / Page_0 / Content.xml" / >

[0089] < / ofd:pages>

[0090] <ofd:attachments> Attachments.xml< / ofd:attachments>

[0091] <ofd:annotations> Annotations.xml< / ofd:annotations>

[0092] < / ofd:document>

[0093] in <ofd:attachments> Attachments.xml< / ofd:attachments> The node describes the description file for the embedded attachment.

[0094] 2. The attached description file specifies the embedded database file.

[0095] The embedded database file and its usage attributes should be defined in the attachment description file. Taking the OFD document's Attachment.xml as an example, the node... <ofd:attachment ID="101" … / > The following is an example of an attachment file node representing an embedded database file:

[0096] <?xml version="1.0"encoding="UTF-8"?>

[0097] <ofd:attachments xmlns:ofd="http: / / www.ofdspec.org / 2016">

[0098] <ofd:attachment id="101" name="FullTextSearchDbFile" usage="”FullTextSearch”" format="SqliteDb">

[0099] <ofd:fileloc> fts001.db< / ofd:fileloc>

[0100] < / ofd:attachment>

[0101] < / ofd:attachments>

[0102] The necessary attributes and child nodes include:

[0103] Embedded file usage attribute (Usage):

[0104] In the example above, the Usage="FullTextSearch" attribute describes the purpose of embedding attachments for full-text search. A dedicated reader can use this to determine whether the document supports full-text search.

[0105] File format attributes (Format):

[0106] In the example above, Format="SqliteDb" describes the format specification of the embedded database attachment file, making it easier for the application to read and use it correctly;

[0107] File location sub-node (FileLoc):

[0108] In the example above, child nodes <ofd:fileloc> fts001.db< / ofd:fileloc> The file location of the embedded database is specified (the embedded database file can be any type of embedded database file that supports full-text search, such as a SQLite file that supports fts3 / fts4 / fts5 modules, or MongDb 2.6+).

[0109] The main data structure of the built-in index database for layout documents is as follows:

[0110] The built-in embedded index database should include the following three main data tables to provide the necessary full-text search support:

[0111] Indexed data tables;

[0112] Index parameter table;

[0113] Page index table.

[0114] 1. Index data is the core of full-text search. In general application scenarios, a keyword is associated with the IDs of the documents that appear. For query text applications within formatted documents, the approach is to associate each keyword with the IDs of the text objects that appear.

[0115] 2. The index parameter table records various global parameters of the index data. For example, it records the index creation time, which is used by the application implementing the retrieval process. For instance, during a query, it checks whether the index time is newer than the document modification time, thus verifying the validity of the index data.

[0116] 3. Page indexing associates text objects with their corresponding page numbers or page objects, allowing for faster and more accurate location of text within the document and thus speeding up processing.

[0117] Step 1, the specific implementation process of building the index data table using each keyword and the text object containing each keyword can be seen in the following example:

[0118] 1. Index Table

[0119] In traditional online full-text search scenarios, the full text of each document is first segmented into words, and then imported into an inverted index table, as shown in Table 1:

[0120] Table 1

[0121]

[0122] For example, "(1003,44)" indicates that the word appears at the 44th word position in the document with DocID=1003.

[0123] In layout document applications, it is more suitable to use the text object ID in the layout document instead of the document ID as the index data, which allows for faster and more convenient text location. Taking OFD documents as an example, the text content is placed in the page's TextObject, and the TextObject ID has global uniqueness, which can replace the traditional document ID. The resulting index table structure is shown in Table 2:

[0124] Table 2

[0125]

[0126] For example, "(4013,13)" indicates that the word appears at the 13th word position in the text object with Object ID=4013.

[0127] Taking SQLite as an example, the SQL statement to generate the indexed data table structure is as follows:

[0128] CREATE VIRTUAL TABLE fts_index_table USING fts3(content TEXT,tokenize=token_1);

[0129] token_1: Represents the word segmenter. For example, to implement Chinese full-text search, a specified word segmenter is needed to correctly segment Chinese text.

[0130] The SQL statement for inserting data is as follows:

[0131] INSERT INTO fts_index_table (TextObjectId, TEXT) VALUES(1001, 'The Chinese explanation of the word fox is fox');

[0132] TextObjectId=1001 refers to the ID of the text object in the document where the inserted text is located.

[0133] Step 2, the specific implementation process of constructing the page index table using the text object containing each keyword and the page number of each text object can be seen in the following example:

[0134] 2. Index Parameters Table

[0135] In addition to index data, the embedded database also needs to store the corresponding global parameters of the layout document and the corresponding index parameters. The necessary data columns include:

[0136] Layout document verification information:

[0137] This includes the document version information (DocVersion) used when generating the index data, such as 1.01; the format document modification time (DocModifiedDate), which records the modification time of the format document when the index was generated, and can be compared with the index generation time to determine the validity of the index; and the format document verification data (if it exists), which records the encrypted verification information of the format document when the index was generated, including the encryption verification method and verification value. The application can use this to read the content data of the format document, verify the verification value, and determine whether the current index is based on valid document data.

[0138] Full-text search index generation time (IndexDate):

[0139] The validity of the current index data is determined by comparing the time when the index data is generated or updated with the document modification time. For example, if the document modification time is later than the index generation date, the current index data can be considered invalid.

[0140] The index document object type for full-text search (IndexObject):

[0141] The index object for the index keywords is specified. In general online full-text search scenarios, the index object is the document. However, when performing full-text search within a formatted document, a text object is recommended.

[0142] Information on the index-based tokenization algorithm (Tokenizer):

[0143] The description of the word segmentation algorithm used during indexing (e.g., fts3; and tokenizer information, e.g., Tokenizer = Token_1) allows the application to select the appropriate word segmentation algorithm when implementing full-text search.

[0144] Taking SQLite as an example, the index parameter table is shown in Table 3:

[0145] Table 3

[0146]

[0147] Step 3: To expedite the processing of pages containing keywords, construct a table relating the text objects containing keywords to their corresponding page numbers. See the example below for a detailed implementation:

[0148] 3. PageIndex Table

[0149] While using TextObject IDs for retrieval in the index data is beneficial for accurately locating the text object containing the keyword, it doesn't directly provide the page ID of that text object. When listing and rendering relevant pages, the search processor still needs to parse all pages of the document to obtain the relevant page objects (it needs to parse the Content.xml file of each page to determine if the text object ID is located on that page). Therefore, to speed up application processing during searches, a fast index table of TextObject IDs to Page IDs should be provided in the embedded database. This would allow for quick retrieval of relevant page objects without parsing all page content, thus accelerating page rendering. The table structure is shown in Table 4.

[0150] Table 4

[0151]

[0152] In addition, this solution also includes an update mechanism for the index database after changes to the layout document. After the layout document is edited, the existing index data and the original text may no longer match, requiring a reasonable update mechanism to update the index database. The main mechanism is as follows:

[0153] The need to update the index database can be checked based on the application's update flags, or by using the changed document version number, update date, or even document validation data.

[0154] When updating the index database, the application can update only the modified page or the modified text object to partially update the index data table, thereby saving processing time;

[0155] After updating the index database, the new version number of the layout document, the update date, the document verification data, the date and time when the index database update was successful, and other relevant parameters need to be saved in the document global parameter table.

[0156] Preferably, the index data table further includes: the location information of the text object containing each keyword.

[0157] The location information refers to the page number where the keyword is located.

[0158] Preferably, after constructing the document verification information from the document modification time and document version number when the index data table is created through word segmentation, the document further includes:

[0159] The document verification information consisting of the document modification time and document version number recorded in the index parameter table when generating the index data is used as the baseline verification data, and the actual modification time and document version number of the current version document are used as the actual verification data. The baseline verification data and the actual verification data are compared to confirm the validity of the index data table.

[0160] Alternatively, the index generation time recorded in the index parameter table can be used as the index base time, the modification time of the current version document can be obtained as the document modification time, and it can be determined whether the index base time is later than the document modification time to confirm the validity of the index data table.

[0161] When the index data table of the layout document is valid, the index data table is determined to be an index data table that allows text search.

[0162] Preferably, the process of determining the benchmark verification data is as follows:

[0163] The first document modification time and the first document version number of the formatted document are defined as the benchmark verification data.

[0164] Alternatively, the modification time and version number of the second document after the text content of the formatted document supporting text search using an embedded index database can be defined as the benchmark verification data.

[0165] Preferably, the process for determining the index reference time is as follows:

[0166] The time when the text content is segmented and indexed after the version update of the document is completed is defined as the index baseline time.

[0167] Alternatively, the time when the keyword list is updated after modifying the content of the formatted document to support text search using an embedded index database, and then the time of creating the new index data is defined as the index baseline time.

[0168] like Figure 2 As shown, a text search method includes:

[0169] Determine whether a layout document constructed using a layout document construction method that uses an embedded database supports text search using an embedded index database.

[0170] When the determination result is that it supports text search using an embedded index database, it is determined whether the embedded database in the layout document that supports text search using an embedded index database contains a valid index data table and a valid page index table.

[0171] When the judgment result is that it contains a valid index data table and a valid page index table, obtain the text data to be searched entered by the user;

[0172] Based on the word segmentation method for layout documents that support text search using embedded index databases, the text data to be searched is segmented to obtain a keyword list;

[0173] Based on the keyword list, search the index data table for the text object containing each keyword in the keyword list;

[0174] Based on the text object containing each keyword, search the page index table for the page number where the text object containing each keyword is located;

[0175] Render the page corresponding to the page number where the text object containing each keyword is located, and highlight the keyword.

[0176] In some possible implementations, a local embedded database combined with a full-text search engine can be used to achieve fast keyword searching in formatted documents. This search speed is orders of magnitude faster than traditional linear text matching methods and can be easily implemented in offline scenarios.

[0177] It should be noted that, as Figure 5 As shown, the main processing flow when performing text search in a layout document reader is as follows:

[0178] By determining whether the current document contains an embedded database attachment file with the Usage attribute set to FullTextSearch, we can determine whether the current document supports text search using an embedded index database. If it does, we continue.

[0179] By checking whether the embedded database file contains valid data tables (index data table, global parameter table, and page index table), it is determined whether the attachment supports full-text search. If it does, the process continues.

[0180] Check if the document version information, document modification time, and document verification data in the global parameter table are consistent with the current version of the document to determine if the index data is valid. If they are consistent, continue.

[0181] Check if the index generation time in the global parameter table is later than the document modification time. If it is, the index data is valid and you can continue.

[0182] The text content entered by the user during the query is segmented into words using the index-based word segmentation algorithm in the global parameter table to obtain a list of keywords;

[0183] Call the full-text search module (FtsModule) specified in the global parameter table to retrieve the keyword list (multiple keyword search conditions can be specified according to business requirements, i.e., all keywords must be included or any one keyword must be included), and obtain a set of TextObject IDs that meet the requirements;

[0184] Based on the TextObject ID collection and page index table returned in the previous step, retrieve the list of corresponding page object IDs (Page IDs);

[0185] Based on the list of Page IDs obtained in the previous step, the document parsing and rendering module is called to render the relevant target pages, and the keywords are highlighted in the matching text objects (TextObjects) and finally displayed to the user.

[0186] In summary, the full-text search function of the layout document using an embedded database mainly consists of three parts:

[0187] Generates an embedded full-text search index database table for the documents being searched;

[0188] Full-text search using an embedded database;

[0189] Maintain the index data information of the embedded database.

[0190] For standard-sized documents, searching using traditional text matching methods is relatively quick and acceptable to users. However, if the document size exceeds several hundred megabytes, the text content is large, and the search may involve hundreds of thousands of text objects, each containing anywhere from a dozen to several hundred characters. This can result in a search time of tens of seconds, leading to a poor user experience.

[0191] By employing an embedded database for full-text search and persisting the reverse-order index data, fast searching can be achieved, with search time controlled to within tens of milliseconds, significantly improving the user experience. Furthermore, since the embedded database is stored as an attachment within the document layout, no additional data or backend support is required, enabling full-text search functionality in various offline scenarios.

[0192] Furthermore, by leveraging the existing full-text search module's functionality, and embedding a database file, it is possible to quickly implement a variety of rich features such as synonym matching, fuzzy matching, and contextual suggestions.

[0193] like Figure 3 As shown, a layout document building system using an embedded database includes:

[0194] The first module 100 is used to: segment all text content of the layout document into words, record each keyword obtained and the text object where each keyword is located, and build an index data table;

[0195] The second module 200 is used to: construct a page index table using the text object containing each keyword and the page number where each text object is located;

[0196] The construction module 300 is used to: construct document verification information by taking the document modification time and document version number when the index data table is built by word segmentation of the layout document; construct an index parameter table by taking the document verification information, the index data generation time of the index data table, and the word segmentation method parameters; and embed the embedded database composed of the index data table, the index parameter table, and the page index table as a document attachment into the layout document to construct a layout document that supports text search using the embedded index database.

[0197] In some possible implementations, a local embedded database combined with a full-text search engine can be used to achieve fast keyword searching in formatted documents. This search speed is orders of magnitude faster than traditional linear text matching methods and can be easily implemented in offline scenarios.

[0198] Preferably, the index data table further includes: the location information of the text object containing each keyword.

[0199] Preferably, it further includes:

[0200] The verification module is used to: use the document verification information consisting of the document modification time and document version number recorded in the index parameter table when generating the index data as the benchmark verification data, use the actual modification time and document version number of the current version document as the actual verification data, compare the benchmark verification data and the actual verification data to confirm the validity of the index data table.

[0201] Alternatively, the index generation time recorded in the index parameter table can be used as the index base time, the modification time of the current version document can be obtained as the document modification time, and it can be determined whether the index base time is later than the document modification time to confirm the validity of the index data table.

[0202] When the index data table of the layout document is valid, the index data table is determined to be an index data table that allows text search.

[0203] Preferably, the process of determining the benchmark verification data is as follows:

[0204] The first document modification time and the first document version number of the formatted document are defined as the benchmark verification data.

[0205] Alternatively, the modification time and version number of the second document after the text content of the formatted document supporting text search using an embedded index database can be defined as the benchmark verification data.

[0206] Preferably, the process for determining the index reference time is as follows:

[0207] The time when the text content is segmented and indexed after the version update of the document is completed is defined as the index baseline time.

[0208] Alternatively, the time when the keyword list is updated after modifying the content of the formatted document to support text search using an embedded index database, and then the time of creating the new index data is defined as the index baseline time.

[0209] like Figure 4 As shown, a text search system includes:

[0210] The determination module 400 is used to determine whether a layout document constructed by a layout document construction method using an embedded database supports text search using an embedded index database.

[0211] The first result module 500 is used to: when the determination result is that text search is supported using an embedded index database, determine whether the embedded database in the layout document that supports text search using an embedded index database contains a valid index data table and a valid page index table;

[0212] The second result module 600 is used to: obtain the search text data input by the user when the judgment result is that it contains a valid index data table and a valid page index table;

[0213] The processing module 700 is used to: perform word segmentation on the text data to be searched based on the word segmentation method for supporting text search using an embedded index database, and obtain a keyword list;

[0214] The first search module 800 is used to: search the index data table for the text object containing each keyword in the keyword list, based on the keyword list;

[0215] The second search module 900 is used to: search the page index table for the page number where the text object containing each keyword is located, based on the text object containing each keyword.

[0216] The rendering module 110 is used to render the page corresponding to the page number where the text object containing each keyword is located, and to highlight the keyword.

[0217] In some possible implementations, a local embedded database combined with a full-text search engine can be used to achieve fast keyword searching in formatted documents. This search speed is orders of magnitude faster than traditional linear text matching methods and can be easily implemented in offline scenarios.

[0218] Another technical solution of the present invention to solve the above-mentioned technical problems is as follows: a storage medium storing instructions, wherein when a computer reads the instructions, the computer executes the method described in any of the above-mentioned methods.

[0219] In some possible implementations, a local embedded database combined with a full-text search engine can be used to achieve fast keyword searching in formatted documents. This search speed is orders of magnitude faster than traditional linear text matching methods and can be easily implemented in offline scenarios.

[0220] Another technical solution of the present invention to solve the above-mentioned technical problems is as follows: an electronic device, including the above-mentioned storage medium and a processor that executes the instructions in the above-mentioned storage medium.

[0221] In some possible implementations, a local embedded database combined with a full-text search engine can be used to achieve fast keyword searching in formatted documents. This search speed is orders of magnitude faster than traditional linear text matching methods and can be easily implemented in offline scenarios.

[0222] Readers should understand that in the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Furthermore, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0223] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the method embodiments described above are merely illustrative. For instance, the division of steps is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple steps may be combined or integrated into another step, or some features may be ignored or not executed.

[0224] If the above methods are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0225] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method of building a layout document using an embedded database, characterized by, The method comprises the following steps: Step 1, constructing an index data table by tokenizing all text contents of a layout document and recording each keyword and the text object in which the keyword is located; Step 2, constructing a page index table by the text object in which each keyword is located and the page number in which each text object is located; Step 3, constructing document verification information from the document modification time and the document version number when the layout document is tokenized to establish the index data table, and constructing an index parameter table from the document verification information, the index data generation time of the index data table and the tokenization method parameter; Embedding an embedded database composed of the index data table, the index parameter table and the page index table into the layout document as a document attachment to construct a layout document supporting text search using the embedded database; After constructing the document verification information from the document modification time and the document version number when the layout document is tokenized to establish the index data table, the method further comprises the following steps: Taking the document verification information composed of the document modification time and the document version number recorded in the index parameter table as the reference verification data, taking the actual modification time and the version number of the current layout document as the actual verification data, comparing the reference verification data and the actual verification data to determine whether they are consistent, and confirming the validity of the index data table; Or, taking the index generation time recorded in the index parameter table as the index reference time, taking the modification time of the current layout document as the document modification time, determining whether the index reference time is later than the document modification time, and confirming the validity of the index data table; When the index data table of the layout document is valid, determining that the index data table is an index data table allowing text search.

2. The method of claim 1, wherein the method further comprises: The index data table further comprises position information of the text object in which each keyword is located.

3. The method of claim 1, wherein the method further comprises: The determination process of the reference verification data comprises the following steps: Defining the first document modification time and the first document version number of the layout document as the reference verification data; Or defining the second document modification time and the second document version number of the layout document after the text contents are modified as the reference verification data.

4. The method of claim 1, wherein the method further comprises: receiving a request for a document from a client; and providing the document to the client. The determination process of the index reference time comprises the following steps: Defining the time when the text contents are tokenized to generate index data after the version of the layout document is updated as the index reference time; Or defining the time when new index data is established after the keyword list is updated by re-tokenizing the modified contents of the layout document supporting text search using the embedded database as the index reference time.

5. A method of text search, characterized by, The method comprises the following steps: Determining whether the layout document constructed by the layout document construction method using the embedded database of any one of claims 1 to 4 supports text search using the embedded database. When the judgment result is that the use of the embedded database for text search is supported, judging whether the embedded database in the format document supporting the use of the embedded database for text search contains a valid index data table and a valid page index table; When the judgment result is that the index data table and the page index table are valid, obtaining user-inputted text data to be searched; performing word segmentation processing on the text data to be searched based on a word segmentation method of the format document supporting the use of the embedded database for text search, to obtain a keyword list; searching, based on the keyword list, a text object in which each keyword in the keyword list is located in the index data table; searching, based on the text object in which each keyword is located, a page number in which the text object in which each keyword is located is located in the page index table; rendering a page corresponding to the page number in which the text object in which each keyword is located is located, and highlighting the keyword.

6. A layout document building system using an embedded database, employing a layout document building method using an embedded database as claimed in claim 1, characterized by Comprise: The first establishing module is used for: by performing word segmentation on all text contents of a format document, recording each keyword and a text object in which each keyword is located obtained, and constructing an index data table; The second establishing module is used for: by each keyword and a page number in which each text object is located, constructing a page index table; The constructing module is used for: constructing a document check information of a document modification time and a document version number of the format document when the index data table is established by word segmentation, and constructing an index parameter table together with a generation time of index data of the index data table and a word segmentation method parameter; Embedding the embedded database composed of the index data table, the index parameter table and the page index table as a document attachment into the format document, to construct a format document supporting the use of the embedded database for text search.

7. The document building system using embedded database according to claim 6, wherein, The index data table further comprises: position information of each text object in which each keyword is located.

8. A text search system based on the layout document of claim 7 characterized in that, Comprise: The judging module is used for: judging whether a format document constructed by the method of any one of claims 1 to 4 supporting the use of the embedded database for text search supports the use of the embedded database for text search; The first result module is used for: when the judgment result is that the use of the embedded database for text search is supported, judging whether the embedded database in the format document supporting the use of the embedded database for text search contains a valid index data table and a valid page index table; The second result module is used for: when the judgment result is that the index data table and the page index table are valid, obtaining user-inputted text data to be searched; The processing module is used for: performing word segmentation processing on the text data to be searched based on a word segmentation method of the format document supporting the use of the embedded database for text search, to obtain a keyword list; The first search module is used for: searching, based on the keyword list, a text object in which each keyword in the keyword list is located in the index data table; The second search module is used for: searching, based on the text object in which each keyword is located, a page number in which the text object in which each keyword is located is located in the page index table; The second search module is configured to search, based on the text object in which each keyword is located, a page number in which the text object in which each keyword is located is located in the page index table; The rendering module is configured to render a page corresponding to the page number in which the text object in which each keyword is located is located, and highlight the keyword.

Citation Information

Patent Citations

  • Document searching method and device based on database

    CN111522905A

  • Method for merging and displaying electronic form and OFD format file and generating catalogue

    CN111753499A