File retrieval method and related product
By using ANTLR's predefined syntax rules to structure the search conditions described in natural language, generating target structured search conditions, and selecting appropriate search methods for collaborative retrieval, this method solves the technical problems existing in the prior art and realizes an efficient and intelligent retrieval method.
Patent Information
- Application Number
- CN202511102188.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-07
- Publication Date
- 2025-11-28
AI Technical Summary
Existing document retrieval technologies have limited semantic expression capabilities, high user operation complexity, high hardware resource consumption, and lack a unified intelligent retrieval framework, making it difficult to meet the intelligent retrieval needs of various scenarios.
By converting the user-input natural language description of the search statement into structured search conditions, and by implementing the search method, using ANTLR predefined syntax rules, target structured document search conditions are generated, and an appropriate document search method is selected for collaborative retrieval.
It reduces user operation complexity, improves search efficiency and intelligence, and is suitable for efficient and intelligent retrieval on ordinary devices.
Smart Images

Figure CN121029698A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of information retrieval technology, specifically to a document retrieval method and related products. Background Technology
[0002] With the rapid development of information technology and the exponential growth of data volume, how to efficiently retrieve and manage documents has become a key challenge in the field of information processing.
[0003] Early file retrieval technologies mainly relied on filename matching or keyword-based database queries, which were relatively simple in function and difficult to cope with complex retrieval needs. In order to improve retrieval efficiency, the industry has gradually developed a variety of retrieval technologies, mainly including the following categories: (1) Iterative search, such as find (file search command) and grep (text search command) in Linux system, which realize basic retrieval by recursively traversing the file system. The implementation method is simple but the efficiency is low; (2) Indexed search: such as Everything (file fast search tool), which builds an index by maintaining file metadata (such as filename, path, size, modification time, etc.) to achieve fast location. The response speed is fast but the function is relatively simple; (3) Full-text search: such as Elasticsearch (distributed full-text search engine), which not only indexes metadata, but also performs word segmentation and indexing on file content, supports full-text content retrieval based on keywords, which is powerful but relies on keyword matching; (4) Vectorized search: based on natural language processing and deep learning models, it maps text into high-dimensional vectors and realizes semantic understanding through vector similarity calculation. It has stronger semantic matching capabilities, but consumes a lot of computing resources and has a high deployment threshold.
[0004] While the aforementioned search technologies each have their advantages in specific scenarios, they still have many shortcomings in practical applications. First, keyword matching has limited semantic expressive power; users must input precise keywords to obtain effective results, making it difficult to meet complex semantic needs. Second, advanced filtering conditions in tools like Everything and Elasticsearch are cumbersome to configure, requiring users to complete searches through graphical interfaces with multiple options or command-line parameter combinations, resulting in high learning and usage costs. Third, vectorized search has high hardware resource requirements, making it difficult for ordinary terminal devices to support its real-time operation. Finally, existing search systems are mostly implemented based on a single search method, lacking a unified intelligent search framework. Summary of the Invention
[0005] Embodiments of this disclosure provide a document retrieval method, apparatus, electronic device, storage medium, and computer program product.
[0006] Firstly, this disclosure provides a document retrieval method, which includes:
[0007] Obtain the target search statement, wherein the target search statement includes file search conditions for at least one search dimension described in natural language;
[0008] Based on the target search statement, target structured document search conditions are generated, wherein the target structured document search conditions include target structured document search sub-conditions corresponding to each search dimension;
[0009] Based on the target structured document retrieval criteria, determine at least one document retrieval method for performing the retrieval task;
[0010] The search operation is performed on each file in the target file set according to the target structured file search conditions and the at least one file search method;
[0011] Based on the search results, at least one target file matching the target search statement is determined.
[0012] In some optional implementations, generating target structured document search conditions based on the target search statement includes:
[0013] Input the target search statement and structured document search condition prompts into the target document search condition structured model, and output the target structured document search conditions.
[0014] In some alternative implementations, the document retrieval condition structured model is trained through the following steps:
[0015] Obtain a training dataset, wherein the training dataset includes at least one training retrieval statement and standard structured file retrieval conditions corresponding to each training retrieval statement, and each training retrieval statement includes file retrieval conditions of at least one retrieval dimension described in natural language;
[0016] Input the at least one training retrieval statement and the structured document retrieval condition prompts into the initial document retrieval condition structured model, and output the predicted structured document retrieval conditions corresponding to each of the training retrieval statements;
[0017] Based on the difference between the predicted structured document retrieval conditions and the standard structured document retrieval conditions for each training retrieval statement, the model parameters of the initial document retrieval condition structured model are adjusted.
[0018] The initial document retrieval condition structured model, after adjusting the model parameters, is determined as the target document retrieval condition structured model.
[0019] In some optional implementations, the at least one file retrieval method includes at least one of filename retrieval, full-text content retrieval, and metadata retrieval.
[0020] In some optional implementations, determining at least one document retrieval method for performing the retrieval task based on the target structured document retrieval criteria includes:
[0021] The target structured file retrieval conditions are parsed and translated to generate at least one set of executable file retrieval conditions, wherein each set of executable file retrieval conditions includes executable file retrieval sub-conditions that correspond one-to-one with each of the target structured file retrieval sub-conditions;
[0022] For each set of executable file search conditions, determine whether there exists an executable file search sub-condition in the set of executable file search conditions that matches at least one of the search methods of file name search, full text content search, and metadata search;
[0023] Based on executable file retrieval sub-conditions that match at least one of the retrieval methods—name retrieval, full-text content retrieval, and metadata retrieval—at least one file retrieval method for performing the retrieval task is determined.
[0024] In some optional implementations, the filename retrieval corresponds to a preset first set of searchable dimensions, the full-text content retrieval corresponds to a preset second set of searchable dimensions, and the metadata retrieval corresponds to a preset third set of searchable dimensions. Determining whether there exists an executable file retrieval sub-condition in the executable file retrieval condition set that matches at least one of the retrieval methods—filename retrieval, full-text content retrieval, and metadata retrieval—includes:
[0025] Determine whether there are any executable file retrieval sub-conditions in the executable file retrieval condition set that match the first retrieval dimension set;
[0026] If confirmed, it is determined that there exists an executable file retrieval sub-condition in the executable file retrieval condition set that matches the file name retrieval;
[0027] If it is determined that there is no executable file retrieval sub-condition in the executable file retrieval condition set that matches the file name retrieval;
[0028] Determine whether there exists an executable file retrieval sub-condition in the executable file retrieval condition set that matches the second retrieval dimension set;
[0029] If confirmed, it is determined that there exists an executable file retrieval sub-condition in the executable file retrieval condition set that matches the full-text content retrieval;
[0030] If it is determined that there is no executable file retrieval sub-condition in the executable file retrieval condition set that matches the full-text content retrieval;
[0031] Determine whether there exists an executable file retrieval sub-condition in the executable file retrieval condition set that matches the third retrieval dimension set;
[0032] If confirmed, it is determined that there exists an executable file retrieval sub-condition in the executable file retrieval condition set that matches the metadata retrieval;
[0033] If not, it is determined that there is no executable file retrieval sub-condition in the executable file retrieval condition set that matches the metadata retrieval.
[0034] Secondly, this disclosure provides a document retrieval device, the device comprising:
[0035] The retrieval statement acquisition unit is used to acquire the target retrieval statement, wherein the target retrieval statement includes at least one retrieval dimension of document retrieval conditions described in natural language;
[0036] The search condition generation unit is used to generate target structured document search conditions based on the target search statement, wherein the target structured document search conditions include target structured document search sub-conditions corresponding to each search dimension;
[0037] The retrieval method determination unit is used to determine at least one file retrieval method for performing the retrieval task based on the target structured file retrieval conditions.
[0038] The retrieval unit is used to perform retrieval operations on each file in the target file set according to the target structured file retrieval conditions and the at least one file retrieval method;
[0039] The file determination unit is used to determine at least one target file that matches the target search statement based on the search results.
[0040] In some optional implementations, the retrieval condition generation unit may be further used to:
[0041] Input the target search statement and structured document search condition prompts into the target document search condition structured model, and output the target structured document search conditions.
[0042] In some optional implementations, the target file retrieval condition structured model is trained by the following steps: obtaining a training dataset, wherein the training dataset includes at least one training retrieval statement and standard structured file retrieval conditions corresponding to each training retrieval statement, and each training retrieval statement includes file retrieval conditions of at least one retrieval dimension described in natural language;
[0043] Input the at least one training retrieval statement and the structured document retrieval condition prompts into the initial document retrieval condition structured model, and output the predicted structured document retrieval conditions corresponding to each of the training retrieval statements;
[0044] Based on the difference between the predicted structured document retrieval conditions and the standard structured document retrieval conditions for each training retrieval statement, the model parameters of the initial document retrieval condition structured model are adjusted.
[0045] The initial document retrieval condition structured model, after adjusting the model parameters, is determined as the target document retrieval condition structured model.
[0046] In some optional implementations, the at least one file retrieval method includes at least one of filename retrieval, full-text content retrieval, and metadata retrieval.
[0047] In some optional implementations, the retrieval condition generation unit may be further used to:
[0048] The target structured file retrieval conditions are parsed and translated to generate at least one set of executable file retrieval conditions, wherein each set of executable file retrieval conditions includes executable file retrieval sub-conditions that correspond one-to-one with each of the target structured file retrieval sub-conditions;
[0049] For each set of executable file search conditions, determine whether there exists an executable file search sub-condition in the set of executable file search conditions that matches at least one of the search methods of file name search, full text content search, and metadata search;
[0050] Based on executable file retrieval sub-conditions that match at least one of the retrieval methods—name retrieval, full-text content retrieval, and metadata retrieval—at least one file retrieval method for performing the retrieval task is determined.
[0051] In some optional implementations, the filename retrieval corresponds to a preset first set of searchable dimensions, the full-text content retrieval corresponds to a preset second set of searchable dimensions, and the metadata retrieval corresponds to a preset third set of searchable dimensions. The retrieval method determination unit can be further used to:
[0052] Determine whether there are any executable file retrieval sub-conditions in the executable file retrieval condition set that match the first retrieval dimension set;
[0053] If confirmed, it is determined that there exists an executable file retrieval sub-condition in the executable file retrieval condition set that matches the file name retrieval;
[0054] If it is determined that there is no executable file retrieval sub-condition in the executable file retrieval condition set that matches the file name retrieval;
[0055] Determine whether there exists an executable file retrieval sub-condition in the executable file retrieval condition set that matches the second retrieval dimension set;
[0056] If confirmed, it is determined that there exists an executable file retrieval sub-condition in the executable file retrieval condition set that matches the full-text content retrieval;
[0057] If it is determined that there is no executable file retrieval sub-condition in the executable file retrieval condition set that matches the full-text content retrieval;
[0058] Determine whether there exists an executable file retrieval sub-condition in the executable file retrieval condition set that matches the third retrieval dimension set;
[0059] If confirmed, it is determined that there exists an executable file retrieval sub-condition in the executable file retrieval condition set that matches the metadata retrieval;
[0060] If not, it is determined that there is no executable file retrieval sub-condition in the executable file retrieval condition set that matches the metadata retrieval.
[0061] Thirdly, this disclosure provides an electronic device, including:
[0062] One or more processors;
[0063] Storage device, on which one or more programs are stored,
[0064] When the above-described one or more programs are executed by the above-described one or more processors, the above-described one or more processors implement the method as described in any embodiment of the first aspect of this disclosure.
[0065] Fourthly, this disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by one or more processors, implements the method described in any embodiment of the first aspect of this disclosure.
[0066] Fifthly, this disclosure provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the method described in any embodiment of the first aspect of this disclosure.
[0067] To address the shortcomings of existing retrieval technologies in practical applications, this disclosure provides a document retrieval method, apparatus, electronic device, storage medium, and computer program product. The method involves: acquiring a target retrieval statement, wherein the target retrieval statement includes document retrieval conditions for at least one retrieval dimension described in natural language; generating target structured document retrieval conditions based on the target retrieval statement, wherein the target structured document retrieval conditions include target structured document retrieval sub-conditions corresponding to each retrieval dimension; determining at least one document retrieval method for performing the retrieval task based on the target structured document retrieval conditions; performing retrieval operations on each file in the target document set based on the target structured document retrieval conditions and at least one document retrieval method; and determining at least one target file matching the target retrieval statement based on the retrieval results. This disclosure effectively reduces the operational complexity for users by converting the user-input natural language-described retrieval statement into structured document retrieval conditions. Furthermore, based on the structured document retrieval conditions, at least one document retrieval method can be selected to match different document retrieval methods, thereby achieving unified scheduling of multiple search engines. This method effectively solves the problems of strong dependence on keywords, complex filtering configuration, and high threshold for intelligent search deployment in traditional document retrieval, achieving an efficient and intelligent retrieval experience on ordinary devices. Attached Figure Description
[0068] Other features, objects, and advantages of this disclosure will become more apparent from the following detailed description of non-limiting embodiments, taken with reference to the accompanying drawings. The drawings are for illustrative purposes only and are not intended to limit the scope of this disclosure. In the drawings:
[0069] Figure 1 This is an exemplary system architecture diagram to which one embodiment of this disclosure can be applied;
[0070] Figure 2 This is a flowchart of an embodiment of the document retrieval method according to the present disclosure;
[0071] Figure 3 This is a schematic diagram of a structure of an embodiment of the document retrieval device according to the present disclosure;
[0072] Figure 4 This is a schematic diagram of the structure of a computer system suitable for implementing embodiments of the present disclosure. Detailed Implementation
[0073] The present disclosure will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.
[0074] It should be noted that, unless otherwise specified, the embodiments and features described in this disclosure can be combined with each other. This disclosure will now be described in detail with reference to the accompanying drawings and embodiments.
[0075] Figure 1 An exemplary system architecture 100 is shown, to which embodiments of the document retrieval methods, apparatus, electronic devices, and storage media of this disclosure can be applied.
[0076] like Figure 1 As shown, system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 serves as the medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0077] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications, such as file retrieval applications, can be installed on terminal devices 101, 102, and 103.
[0078] Terminal devices 101, 102, and 103 can be either hardware or software. When terminal devices 101, 102, and 103 are hardware, they can be various electronic devices with information input devices (e.g., keyboard, mouse, touchscreen, microphone, camera, etc.) and information output devices (e.g., display screen, speaker, etc.), including but not limited to smartphones, tablets, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 players (Moving Picture Experts Group Audio Layer IV), laptops, and desktop computers, etc. When terminal devices 101, 102, and 103 are software, they can be installed on the terminal devices listed above. They can be implemented as multiple software programs or software modules (e.g., used to obtain target search statements) or as a single software program or software module. No specific limitations are made here.
[0079] In some cases, the document retrieval method provided in this disclosure can be executed by terminal devices 101, 102, and 103, and correspondingly, the document retrieval device can be set in terminal devices 101, 102, and 103. In this case, the system architecture 100 may not include server 105.
[0080] In some cases, the document retrieval method provided in this disclosure can be jointly executed by terminal devices 101, 102, and 103 and server 105. For example, the step of "obtaining the target retrieval statement" can be executed by terminal devices 101, 102, and 103, and the step of "generating target structured document retrieval conditions based on the target retrieval statement" can be executed by server 105. This disclosure does not limit this. Correspondingly, the document retrieval device can also be respectively set in terminal devices 101, 102, and 103 and server 105.
[0081] In some cases, the document retrieval method provided in this disclosure can be executed by server 105, and correspondingly, the document retrieval device can also be set in server 105. In this case, system architecture 100 may not include terminal devices 101, 102, and 103.
[0082] It should be noted that server 105 can be either hardware or software. When server 105 is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When server 105 is software, it can be implemented as multiple software programs or software modules (e.g., used to provide distributed services), or as a single software program or software module. No specific limitations are made here.
[0083] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0084] Continue to refer to Figure 2 , Figure 2 A flow 200 of an embodiment of a document retrieval method according to the present disclosure is shown, the flow 200 including at least the steps 201-205.
[0085] Step 201: Obtain the target search statement.
[0086] In this embodiment, the target search statement includes at least one search dimension of document search conditions described in natural language.
[0087] A target search statement can be a query statement entered by a user and described in natural language to retrieve files. It reflects the user's search intent for files and can be expressed through one or more search dimensions.
[0088] Search dimensions include, but are not limited to: file type search, date search, file name search, file size search, path search, duration search, etc.
[0089] For example, the user's target search query could be "PDF reports modified last month".
[0090] The target search statement includes the following search dimensions: modification time (last month), file type (PDF), and keywords (report).
[0091] Step 202: Generate target structured document search conditions based on the target search statement.
[0092] In this embodiment, grammar rules can be predefined based on ANTLR (Another Tool for Language Recognition) to convert the target retrieval statement in natural language form into corresponding structured document retrieval conditions.
[0093] This syntax rule defines a rich set of document retrieval dimensions, including but not limited to:
[0094] Date search: Supports absolute dates (e.g., "2023-01-01") and relative dates (e.g., "CURRENT-1 month");
[0095] Path Search: Matching based on file paths;
[0096] Name Search: Matches based on keywords in the filename;
[0097] File size search (sizeSearch): Supports comparison criteria based on file size;
[0098] File type search (typeSearch): Searching based on file extension or type;
[0099] File duration search: Applicable to searching based on the duration of audio files;
[0100] Metadata Search: Supports searching metadata fields of multimedia files;
[0101] Quantity Condition: Used to limit the number of search results;
[0102] Content Search: Supports keyword matching based on file content.
[0103] This syntax rule can use recursive descent parsing and supports complex Boolean logic combinations (such as AND, OR) and nested conditional expressions, as well as a full range of comparison operators (such as =, <, >, !=, <=, >=).
[0104] The following is a partial definition example of this syntax rule:
[0105]
[0106]
[0107] It should be noted that the above syntax rules are just examples. Other similar syntax rules can be set according to actual needs.
[0108] In this embodiment, the target structured document retrieval conditions include target structured document retrieval sub-conditions corresponding to each retrieval dimension. Each target structured document retrieval sub-condition corresponds to the specific retrieval intent expressed by the user in the natural language retrieval statement and is converted into a specific target structured document retrieval sub-condition.
[0109] For example, the target search query "PDF report modified last month" can be matched with the following structured document search criteria: (DATE>=CURRENT-"2month")AND(DATE<=CURRENT-"1month")AND(TYPE IS"PDF")ANDCONTENT CONTAINS"report").
[0110] Each search dimension corresponds to a target structured document search sub-condition.
[0111] Specifically, the sub-conditions for retrieving target structured documents corresponding to the modification time (last month) can be:
[0112] (DATE>=CURRENT-"2month")AND(DATE<=CURRENT-"1month");
[0113] The target structured file retrieval sub-condition corresponding to the file type can be: TYPE IS "PDF";
[0114] The target structured document retrieval sub-condition corresponding to the content keywords can be: CONTENT CONTAI NS "Report".
[0115] In this way, by converting the target search statement into multiple target structured document search sub-conditions, no further user operation is required, which can effectively reduce the complexity of user operation and more accurately understand the user's intent to adapt to different document search engines for efficient retrieval.
[0116] In some optional implementations, the target search statement and structured document search condition prompts are input into the target document search condition structured model, and the target structured document search conditions are output.
[0117] Here, you can input the target search statement and structured document search condition prompts into the target document search condition structured model, so that the target structured document search conditions can be output through the target document search condition structured model.
[0118] Here, the structured document retrieval condition prompts may include the grammatical rules predefined by ANTLR in step 202. These prompts guide the target document retrieval condition structured model to convert the natural language target retrieval statement into target structured document retrieval conditions. The structured document retrieval condition prompts may also include other rule descriptions.
[0119] Other rule descriptions may include, for example, the following:
[0120] Directory descriptions: ROOT represents the root directory of the file system, HOME represents the user's home directory, Download represents the user's download directory, Pictures represents the user's picture directory, and other directory descriptions.
[0121] Date Explanation: Dates can be expressed fuzzily or as specific times. When the time in the user's target search query is an absolute time, the absolute time entered by the user will be used directly, without using CURRENT (current time). When the time in the user's target search query is a relative time, it can be converted into an absolute time interval expression based on CURRENT. The mapping rules for relative time expressions are as follows:
[0122] Today / Within today: (DATE>=CURRENT-"1days") AND (DATE<="CURRENT") Before today / Earlier than today: (DATE<"CURRENT")
[0123] Yesterday: (DATE>=CURRENT-"2day")AND(DATE<=CURRENT-"1day")
[0124] Before yesterday / earlier than yesterday: (DATE <CURRENT-"1day")
[0125] The day before yesterday: (DATE>=CURRENT-"3day")AND (DATE<=CURRENT-"2day")
[0126] The day before yesterday / earlier than the day before yesterday: (DATE <CURRENT-"2day")
[0127] This week / within this week: (DATE>=CURRENT-"1week")AND(DATE<="CURRENT")
[0128] Earlier this week / Before this week: (DATE) <CURRENT-"1week")
[0129] Last week / within last week: (DATE>=CURRENT-"2 weeks") AND (DATE<=CURRENT-"1 week")
[0130] Last week before / earlier than last week:(DATE <CURRENT-"2week")
[0131] The week before last / the week before last: (DATE>=CURRENT-"3 weeks") AND (DATE<=CURRENT-"2 weeks")
[0132] Two weeks ago / earlier than two weeks ago:(DATE <CURRENT-"3week")
[0133] This month / within this month: (DATE>=CURRENT-"1 month") AND (DATE<="CURRENT")
[0134] Before this month / earlier than this month:(DATE <CURRENT-"1month")
[0135] Last month: (DATE>=CURRENT-"2 months") AND (DATE<=CURRENT-"1 month")
[0136] Last month ago / earlier than last month:(DATE <CURRENT-"1month")
[0137] The month before last: (DATE >= CURRENT - "3 months") AND (DATE <= CURRENT - "2 months")
[0138] Two months ago / earlier than the month before last:(DATE <CURRENT-"2month")
[0139] This year / within this year: (DATE>CURRENT-"1 year") AND (DATE<="CURRENT") Before this year / earlier than this year: (DATE>CURRENT-"1 year") AND (DATE<="CURRENT") <CURRENT-"1year")
[0140] Last year: (DATE>=CURRENT-"2year")AND(DATE<=CURRENT-"1year")
[0141] Before last year / earlier than last year:(DATE <CURRENT-"1year")
[0142] The year before last: (DATE>=CURRENT-"3year")AND(DATE<=CURRENT-"2year")
[0143] Two years ago / earlier than two years ago:(DATE <CURRENT-"2year")
[0144] Within 30 minutes / nearly 30 minutes: (DATE>CURRENT-"30minute") AND (DATE<="CURRENT")
[0145] Within the last 16 hours / nearly 16 hours: (DATE>CURRENT-"16hour") AND (DATE<="CURRENT")
[0146] Within 3 days / last 3 days: (DATE>CURRENT-"3day")AND(DATE<="CURRENT")
[0147] Within 2 weeks / the last two weeks: (DATE>CURRENT-"2 weeks") AND (DATE<="CURRENT")
[0148] Within 3 months / last 3 months: (DATE>CURRENT-"3 months")AND(DATE<="CURRENT")
[0149] The previous 2 years / the last 2 years / the most recent 2 years: (DATE > CURRENT - "2 years") AND (DATE <= "CURRENT")
[0150] 30 minutes ago / 30 minutes ago / more than 30 minutes ago: (DATE>CURRENT-"31minute") AND (DATE<=CURRENT-"30minute")
[0151] 16 hours ago / 16 hours before / more than 16 hours ago: (DATE > CURRENT - "17 hours") AND (DATE <= CURRENT - "16 hours")
[0152] 3 days ago / 3 days ago / more than 3 days ago: (DATE>CURRENT-"4 days") AND (DATE<=CURRENT-"3 days")
[0153] 2 weeks ago / 2 weeks ago / more than two weeks ago: (DATE > CURRENT - "3 weeks") AND (DATE <= CURRENT - "2 weeks")
[0154] 3 months ago / 3 months ago / more than 3 months ago: (DATE > CURRENT - "4 months") AND (DATE <= CURRENT - "3 months")
[0155] 2 years ago: (DATE>CURRENT-"3year")AND(DATE<=CURRENT-"2year")
[0156] Many minutes ago / a few minutes ago: (DATE>CURRENT-"24min") AND (DATE<=CURRENT-"5min")
[0157] Many hours ago / a few hours ago: (DATE>CURRENT-"24hour") AND (DATE<=CURRENT-"5hour")
[0158] Several days ago / a few days ago: (DATE>CURRENT-"24day") AND (DATE<=CURRENT-"5day")
[0159] Several weeks ago / (a few weeks ago): (DATE > CURRENT - "24 weeks") AND (DATE <= CURRENT - "5 weeks")
[0160] Several months ago / several months ago: (DATE>CURRENT-"24 months") AND (DATE<=CURRENT-"5 months")
[0161] A long time ago / many years ago / several years ago: (DATE>CURRENT-"24 years") AND (DATE<=CURRENT-"5 years")
[0162] The last few minutes: (DATE>=CURRENT-"5min") AND (DATE<="CURRENT")
[0163] In the last few hours: (DATE>=CURRENT-"5hour") AND (DATE<="CURRENT")
[0164] In recent days: (DATE>=CURRENT-"5day") AND (DATE<="CURRENT")
[0165] In recent weeks: (DATE>=CURRENT - "5 weeks") AND (DATE<="CURRENT")
[0166] Recent months: (DATE>=CURRENT-"5 months") AND (DATE<="CURRENT")
[0167] In recent years: (DATE>=CURRENT-"5 years")AND(DATE<="CURRENT").
[0168] Target structured document retrieval criteria specifications: For example, all generated structured document retrieval criteria must strictly adhere to the query language syntax rules in the output;
[0169] File size can be expressed in various ways, such as: very large (e.g., SIZE>100MB), very small (e.g., SIZE<1MB), micro (e.g., SIZE<100KB), etc. File size can also be expressed precisely, such as (SIZE<1MB) AND (SIZE>500KB).
[0170] An error statement is returned when the user's target search query is not for a file.
[0171] It should be noted that the above rules are for illustrative purposes only and can be set according to actual needs.
[0172] In this way, by inputting the target search statement and structured document search condition prompts into the target document search condition structured model, the target document search condition structured model can output the target structured document search conditions. Users do not need to select options through a graphical interface or combine command line parameters to complete the search. The learning and usage costs are low, and there is no need to rely on high-performance computing resources. This significantly reduces the user's operating threshold and improves the intelligence level and execution efficiency of document retrieval.
[0173] Here, the structured model for target document retrieval conditions can be a rule-based parsing model, a semantic understanding model based on natural language processing, or a combination thereof; no restrictions are placed on this. By understanding the user's input of target retrieval statements described in natural language and combining them with predefined structured document retrieval condition prompts, the structured model can automatically generate compliant structured document retrieval conditions. This can then drive multiple retrieval methods to collaboratively perform accurate and effective searches.
[0174] In some alternative implementations, the target document retrieval conditional structured model is trained through the following steps:
[0175] First, obtain the training dataset.
[0176] The training dataset includes at least one training retrieval statement and standard structured document retrieval conditions corresponding to each training retrieval statement. Each training retrieval statement includes document retrieval conditions for at least one retrieval dimension described in natural language.
[0177] In this embodiment, multiple training retrieval statements can be collected and organized in advance. These training retrieval statements can be used to train an initial document retrieval condition structured model to achieve automatic parsing of retrieval statements and conversion of structured document retrieval conditions.
[0178] Here, the search dimensions included in each training search statement can be the same or different to cover diverse search scenarios.
[0179] Standard structured document retrieval conditions can be structured document retrieval conditions for training retrieval statements, output based on ANTLR predefined syntax rules. They are used to accurately express the retrieval intent contained in the training retrieval statements and serve as supervision signals for training the initial document retrieval condition structured model.
[0180] Then, input at least one training retrieval statement and structured document retrieval condition prompts into the initial document retrieval condition structured model, and output the predicted structured document retrieval conditions corresponding to each training retrieval statement.
[0181] Here, at least one training retrieval statement and structured document retrieval condition prompts can be input into the initial document retrieval condition structured model. The initial document retrieval condition structured model outputs predicted structured document retrieval conditions corresponding to each training retrieval statement. The predicted structured document retrieval conditions can be used in the subsequent training or evaluation of the initial document retrieval condition structured model to compare with the standard structured document retrieval conditions, so as to guide the optimization and adjustment of the model parameters of the initial document retrieval condition structured model.
[0182] Next, based on the differences between the predicted structured document retrieval conditions for each training retrieval statement and the standard structured document retrieval conditions, the model parameters of the initial document retrieval condition structured model are adjusted.
[0183] Here, there is a certain difference between the predicted structured document retrieval conditions corresponding to each training retrieval statement and its standard structured document retrieval conditions. This difference reflects the semantic parsing deviation or rule matching error that may exist in the initial document retrieval condition structured model during the process of converting natural language understanding into structured document retrieval conditions.
[0184] Therefore, by analyzing the differences between the predicted structured document retrieval conditions for each training retrieval statement and the standard structured document retrieval conditions, we can identify problems such as semantic understanding biases, retrieval dimension identification errors (e.g., misjudgment of time, type, keywords, etc.), or non-standard generation of structured document retrieval conditions in the initial document retrieval condition structured model during the transformation of retrieval conditions. Based on these differences, the model parameters of the target document retrieval condition structured model can be adjusted, thereby gradually improving the initial document retrieval condition structured model's ability to transform retrieval statements into structured document retrieval conditions.
[0185] Finally, the initial document retrieval condition structured model with adjusted model parameters was determined as the target document retrieval condition structured model.
[0186] Here, defining the initial document retrieval condition structured model after adjusting the model parameters as the target document retrieval condition structured model can mean that the difference between the predicted structured document retrieval conditions output by the initial document retrieval condition structured model after adjusting the model parameters and the standard structured document retrieval conditions is reduced to a preset range, or that the performance of the initial document retrieval condition structured model reaches the expected index after multiple rounds of training and parameter optimization. In this case, the initial document retrieval condition structured model can be used as the final target document retrieval condition structured model for target retrieval statement parsing and target structured retrieval condition generation.
[0187] Here, during the training of the initial structured model for document retrieval conditions, if the content of the structured document retrieval condition prompts is long, the trained target document retrieval condition structured model may need to spend a lot of time parsing and processing the structured document retrieval condition prompts in the actual use stage, thus causing a decrease in the overall retrieval response speed.
[0188] To address the aforementioned issues, in some optional implementations, structured document retrieval condition prompts can be encoded as a special token. During the actual use of the target document retrieval condition structured model, the model only needs to process this lightweight token to quickly reconstruct the complete structured document retrieval condition prompts, thereby significantly reducing computational resource consumption and improving the inference efficiency and response speed of the target document retrieval condition structured model.
[0189] Step 203: Based on the target structured document retrieval conditions, determine at least one document retrieval method for performing the retrieval task.
[0190] In this embodiment, based on the generated target structured document retrieval conditions, one or more suitable document retrieval methods can be determined for performing the retrieval task.
[0191] Different target structured document retrieval sub-conditions can correspond to different document retrieval methods. The optimal or compatible document retrieval method can be automatically selected according to the retrieval dimension to achieve collaborative retrieval of multiple retrieval methods.
[0192] In some alternative implementations, at least one file retrieval method includes at least one of filename retrieval, full-text content retrieval, and metadata retrieval.
[0193] File name retrieval refers to the process of matching and searching based on keywords contained in file names. This method is usually used to quickly locate files with specific naming characteristics. Specifically, file name retrieval can achieve efficient file name matching based on regular expressions, supporting multiple modes such as fuzzy matching and wildcard matching, thereby improving retrieval flexibility and efficiency.
[0194] Full-text content retrieval refers to searching the text content within a document to find files containing specified keywords or semantic content. Full-text content retrieval typically relies on a full-text search engine, such as Elasticsearch. It can build full-text indexes for document files (such as Word, PDF, TXT, etc.) and supports advanced search functions such as keyword search and phrase matching.
[0195] Metadata retrieval refers to a method of searching based on the additional attribute information (i.e., metadata) of a file. It is primarily used for searching multimedia files (such as videos, audio, and images). Metadata retrieval can build indexes and search capabilities based on the Lucene engine (an open-source full-text search engine library maintained by the Apache Software Foundation). For audio files, metadata types include, but are not limited to: artist, album, lyrics, duration, etc.; for video files, metadata types include, but are not limited to: duration, resolution, encoding format, frame rate, etc.; for image files, metadata types include, but are not limited to: resolution, color mode, etc. Furthermore, text content in images can be extracted using OCR (Optical Character Recognition) technology, allowing users to perform searches based on the aforementioned metadata fields.
[0196] Here, filename retrieval and full-text content retrieval can be file retrieval methods that are already present in the user's terminal device. By identifying and reusing these locally existing retrieval methods, the system does not need to rebuild the relevant functional modules, thereby improving the overall retrieval efficiency and reducing development and deployment costs.
[0197] It should be noted that the at least one document retrieval method used to perform the retrieval task is not limited to the above-mentioned methods, and may also include other retrieval methods applicable to the current retrieval conditions, such as iterative retrieval methods, semantic retrieval methods, etc., without any restrictions here.
[0198] Based on the various target structured document retrieval sub-conditions in the target structured document retrieval criteria, one or more suitable document retrieval methods can be flexibly selected for collaborative retrieval to achieve more efficient and accurate document location.
[0199] In some optional implementations, after obtaining the target structured document retrieval conditions, the target structured document retrieval conditions can be parsed and translated to generate at least one set of executable document retrieval conditions. Each set of executable document retrieval conditions includes executable document retrieval sub-conditions that correspond one-to-one with each target structured document retrieval sub-condition. Then, for each set of executable document retrieval conditions, it is determined whether there are executable document retrieval sub-conditions in the set that match at least one retrieval method among filename retrieval, full-text content retrieval, and metadata retrieval. Finally, based on the executable document retrieval sub-conditions that match at least one retrieval method among filename retrieval, full-text content retrieval, and metadata retrieval, at least one document retrieval method for performing the retrieval task is determined.
[0200] In this embodiment, the target structured document retrieval criteria are the structured expressions generated after the user's natural language retrieval statement is parsed by the model.
[0201] For example, the target search query "PDF reports modified last month" could have the following structured document search criteria: (DATE>=CURRENT-"2 months")AND(DATE<=CURRENT-"1 month")AND(TYPE IS"PDF")ANDCONTENT CONTAINS"report")
[0202] To enable the target structured document retrieval criteria to be executed by specific document retrieval methods, the target structured document retrieval criteria can first be parsed and translated to generate one or more executable document retrieval criterion sets. Each executable document retrieval criterion set contains executable retrieval sub-criterions that correspond one-to-one with the target structured document retrieval sub-criterions, used to adapt to different types of document retrieval methods.
[0203] If the TYPE (file type) field is included in the target structured file search criteria, it means that the user has specified the file type. In order to achieve accurate retrieval, the natural language or semantic type in this field needs to be converted into the corresponding set of file extensions so that the system can identify and match files that meet the criteria.
[0204] Specifically, the translation logic mapping table for file types is shown in Table 1.
[0205] Table 1: Translation Logical Mapping Table for File Types
[0206]
[0207] Here, the translation logic for file types can be as follows: If the value of the TYPE field corresponding to the target structured file search condition is "document" or "picture," it is first mapped to the corresponding syntax type (e.g., document, picture). Then, the corresponding set of file extensions is extracted according to the mapping table (e.g., document can be pdf, txt, doc, docx, etc., and picture can be jpg, jpeg, jpe, etc.) for retrieving matching files. If the value of the TYPE field corresponding to the target structured file search condition is already a corresponding extension, then matching files are directly retrieved based on that extension (e.g., TYPEIS "PDF" can directly retrieve PDF files). If the value of the TYPE field in the target structured file search condition is not in the syntax type, it is treated as a file extension.
[0208] If the search criteria for the target structured file include a DATE field, it indicates that the user has specified a search requirement for the file's time attribute. This field is used to limit the time dimension of the file, such as creation time, modification time, or access time, in order to filter out files that meet the criteria within a specific time range.
[0209] Here, the translation logic for dates can be as follows: if the DATE field is an absolute date, such as CURRENT = January 1, 2024, then the date is directly converted into a timestamp for use in constructing subsequent search criteria.
[0210] If the value of the DATE field is a relative date expression, such as CURRENT-"2day", then the current timestamp must first be obtained and converted according to the different time units. The specific conversion rules are as follows:
[0211] Year: Get the current date and time, keeping the year Y; set the date and time to January 1, Y year 00:00:00; subtract 1 second to get the end time of the previous year: the timestamp of December 31, Y-1 year 23:59:59; then subtract N years from this timestamp to get the timestamp of December 31, YN year 23:59:59, which is used as the starting point of relative time.
[0212] Month: Get the current date and time, keeping the month M; set the date and time to M month 1st 00:00:00; subtract 1 second to get the end time of the previous month: M-1 month last day 23:59:59 timestamp; then subtract N months from this timestamp to get MN month last day 23:59:59 timestamp, as the starting point of relative time.
[0213] Week: Get the current date and time, calculate the Monday of the week D; set the date and time to D day 00:00:00; subtract 1 second to get the end time of last week: D-1 day 23:59:59 timestamp; then subtract N weeks (i.e. N×7×24×60×60 seconds) from this timestamp to get DN×7 day 23:59:59 timestamp, which is used as the starting point of relative time.
[0214] Day: Get the current date and time, keeping Day D; set the date and time to Day D 00:00:00; subtract 1 second to get the end time of the previous day: the timestamp of Day D-1 23:59:59; then subtract N days (i.e., N×24×60×60 seconds) from this timestamp to get the timestamp of Day DN 23:59:59, which is used as the starting point of relative time.
[0215] Hour: Get the current timestamp as the end time; subtract H×60×60 seconds from this timestamp to get the start time, which represents the time point H hours ago.
[0216] Minutes: Get the current timestamp as the end time; subtract m × 60 seconds from this timestamp to get the start time, which represents the time point m minutes ago.
[0217] If the target structured file search criteria include the PATH (path) field, it indicates that the user has specified the file storage path. This field is used to limit the file's location information in the file system so as to filter out files located in the specified directory or path.
[0218] Here, the translation logic mapping table for the path can be shown in Table 2.
[0219] Here, the path translation logic can be as follows: if the value of the PATH field corresponding to the target structured file retrieval condition is a field value (e.g., ROOT, HOME, etc.), then it is converted into the corresponding path (e.g., / , ~ / ) according to the path translation logic mapping table for retrieving matching files.
[0220] If the value of the PATH field corresponding to the search criteria for the target structured file is already the corresponding path (e.g., / or ~ / Downloads, etc.), then the search will be performed directly based on that path, thereby improving the accuracy and efficiency of path retrieval.
[0221] Table 2: Path Translation Logic Mapping Table
[0222] describe Field value Corresponding path root directory ROOT / Main directory HOME ~ / Download Directory Download ~ / Downloads Image Catalog Pictures ~ / Pictures Documentation Table of Contents Documents ~ / Documents Music Catalog Music ~ / Music desktop Desktop ~ / Desktop
[0223] If the target structured file search criteria include the SIZE (file size) field, it indicates that the user has specified a search requirement for file size. This field is used to limit the file size range in order to filter out files that meet the specified size criteria, thus satisfying the user's needs for fine-grained management and search of file size.
[0224] The SIZE field can be expressed as a single comparison condition (e.g., SIZE > "10MB") or a range condition (e.g., SIZE BETWEEN "100KB" AND "5MB").
[0225] Here, the translation logic mapping table for file size can be shown in Table 3.
[0226] Table 3: Translation Logic Mapping Table for File Size
[0227] Field value File size (Bytes) N GB N*1024*1024*1024 N MB N*1024*1024 N KB N*1024 NB N
[0228] Where N represents the file size entered by the user, and GB, MB, KB, and B represent different storage units.
[0229] Here, the translation logic for file size can be as follows: the file size expression (such as 10MB) input by the user is uniformly converted into a value in bytes (B) in order to generate executable size matching conditions and achieve accurate retrieval of file size dimension.
[0230] If the target structured document search criteria include keyword fields (such as NAME, CONTENT), it indicates that the user wants to perform document searches based on text content matching. Then, the system directly searches for files containing the specified keyword within the text information extracted from filenames, file content, or images, thereby achieving precise location of the text information.
[0231] Specifically, in the target structured document search criteria, if the NAME field is included, it indicates that the user wants to find files whose filenames contain the specified keyword. For example, NAME "report" means to find all files whose filenames contain "report". In the target structured document search criteria, if the CONTENT field is included, it indicates that the user wants to find document-type files (such as Word, PDF, TXT, etc.) or image text content extracted through OCR that contain the specified keyword within the file content.
[0232] If the search criteria for the target structured file include a duration field, it indicates that the user has specified a search requirement for the duration of the multimedia file. This field is mainly used to filter files with time length attributes, such as audio and video files, in order to match files that meet the specified duration range and satisfy the user's refined search needs for multimedia content.
[0233] Here, the translation logic for duration can be: year*60*60*24*365+month*60*60*24*30+week*60*60*24*7+day*60*60*24+hour*60*60+minute*60+second, which is used to uniformly convert time units such as year, month, week, day, etc. into values in seconds.
[0234] If the search criteria for the target structured file include fields for metadata retrieval, such as ARTIST (artist), ALBUM (album), RESOLUTION (resolution), and color mode, it indicates that the user wants to search based on the file's additional attribute information (i.e., metadata). This search method is mainly used for structured attribute filtering of multimedia files (such as audio, video, and images), enabling more granular file searching and management.
[0235] The fields ARTIST (artist), ALBUM (album), RESOLUTION (resolution), and color mode also have corresponding translation rules, which will not be elaborated here.
[0236] In the search criteria for target structured documents, it also supports two combination methods: "AND" and "OR". When the "AND" condition is always "AND", the condition is appended to a search condition chain. When an "OR" condition is encountered, all current chain conditions are copied, and the number of copies is the number of "OR" conditions.
[0237] For example, if the current condition is A1, A2, and A3, which is one link, then adding a new condition B1, B2, or B3 will generate three new links: A1, A2, A3, and B1; A1, A2, A3, and B2; and A1, A2, A3, and B3.
[0238] Each link can be a set of executable file retrieval criteria.
[0239] After the above parsing and translation, at least one set of executable file retrieval conditions is obtained. Then, for each set of executable file retrieval conditions, it can be determined whether there are executable file retrieval sub-conditions in the set that match at least one of the retrieval methods of filename retrieval, full-text content retrieval, and metadata retrieval.
[0240] In some alternative implementations, each retrieval method corresponds to a preset set of searchable dimensions.
[0241] Specifically, filename retrieval corresponds to a preset first set of searchable dimensions, full-text content retrieval corresponds to a preset second set of searchable dimensions, and metadata retrieval corresponds to a preset third set of searchable dimensions.
[0242] Here, the first executable search sub-condition set includes a first searchable dimension that can be searched by filename retrieval. The first executable search sub-condition set may also include first target structured file search sub-conditions corresponding to each search dimension. The first executable search sub-condition set may also include first executable file search sub-conditions that correspond one-to-one with each first target structured file search sub-condition.
[0243] For example, the first searchable dimension may include filename search, path search, file size search, quantity search, date search, etc.
[0244] The second executable search sub-condition set includes a second searchable dimension that can be searched using full-text content retrieval. The second executable search sub-condition set may also include second target structured document search sub-conditions corresponding to each search dimension. The second executable search sub-condition set may also include second executable document search sub-conditions that correspond one-to-one with each second target structured document search sub-condition.
[0245] For example, the second searchable dimension can include content search, path search, file size search, quantity-based search, date search, etc.
[0246] The third executable search sub-condition set includes a third searchable dimension that can be searched using metadata retrieval. The third executable search sub-condition set may also include third target structured document search sub-conditions corresponding to each search dimension. The third executable search sub-condition set may also include third executable document search sub-conditions that correspond one-to-one with each third target structured document search sub-condition.
[0247] For example, the third searchable dimension can include metadata retrieval (resolution, encoding format, color mode, etc.), path retrieval, file size retrieval, quantity condition retrieval, date retrieval, duration retrieval, and so on.
[0248] Determine whether there exists an executable file retrieval sub-condition in the executable file retrieval condition set that matches at least one of the retrieval methods among filename retrieval, full-text content retrieval, and metadata retrieval; finally, based on the executable file retrieval sub-condition that matches at least one of the retrieval methods among filename retrieval, full-text content retrieval, and metadata retrieval, determine at least one file retrieval method for performing the retrieval task.
[0249] In some optional implementations, it is determined whether there are executable file retrieval sub-conditions in the executable file retrieval condition set that match at least one of the retrieval methods: filename retrieval, full-text content retrieval, and metadata retrieval.
[0250] Specifically, it can be determined whether there is an executable file retrieval sub-condition in the executable file retrieval condition set that matches the first retrieval dimension set. If it is determined to be yes, it is determined that there is an executable file retrieval sub-condition in the executable file retrieval condition set that matches the file name retrieval. If it is determined not to be yes, it is determined that there is no executable file retrieval sub-condition in the executable file retrieval condition set that matches the file name retrieval.
[0251] Here, when the first searchable dimension set only includes the first searchable dimension, it can be determined whether there is a first executable file search sub-condition corresponding to the first searchable dimension in the executable file search condition set, that is, whether there is an executable file search sub-condition matching the first target structure file search sub-condition corresponding to the first searchable dimension. Here, each executable search sub-condition in the executable file search condition set can be mapped to the corresponding target structure file search sub-condition first, and then converted into the corresponding search dimension to determine whether there is an executable file search sub-condition matching the first searchable dimension set in the executable file search condition set.
[0252] If it is determined that there is an executable file retrieval sub-condition in the executable file retrieval condition set that matches the first retrieval dimension set, then it is determined that there is no executable file retrieval sub-condition in the executable file retrieval condition set that matches the first retrieval dimension set.
[0253] For example, if the executable file search criteria set includes keywords related to filenames, and the corresponding first searchable dimension can be filename search, then it is determined that there exists an executable file search sub-condition in the executable file search criteria set that matches the first searchable dimension set.
[0254] When the first executable search sub-condition set also includes the first target structured file search sub-condition corresponding to each first search dimension, it can be determined whether there is an executable file search sub-condition corresponding to the first target structured file search sub-condition in the executable file search condition set. Here, each first executable search sub-condition can be mapped to the corresponding target structured file search sub-condition to determine whether there is an executable file search sub-condition matching the first search dimension set in the executable file search condition set.
[0255] When the first executable retrieval sub-condition set also includes first executable file retrieval sub-conditions that correspond one-to-one with each first target structured file retrieval sub-condition, it can be determined whether there are executable file retrieval sub-conditions in the executable file retrieval sub-condition set that are the same as the first executable file retrieval sub-conditions, so as to determine whether there are executable file retrieval sub-conditions in the executable file retrieval sub-condition set that match the first retrieval dimension set.
[0256] It can be determined whether there is an executable file retrieval sub-condition in the executable file retrieval condition set that matches the second retrieval dimension set. If it is determined to be yes, it is determined that there is an executable file retrieval sub-condition in the executable file retrieval condition set that matches the full-text content retrieval. If it is determined not to be yes, it is determined that there is no executable file retrieval sub-condition in the executable file retrieval condition set that matches the full-text content retrieval.
[0257] Here, when the second searchable dimension set only includes the second searchable dimension, it can be determined whether there is a second executable file search sub-condition corresponding to the second searchable dimension in the executable file search condition set, that is, whether there is an executable file search sub-condition matching the second target structure file search sub-condition corresponding to the second searchable dimension. Here, each executable search sub-condition in the executable file search condition set can be mapped to the corresponding target structure file search sub-condition first, and then converted into the corresponding search dimension to determine whether there is an executable file search sub-condition matching the second searchable dimension set in the executable file search condition set.
[0258] If it is determined that there is an executable file retrieval sub-condition in the executable file retrieval condition set that matches the second retrieval dimension set, then it is determined that there is no executable file retrieval sub-condition in the executable file retrieval condition set that matches the second retrieval dimension set.
[0259] When the second executable search sub-condition set also includes second target structured file search sub-conditions corresponding to each second search dimension, it can be determined whether there are executable file search sub-conditions in the executable file search condition set that correspond to the second target structured file search sub-conditions. Here, each second executable search sub-condition can be mapped to the corresponding target structured file search sub-condition to determine whether there are executable file search sub-conditions in the executable file search condition set that match the second search dimension set.
[0260] When the second executable retrieval sub-condition set also includes second executable file retrieval sub-conditions that correspond one-to-one with each second target structured file retrieval sub-condition, it can be determined whether there are executable file retrieval sub-conditions in the executable file retrieval sub-condition set that are the same as the second executable file retrieval sub-conditions, so as to determine whether there are executable file retrieval sub-conditions in the executable file retrieval sub-condition set that match the second retrieval dimension set.
[0261] It can be determined whether there is an executable file retrieval sub-condition in the executable file retrieval condition set that matches the third retrieval dimension set. If it is determined to be yes, it is determined that there is an executable file retrieval sub-condition in the executable file retrieval condition set that matches the metadata retrieval. If it is determined not to be yes, it is determined that there is no executable file retrieval sub-condition in the executable file retrieval condition set that matches the metadata retrieval.
[0262] Here, when the third searchable dimension set only includes the third searchable dimension, it can be determined whether there is a third executable file search sub-condition in the executable file search condition set that corresponds to the third searchable dimension, that is, whether there is an executable file search sub-condition that matches the third target structure file search sub-condition corresponding to the third searchable dimension. Here, each executable search sub-condition in the executable file search condition set can be mapped to the corresponding target structure file search sub-condition first, and then converted into the corresponding search dimension to determine whether there is an executable file search sub-condition in the executable file search condition set that matches the third searchable dimension set.
[0263] If it is determined that there is an executable file retrieval sub-condition in the executable file retrieval condition set that matches the third retrieval dimension set, then it is determined that there is no executable file retrieval sub-condition in the executable file retrieval condition set that matches the third retrieval dimension set.
[0264] When the third executable search sub-condition set also includes the third target structured file search sub-condition corresponding to each third search dimension, it can be determined whether there is an executable file search sub-condition corresponding to the third target structured file search sub-condition in the executable file search condition set. Here, each third executable search sub-condition can be mapped to the corresponding target structured file search sub-condition to determine whether there is an executable file search sub-condition matching the third search dimension set in the executable file search condition set.
[0265] When the third executable retrieval sub-condition set also includes third executable file retrieval sub-conditions that correspond one-to-one with each third target structured file retrieval sub-condition, it can be determined whether there are executable file retrieval sub-conditions in the executable file retrieval sub-condition set that are the same as the third executable file retrieval sub-conditions, so as to determine whether there are executable file retrieval sub-conditions in the executable file retrieval sub-condition set that match the third retrieval dimension set.
[0266] Accordingly, it can be determined whether there are executable file retrieval sub-conditions in the executable file retrieval condition set that match at least one of the retrieval methods of file name retrieval, full-text content retrieval, and metadata retrieval. Then, based on the executable file retrieval sub-conditions that match at least one of the retrieval methods of file name retrieval, full-text content retrieval, and metadata retrieval, at least one file retrieval method for performing the retrieval task can be determined.
[0267] For example, if the executable file retrieval sub-condition contains keywords for both the file name and the file content, then the retrieval task to be performed can be determined as file name retrieval and full-text content retrieval.
[0268] Step 204: Perform a retrieval operation on each file in the target file set according to the target structured file retrieval conditions and at least one file retrieval method.
[0269] In this embodiment, for each file retrieval method, based on the target structured file retrieval conditions, the corresponding retrieval operation is performed on each file in the target file set. Through the coordinated execution of multiple retrieval methods, multi-dimensional and high-precision matching of files is achieved.
[0270] Specifically, when performing a search operation, the target directory (target file set) range can be determined first, that is, the file storage path on which the search will be performed. The target directory is determined as follows: when the user specifies a specific directory in the search criteria (e.g., through the PATH field), the system will limit the search scope to the user-specified directory and its subdirectories; when the user does not explicitly specify a directory, the search scope will be set to the preset global directory or the user's home directory (such as HOME or the system's default file index directory) by default, to ensure the comprehensiveness of the search and the availability of the system.
[0271] Step 205: Determine at least one target file that matches the target search statement based on the search results.
[0272] In this embodiment, after completing the multi-dimensional search operation on the target file set, a set of files that meet the target structured file search conditions will be selected based on the search results, and at least one target file matching the user's intent will be determined from it. Specifically: if the user specifies the number of files to be returned in the search statement, the top N files that meet the sorting rules (such as time sorting, relevance sorting, etc.) can be selected from the search results as the final set of target files to be matched; if the user does not explicitly specify the number of files to be returned, a default number of files can be returned according to a preset strategy (such as returning the top 10 matching results by default), or all files that meet the conditions can be returned to ensure the completeness of the search results and the degree of matching with the user's needs.
[0273] In addition, search results can be sorted based on factors such as file relevance score, time attribute, and path priority, improving the efficiency and accuracy of users obtaining the files they need.
[0274] The document retrieval method disclosed herein includes: obtaining a target retrieval statement, wherein the target retrieval statement includes document retrieval conditions for at least one retrieval dimension described in natural language; generating target structured document retrieval conditions based on the target retrieval statement, wherein the target structured document retrieval conditions include target structured document retrieval sub-conditions corresponding to each retrieval dimension; determining at least one document retrieval method for performing the retrieval task based on the target structured document retrieval conditions; performing retrieval operations on each file in the target document set based on the target structured document retrieval conditions and at least one document retrieval method; and determining at least one target file matching the target retrieval statement based on the retrieval results. This disclosure effectively reduces the operational complexity for users by converting the user-input natural language-described retrieval statement into structured document retrieval conditions. Furthermore, based on the structured document retrieval conditions, at least one document retrieval method can be selected to match different document retrieval methods, thereby achieving unified scheduling of multiple search engines. This method effectively solves the problems of strong dependence on keywords, complex filtering configuration, and high threshold for intelligent search deployment in traditional document retrieval, achieving an efficient and intelligent retrieval experience on ordinary devices.
[0275] Further reference Figure 3 As an implementation of the methods shown in the above figures, this disclosure provides an embodiment of a document retrieval device, which is similar to... Figure 2 The method embodiments shown correspond to this. This device can be applied to terminal devices or servers.
[0276] like Figure 3 As shown, the document retrieval device 300 of this embodiment includes: a retrieval statement acquisition unit 301, a retrieval condition generation unit 302, a retrieval method determination unit 303, a retrieval unit 304, and a document determination unit 305. The retrieval statement acquisition unit 301 is used to acquire a target retrieval statement, wherein the target retrieval statement includes document retrieval conditions for at least one retrieval dimension described in natural language; the retrieval condition generation unit 302 is used to generate target structured document retrieval conditions based on the target retrieval statement, wherein the target structured document retrieval conditions include target structured document retrieval sub-conditions corresponding to each retrieval dimension; the retrieval method determination unit 303 is used to determine at least one document retrieval method for performing the retrieval task based on the target structured document retrieval conditions; the retrieval unit 304 is used to perform retrieval operations on each file in the target document set according to the target structured document retrieval conditions and at least one document retrieval method; and the document determination unit 305 is used to determine at least one target file matching the target retrieval statement based on the retrieval results.
[0277] In this embodiment, the specific processing of the search statement acquisition unit 301, the search condition generation unit 302, the search method determination unit 303, the search unit 304, and the document determination unit 305, and the resulting technical effects, can be referred to respectively. Figure 2 The relevant descriptions of steps 201 to 205 in the corresponding embodiments will not be repeated here.
[0278] In some optional implementations, the retrieval condition generation unit 302 may be further used to:
[0279] Input the target search statement and structured document search condition prompts into the target document search condition structured model, and output the target structured document search conditions.
[0280] In some alternative implementations, the target document retrieval conditional structured model is trained through the following steps:
[0281] Obtain a training dataset, which includes at least one training retrieval statement and standard structured document retrieval conditions corresponding to each training retrieval statement. Each training retrieval statement includes document retrieval conditions for at least one retrieval dimension described in natural language.
[0282] Input at least one training retrieval statement and structured document retrieval condition prompts into the initial document retrieval condition structured model, and output the predicted structured document retrieval conditions corresponding to each training retrieval statement;
[0283] Based on the difference between the predicted structured document retrieval conditions of each training retrieval statement and the standard structured document retrieval conditions, the model parameters of the initial document retrieval condition structured model are adjusted.
[0284] The initial document retrieval condition structured model with adjusted model parameters is determined as the target document retrieval condition structured model.
[0285] In some alternative implementations, at least one file retrieval method includes at least one of filename retrieval, full-text content retrieval, and metadata retrieval.
[0286] In some optional implementations, the retrieval method determining unit 303 may be further used for:
[0287] The target structured file retrieval conditions are parsed and translated to generate at least one set of executable file retrieval conditions, wherein each set of executable file retrieval conditions includes executable file retrieval sub-conditions that correspond one-to-one with each target structured file retrieval sub-condition;
[0288] For each executable file search condition set, determine whether there exists an executable file search sub-condition in the executable file search condition set that matches at least one of the search methods: file name search, full text content search, and metadata search;
[0289] Based on executable file retrieval sub-conditions that match at least one of the retrieval methods—filename retrieval, full-text content retrieval, and metadata retrieval—determine at least one file retrieval method for performing the retrieval task.
[0290] In some optional implementations, filename retrieval corresponds to a preset first set of searchable dimensions, full-text content retrieval corresponds to a preset second set of searchable dimensions, and metadata retrieval corresponds to a preset third set of searchable dimensions. The retrieval method determination unit 303 can be further used for:
[0291] Determine whether there are any executable file retrieval sub-conditions in the executable file retrieval condition set that match the first retrieval dimension set;
[0292] If it is determined that there is an executable file retrieval sub-condition in the executable file retrieval condition set that matches the file name retrieval;
[0293] If the determination is no, it is determined that there is no executable file retrieval sub-condition in the executable file retrieval condition set that matches the file name retrieval;
[0294] Determine whether there are any executable file retrieval sub-conditions in the executable file retrieval condition set that match the second retrieval dimension set;
[0295] If confirmed, it is determined that there exists an executable file retrieval sub-condition in the executable file retrieval condition set that matches the full-text content retrieval;
[0296] If not, it is determined that there is no executable file retrieval sub-condition in the executable file retrieval condition set that matches the full-text content retrieval;
[0297] Determine whether there are any executable file retrieval sub-conditions in the executable file retrieval condition set that match the third retrieval dimension set;
[0298] If confirmed, it is determined that there exists an executable file retrieval sub-condition in the executable file retrieval condition set that matches the metadata retrieval;
[0299] If not, it means that there is no executable file retrieval sub-condition in the executable file retrieval condition set that matches the metadata retrieval.
[0300] It should be noted that the implementation details and technical effects of each unit in the document retrieval device provided in the embodiments of this disclosure can be referred to the descriptions of other embodiments in this disclosure, and will not be repeated here.
[0301] The following is for reference. Figure 4 It shows a schematic diagram of the structure of a computer system 400 suitable for implementing the terminal device of this disclosure. Figure 4 The computer system 400 shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments of this disclosure.
[0302] like Figure 4 As shown, the computer system 400 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage device 408 into a random access memory (RAM) 403. The RAM 403 also stores various programs and data required for the operation of the computer system 400. The processing device 401, ROM 402, and RAM 403 are interconnected via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0303] Typically, the following devices can be connected to I / O interface 405: input devices 506 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, etc.; output devices 407 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 408 including, for example, magnetic tapes, hard disks, etc.; and communication devices 409. Communication device 409 allows computer system 400 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 4 A computer system 400 with various electronic devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0304] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 409, or installed from a storage device 408, or installed from a ROM 402. When the computer program is executed by a processing device 401, it performs the functions defined in the methods of embodiments of this disclosure.
[0305] It should be noted that the computer-readable medium described above in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0306] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0307] The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the following functions: Figure 2 The illustrated embodiments and their alternative implementations demonstrate a document retrieval method.
[0308] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and Python, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0309] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0310] The units described in the embodiments of this disclosure can be implemented in software or in hardware. The names of the units are not necessarily limiting in certain circumstances; for example, a search query retrieval unit can also be described as a "retrieval unit".
[0311] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
Claims
1. A file retrieval method characterized by, The method comprises: obtaining a target search statement, wherein the target search statement comprises a file search condition of at least one search dimension described in natural language; generating a target structured file search condition according to the target search statement, wherein the target structured file search condition comprises a target structured file search sub-condition corresponding to each search dimension; determining at least one file search method for performing a search task according to the target structured file search condition; performing a search operation on each file in a target file set according to the target structured file search condition and the at least one file search method; determining at least one target file matched with the target search statement according to a search result.
2. The method of claim 1, wherein, The generating of the target structured file search condition according to the target search statement comprises: inputting the target search statement and a structured file search condition prompt word into a target file search condition structured model to output the target structured file search condition.
3. The method of claim 2, wherein, The target file search condition structured model is obtained by the following steps: obtaining a training data set, wherein the training data set comprises at least one training search statement and a standard structured file search condition corresponding to each training search statement, and each training search statement comprises a file search condition of at least one search dimension described in natural language; inputting the at least one training search statement and a structured file search condition prompt word into an initial file search condition structured model to output a predicted structured file search condition corresponding to each training search statement; adjusting model parameters of the initial file search condition structured model according to a difference between the predicted structured file search condition of each training search statement and the standard structured file search condition; determining the initial file search condition structured model with adjusted model parameters as the target file search condition structured model.
4. The method of claim 1, wherein, The at least one file search method comprises at least one of a file name search, a full-text content search and a metadata search.
5. The method of claim 4, wherein, The determining of the at least one file search method for performing a search task according to the target structured file search condition comprises: parsing and translating the target structured file search condition to generate at least one executable file search condition set, wherein each executable file search condition set comprises an executable file search sub-condition corresponding to each target structured file search sub-condition; determining, for each executable file search condition set, whether there is an executable file search sub-condition matched with at least one of the file name search, the full-text content search and the metadata search in the executable file search condition set; determining the at least one file search method for performing a search task according to the executable file search sub-condition matched with at least one of the file name search, the full-text content search and the metadata search.
6. The method of claim 5, wherein, The file name retrieval corresponds to a preset first retrievable dimension set, the full-text content retrieval corresponds to a preset second retrievable dimension set, the metadata retrieval corresponds to a preset third retrievable dimension set, and the determination of whether the executable file retrieval condition set contains an executable file retrieval sub-condition matching at least one of the file name retrieval, the full-text content retrieval and the metadata retrieval includes: determining whether the executable file retrieval condition set contains an executable file retrieval sub-condition matching the first retrievable dimension set; if yes, determining that the executable file retrieval condition set contains an executable file retrieval sub-condition matching the file name retrieval; if no, determining that the executable file retrieval condition set does not contain an executable file retrieval sub-condition matching the file name retrieval; determining whether the executable file retrieval condition set contains an executable file retrieval sub-condition matching the second retrievable dimension set; if yes, determining that the executable file retrieval condition set contains an executable file retrieval sub-condition matching the full-text content retrieval; if no, determining that the executable file retrieval condition set does not contain an executable file retrieval sub-condition matching the full-text content retrieval; determining whether the executable file retrieval condition set contains an executable file retrieval sub-condition matching the third retrievable dimension set; if yes, determining that the executable file retrieval condition set contains an executable file retrieval sub-condition matching the metadata retrieval; if no, determining that the executable file retrieval condition set does not contain an executable file retrieval sub-condition matching the metadata retrieval.
7. A file retrieval apparatus characterized by comprising: The device includes: a retrieval statement acquisition unit configured to acquire a target retrieval statement, wherein the target retrieval statement includes file retrieval conditions of at least one retrieval dimension described in natural language; a retrieval condition generation unit configured to generate a target structured file retrieval condition according to the target retrieval statement, wherein the target structured file retrieval condition includes a target structured file retrieval sub-condition corresponding to each retrieval dimension; a retrieval method determination unit configured to determine at least one file retrieval method for performing a retrieval task according to the target structured file retrieval condition; a retrieval unit configured to perform a retrieval operation on each file in a target file set according to the target structured file retrieval condition and the at least one file retrieval method; a file determination unit configured to determine at least one target file matching the target retrieval statement according to a retrieval result.
8. An electronic device, comprising: One or more processors; a storage device having one or more programs stored thereon, when the one or more programs are executed by the one or more processors, the one or more processors implement the method of any one of claims 1-6. a computer program stored thereon, wherein the computer program is executed by one or more processors to implement the method of any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, 10. A computer program product, characterised in that, comprising computer program / instructions which, when executed by a processor, implement the method according to any one of claims 1-6.
Citation Information
Patent Citations
File retrieval method and apparatus and terminal
CN105574062A
Method and system for searching files based on natural language and computing equipment
CN117235014A
File retrieval method and device, equipment and storage medium
CN120256542A
System and method for searching document, and program
JP2003308335A