Index construction method, chip, electronic equipment and medium

By introducing the first module and the second module into the electronic device, loading and unloading the model on demand, the problem of resource waste in the index construction branch is solved, and more efficient resource utilization is achieved.

CN119513045AActive Publication Date: 2025-02-25HONOR DEVICE CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202510019493.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-07
Publication Date
2025-02-25
Estimated Expiration
2045-01-07

AI Technical Summary

Technical Problem

The prior art frequently loads and unloads models in index construction branches, resulting in waste of equipment resources.

Method used

By introducing the first module and the second module in the electronic device, the model is loaded and unloaded as needed, and the model is kept loaded only when an index is needed.

Benefits of technology

It effectively reduces unnecessary model loading and unloading operations, saves equipment resources, and improves the resource utilization rate of index construction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119513045A_ABST
    Figure CN119513045A_ABST
Patent Text Reader

Abstract

The invention provides an index construction method, a chip, electronic equipment and a medium. The method is applied to the electronic equipment comprising a first module and a second module. The first module is used for generating first information of any file needing index construction; the method comprises the following steps: if a first type index and / or a second type index of a to-be-constructed file are / is not loaded with a first model, loading the first model; executing the first operation and / or the second operation by running the second module; the first operation comprises the following steps: if the first type index of the file to be constructed, generating the first type index of the file according to the first information of the file and a first model; the second operation comprises the step of generating a second type index of the file according to the file and the first model if the second type index of the file to be constructed; and if the file of the to-be-constructed first type index and the file of the to-be-constructed second type index do not exist and the first model is loaded, unloading the first model. According to the invention, equipment resources can be saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of electronic equipment, and in particular to an index construction method, chip, electronic equipment and medium. Background Art

[0002] A large number of files may be stored in an electronic device. In order to quickly search for a desired target file in a large number of files, the search may be performed in combination with the index information of the file. Thus, it is necessary to construct an index for the file.

[0003] There may be multiple ways to construct an index, and for different index construction methods, there may be multiple index construction branches in the electronic device. When the index construction branch is running, a model may be loaded to use the model function to perform corresponding processing operations.

[0004] Different index building branches can contain the same processing operations, so multiple index building branches can load the same model on demand, but this technical implementation is prone to waste of resources. Summary of the invention

[0005] The present application provides an index construction method, chip, electronic device and medium, which help save device resources.

[0006] In a first aspect, an embodiment of the present application provides an index construction method, which is applied to an electronic device, and the electronic device includes a first module and a second module; the first module is used to generate first information of a first file, and the first file is any file that needs to be indexed; the index construction method includes: if at least one of the first type index and the second type index of the first file is to be constructed, and the first model is not loaded, then the first model is loaded; by running the second module, at least one of the first operation and the second operation is performed; the first operation includes: if the first type index of the first file is to be constructed, then the first type index of the first file is generated according to the first information of the first file and the first model; the second operation includes: if the second type index of the first file is to be constructed, then the second type index of the first file is generated according to the first file and the first model; if there is no file to be indexed with the first type, there is no file to be indexed with the second type, and the first model has been loaded, then the first model is unloaded.

[0007] In an embodiment of the present application, the electronic device loads / unloads the first model on demand in combination with the construction requirements of various types of indexes, so that the model is always kept loaded when any type of index is to be constructed, and the model is unloaded when all types of indexes do not need to be constructed. This can avoid loading / unloading the model too frequently, reduce unnecessary model loading / unloading operations, and thus reduce unnecessary waste of device resources.

[0008] Optionally, the index construction method also includes: if at least one of the first type index and the second type index of the first file is to be constructed and the second module is not started, starting the second module; if there is no file to be constructed with the first type index, no file to be constructed with the second type index, and the second module is already started, closing the second module.

[0009] By starting / shutting down the second module as needed, unnecessary module start / shutdown operations can be reduced, thereby reducing unnecessary waste of device resources.

[0010] Optionally, the index building method further includes: if a first type index of a first file is to be built and the first module is not started, starting the first module; if there is no file to be built with a first type index and the first module is already started, closing the first module.

[0011] By starting / shutting down the first module as needed, unnecessary module start / shutdown operations can be reduced, thereby reducing unnecessary waste of device resources.

[0012] Optionally, the second module includes a first queue and a second queue; the first queue is used to temporarily store the first information of the first file; the second queue is used to temporarily store the first file or the second information of the first file, and the second information is used to generate a second type of index for the first file; the absence of files to be constructed with the first type of index includes: the first queue is empty; the absence of files to be constructed with the second type of index includes: the second queue is empty.

[0013] Based on the queue situation, it is possible to accurately determine whether there are files to be indexed, which helps to accurately enable / disable modules and load / unload models on demand.

[0014] Optionally, generating the first information of the first file includes: generating the first information of the first file according to the second model; the index construction method also includes: if the first information of the first file is to be generated and the second model is not loaded, loading the second model; if the file to generate the first information does not exist and the second model has been loaded, unloading the second model.

[0015] The electronic device can load / unload the second model on demand based on the generation requirements for the first information, thereby avoiding too frequent loading / unloading of models, reducing unnecessary model loading / unloading operations, and thus reducing unnecessary waste of device resources.

[0016] Optionally, generating the first information of the first file includes: generating the first information of the first file according to the second model; and the processing priority of the first operation is lower than that of the second operation.

[0017] Compared with the search results obtained when searching based on the second type index of some documents, the search results obtained when searching based on the second type index of all documents can be more accurate, which helps to improve the search effect.

[0018] Optionally, the index construction method also includes: obtaining search information; obtaining search results corresponding to each type of index in each type of index based on the search information and various types of indexes already constructed by the electronic device to obtain multiple search results; and generating search results for the search information based on the multiple search results.

[0019] Regardless of whether all kinds of indexes for all files have been constructed, before all kinds of indexes for all files have been constructed, the electronic device always uses a full-path search strategy to implement file search, which can make full use of the constructed index information, thereby helping to improve the search effect.

[0020] Optionally, based on multiple search results, search results for search information are generated, including: performing weighted fusion processing based on a first result of the target file in one or more target search results to obtain a second result of the target file; wherein the target file is any file in the multiple search results; wherein the multiple search results include one or more target search results, the electronic device has constructed an index of the target file of a type corresponding to the target search result, and the sum of the weights corresponding to the one or more target search results is one; based on the second result of the target file, a search result for search information is generated.

[0021] By performing targeted fusion processing of the full-path search results on each file according to the current index construction status of each file when fusion of the full-path search results, the fusion effect can be improved.

[0022] In a second aspect, an embodiment of the present application provides an index building device, which is applied to an electronic device, and the electronic device includes a first module and a second module; the first module is used to generate first information of a first file, and the first file is any file that needs to be indexed; the index building device includes: a first processing module, which is used to load the first model if at least one of the first type index and the second type index of the first file is to be built and the first model is not loaded; a second processing module, which is used to perform at least one of the first operation and the second operation by running the second module; the first operation includes: if the first type index of the first file is to be built, the first type index of the first file is generated according to the first information and the first model; the second operation includes: if the second type index of the first file is to be built, the second type index of the first file is generated according to the first file and the first model; a third processing module, which is used to unload the first model if there is no file with the first type index and the second type index to be built and the first model has been loaded.

[0023] In a third aspect, an embodiment of the present application provides a chip, comprising: a processor, which is used to execute computer program instructions stored in a memory, wherein when the computer program instructions are executed by the processor, the chip is triggered to execute any method as in the first aspect.

[0024] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising one or more memories for storing computer program instructions, and one or more processors, wherein when the computer program instructions are executed by the one or more processors, the electronic device is triggered to execute a method as described in any one of the first aspects.

[0025] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program runs on a computer, the computer executes any method in the first aspect.

[0026] In a sixth aspect, an embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is run on a computer, the computer executes any method in the first aspect.

[0027] The technical effects of the aforementioned aspects can be referenced to each other and will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments are briefly introduced below.

[0029] Figure 1 A schematic diagram of a structure for building an index for an electronic device provided by an embodiment of the present application; Figure 2 A schematic diagram of a structure for building an index for another electronic device provided by an embodiment of the present application; Figure 3 A schematic diagram of a process of constructing a summary index of an electronic device provided by an embodiment of the present application; Figure 4 A timing diagram of a process of constructing a summary index for an electronic device provided by one embodiment of the present application; Figure 5 A schematic diagram of a processing process of a summary service provided by an embodiment of the present application; Figure 6 A schematic diagram of a process of constructing a shard index of an electronic device provided in one embodiment of the present application; Figure 7 A timing diagram of a process of constructing a shard index for an electronic device provided by an embodiment of the present application; Figure 8A schematic diagram of a processing procedure of an AI document search service provided in one embodiment of the present application; Fig. 9 A flowchart of a process of performing document search by an electronic device provided by an embodiment of the present application; Fig.10 A timing diagram of a file search process of an electronic device provided by an embodiment of the present application; Fig.11 A schematic diagram of a processing procedure of another AI document search service provided by an embodiment of the present application; Fig.12 A schematic diagram of a search result display page provided for one embodiment of the present application; Fig.13 A schematic diagram of another search result display page provided for an embodiment of the present application; Fig.14 A flowchart of an index construction method provided in one embodiment of the present application; Fig.15 A schematic diagram of the structure of an electronic device provided by one embodiment of the present application; Fig.16 A schematic diagram of a software architecture of an electronic device provided for one embodiment of the present application. DETAILED DESCRIPTION

[0030] In order to better understand the technical solution of the present application, the embodiments of the present application are described in detail below with reference to the accompanying drawings.

[0031] It should be clear that the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0032] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. The singular forms "a", "said" and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.

[0033] It should be understood that the term "at least one" used in this article refers to one or more, and "plurality" refers to two or more. The term "and / or" used in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. Among them, A and B can be singular or plural. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of singular or plural items. For example, at least one of a, b and c can be represented by: a, b, c, ab, ac, bc, or abc, wherein a, b, c can be single or multiple.

[0034] It should be understood that, although the terms first, second, etc. may be used to describe the set thresholds in the embodiments of the present application, these set thresholds should not be limited to these terms. These terms are only used to distinguish the set thresholds from each other. For example, without departing from the scope of the embodiments of the present application, the first set threshold may also be referred to as the second set threshold, and similarly, the second set threshold may also be referred to as the first set threshold.

[0035] A large number of files, such as documents, videos, pictures, etc., can be stored in an electronic device. In order to quickly search for a desired target file in a large number of files, the search can be performed in combination with the index information of the file. In this way, it is necessary to build an index for the file.

[0036] Preferably, the device for performing file search and the device for storing files may be the same device or different devices.

[0037] There may be multiple types of indexes, such as BM25 indexes, vector indexes, etc.

[0038] Among them, BM25 (Best Match 25) is an improved algorithm based on term frequency (TF) and inverse document frequency (IDF), which can improve the quality of search results. It is a ranking function widely used in information retrieval.

[0039] The construction of BM25 index is usually very fast and does not involve model reasoning. Unlike the construction of BM25 index, which does not rely on model functions, the construction of vector index can rely on the vectorization model, and the vectorization function provided by the vectorization model is used to build the vector index of the file.

[0040] In one example, the vectorization model can encode a piece of text into a string of numbers as the vectorization result of the text.

[0041] Exemplarily, the electronic device can process the document, such as generating a summary, slicing (or slicing, such as 200 words per segment), segmenting, dividing into chapters, extracting high-frequency keywords, etc., and then use the vectorization model to vectorize the processing results of the document (such as the summary of the document, the fragmented content of the document, etc.), and obtain a vector index according to the vectorization result. The vectorization result can be stored as a vector index, or the vectorization result can be processed to obtain a vector index.

[0042] In other examples, the electronic device may not process the document but directly vectorize the entire document.

[0043] Thus, the vector index can be further subdivided into summary index, fragment index, full-text index, etc. By constructing the vector index, the electronic device can intelligently search for the target document required by the user through semantic search, thus supporting the semantic search needs of the user.

[0044] For different index building methods, there may be multiple index building branches in the electronic device. When the index building branch is running, the model may be loaded to use the model function to build the index. Preferably, the index building branch may be a process for building the index in the electronic device.

[0045] Different index building branches can contain the same processing operations, so multiple index building branches can load the same model for processing as needed. For example, to build a summary index and a shard index of a document, an electronic device may have a summary index building branch and a shard index building branch, and both of these branches contain vectorization processing. When running, these two branches can load the same vectorization model to generate a summary index and a shard index respectively.

[0046] Feasibly, the same model mentioned above may be a model in an electronic device (for example, a terminal-side model in a user terminal device), or a model in other devices.

[0047] The operation of loading the model by the index building branch may specifically be loading the model into the memory of the electronic device. After that, the index building branch may also unload the model from the memory to no longer load the model (or end loading the model) to release model resources.

[0048] In addition to loading the same model as above, the index building branch can also load other models for generating indexes. For example, the summary index building branch can load a summary generation model to use the model function to generate a summary. Feasibly, the summary generation model can be a large language model. The large language model is a large artificial intelligence model. By using the large language model to generate a summary, the quality of the summary can be improved.

[0049] For an example, see Figure 1 The electronic device may include a summary index construction branch and a shard index construction branch, wherein the summary index construction branch may include a summary generation module 101 and a summary index construction module 102, and the shard index construction branch may include a document sharding module 103 and a shard index construction module 104.

[0050] like Figure 1 As shown, when there are documents for which summary indexes are to be constructed, the summary generation module 101 can load the summary generation model 105 to generate a summary of the document using the summary generation model 105. Thereafter, the summary index construction module 102 can load the vectorization model 106 to vectorize the summary of the document using the vectorization model 106 to construct a summary index of the document. When there are no documents for which summary indexes are to be constructed, the summary index construction module 102 can uninstall the summary generation model 105 and the vectorization model 106.

[0051]

[0013]

[0013] It is feasible that after generating a summary of a document, the electronic device can generate a summary index of the document based on the summary and display the summary so that the user can view the specific content of the summary.

[0052] like Figure 1 As shown, when there is a document for which a shard index is to be constructed, the document sharding module 103 can shard the document after parsing the document to obtain a plurality of shard contents (or a group of shard contents) of the document. Thereafter, the shard index building module 104 can load the vectorization model 106 to vectorize the shard contents of the document using the vectorization model 106 to construct a shard index of the document. When there is no document for which a shard index is to be constructed, the shard index building module 104 can unload the vectorization model 106.

[0053] Possibly, except Figure 1 The summary index building branch and the shard index building branch shown in the figure may also include other index building branches that need to use the vectorized model 106 in the electronic device. The implementation logic of the other index building branches may be the same as Figure 1 The implementation logic of the two branches shown is similar and will not be elaborated here.

[0054] Since multiple index building branches can load / unload the same model (such as the above-mentioned vectorized model 106) on demand, it is easy for the model to be repeatedly loaded / unloaded, resulting in a waste of device resources.

[0055] In addition, the processing speeds of different index building branches may vary, which can easily lead to resource preemption. For example, the summary index building branch uses a summary generation model to generate summaries, which takes a long time to generate summaries, while the sharding time of the sharding branch is low, resulting in a significant difference in the processing speeds of the two branches. When the summary index building branch uses a vectorized model, it will affect the use of the vectorized model by the sharded index building branch, thereby blocking the sharded index building branch and affecting the index building efficiency of the sharded index building branch.

[0056] In order to solve the problem of device resource waste caused by repeated loading / unloading of the same model in multiple index building branches, an embodiment of the present application provides a model reuse method, which can reuse parts of the same model function in multiple index building branches (such as Figure 1 The summary index building module 102 and the shard index building module 104 shown in the figure are both placed in one index building branch, and the one index building branch is based on other parts of the multiple index building branches (such as Figure 1 The summary generation module 101 and the document segmentation module 103 shown in the figure process the file and load / unload the model as needed.

[0057] Taking the construction of summary index and shard index as an example, the electronic device may include a summary generation module, a file sharding module and an index construction module, wherein a summary vectorization queue and a shard vectorization queue are constructed in the index construction module. Among them, the summary generation module can be used to use the summary generation model to generate a summary of the file; the summary vectorization queue can be used to temporarily store the summary to be vectorized; the file sharding module can be used to shard the file to generate multiple shard contents of the file; the shard vectorization queue can be used to temporarily store the shard contents to be vectorized; the index construction module can be used to use the vectorization model to respectively vectorize the summary in the summary vectorization queue and the shard contents in the shard vectorization queue to correspondingly construct the summary index and the shard index.

[0058] Exemplarily, the above-mentioned file may be a document, a picture containing characters, a video containing characters, etc.

[0059] Preferably, the summary generation module may load the summary generation model when there are files for which summary indexes are to be constructed, and may unload the model so as not to load the summary generation model when there are no files for which summary indexes are to be constructed.

[0060] Feasibly, the index building module can load the vectorized model when there are files for building summary indexes and / or files for building sharded indexes, and unload the model so as not to load the vectorized model when there are no files for building summary indexes and no files for building sharded indexes.

[0061] Optionally, the operation of loading the model may include loading the model into a memory of the electronic device, and the operation of unloading the model may include unloading the model from the memory so as not to load the model again.

[0062] Different from Figure 1 In the example shown, both the summary index construction module 102 and the shard index construction module 104 can load / unload the vectorized model 106 on demand to construct the summary index and the shard index, respectively. In the embodiment of the present application, only the index construction module loads / unloads the vectorized model on demand, so that when any of the summary index and the shard index is to be constructed, the model is always kept loaded, and the model is unloaded when neither the summary index nor the shard index needs to be constructed, so that the summary vectorization process and the shard content vectorization process can share the function of the model, which can avoid loading / unloading the model too frequently, reduce unnecessary model loading / unloading operations, and thus reduce unnecessary waste of device resources.

[0063] See also Figure 2 In one embodiment of the present application, the electronic device may include a summary generation module 201 and an index construction module 202, wherein the index construction module 202 includes a document segmentation module 203, and two task queues are constructed, namely, a summary vectorization queue 204 and a segment vectorization queue 205. The summary vectorization queue 204 may be used to temporarily store summaries to be vectorized, and the segment vectorization queue 205 may be used to temporarily store segment contents to be vectorized.

[0064] In other embodiments, the document segmentation module 203 may also be located outside the index construction module 202 .

[0065] In practice, the summary generation module 201 can be used to generate a summary of the document using a summary generation model 208 (such as a large language model), and then store the generated summary in a summary task database 206 for use by the index construction module 202. The summary task database 206 can be used to store summaries to be vectorized. In addition, the summary generation module 201 can also send the generated summary to a display module of the electronic device for display.

[0066] In one embodiment, the summary generation module 201 may load the summary generation model 208 when there is a document for which a summary is to be generated but the summary generation model 208 is not loaded, so as to use the function of the summary generation model 208 to generate a summary of the document; and may unload the summary generation model 208 to release model resources when there is no document for which a summary is to be generated but the summary generation model 208 is loaded.

[0067] In one embodiment, the electronic device may start the summary generation module 201 when there is a document for which a summary is to be generated but the summary generation module 201 is not started; and may close the summary generation module 201 when there is no document for which a summary is to be generated but the summary generation module 201 is started.

[0068] Alternatively, the index building module 202 may be configured to store the summaries in the summary task database 206 into the summary vectorization queue 204 to wait for vectorization processing.

[0069] Exemplarily, the index building module 202 may store each summary in the summary task database 206 into the end of the summary vectorization queue 204 in the order of the summary generation time. It is feasible that after any summary in the summary task database 206 is stored in the summary vectorization queue 204, the summary task database 206 may no longer store the summary.

[0070] In practice, the document sharding module 203 can be used to shard the document for which the sharding index is to be constructed to generate sharding content of the document, and store the generated sharding content in the sharding task database 207 for use by the index construction module 202. The sharding task database 207 can be used to store the sharding content to be vectorized.

[0071] Optionally, the index building module 202 may be used to store the shard contents in the shard task database 207 into the shard vectorization queue 205 to wait for vectorization processing.

[0072] Exemplarily, the index construction module 202 may store each group of shard contents in the shard task database 207 in the tail of the shard vectorization queue 205 in the order of the shard content storage time. It is feasible that after any group of shard contents in the shard task database 207 is stored in the shard vectorization queue 205, the shard task database 207 may no longer store the group of shard contents.

[0073] Optionally, the index building module 202 can be used to use the vectorization model 209 to vectorize the summaries in the summary vectorization queue 204 to generate a summary index for the document, and to vectorize the shard contents in the shard vectorization queue 205 to generate a shard index for the document.

[0074] In one embodiment, the index building module 202 may load the vectorization model 209 when there are documents for which summary indexes and / or shard indexes are to be built but the vectorization model 209 is not loaded, so as to use the functions of the vectorization model 209 to generate summary indexes and / or shard indexes for the documents; and may unload the vectorization model 209 to release model resources when there are no documents for which summary indexes and shard indexes are to be built but the vectorization model 209 is loaded.

[0075] In one embodiment, the electronic device can start the index building module 202 when there are documents for which summary indexes and / or shard indexes are to be built but the index building module 202 is not started; and can close the index building module 202 when there are no documents for which summary indexes are to be built and no documents for which shard indexes are to be built but the index building module 202 is started.

[0076] It is feasible that, since the time consumption of the summary generation module 201 to generate a summary is usually high, if the summary vectorization queue 204 is not empty and / or the summary generation module 201 is working, it may indicate that there are documents for which a summary index is to be constructed; if the summary vectorization queue 204 is empty and the summary generation module 201 is not working, it may indicate that there are no documents for which a summary index is to be constructed.

[0077] Feasibly, since the time spent on sharding by the document sharding module 203 is usually low, if the sharding vectorization queue 205 is not empty, it may indicate that there are documents for which sharding indexes are to be constructed; if the sharding vectorization queue 205 is empty, it may indicate that there are no documents for which sharding indexes are to be constructed.

[0078] Different from Figure 1 In the example shown, the summary index building module 102 and the shard index building module 104 can load / unload the vectorized model 106 on demand to build the summary index and the shard index respectively. Figure 2 In the illustrated embodiment, only the index construction module 202 loads / unloads the vectorized model 209 on demand, so that when any one of the summary index and the shard index is to be constructed, the model is always kept loaded, and the model is unloaded when neither the summary index nor the shard index needs to be constructed, so that the summary vectorization process and the shard content vectorization process can share the function of the model, thereby avoiding too frequent loading / unloading of the model, reducing unnecessary model loading / unloading operations, and thus reducing unnecessary waste of device resources.

[0079] like Figure 2As shown, both vectorization queues can be placed in the index building module instead of the summary generation module. In this way, the summary generation module can be started / closed as needed, and loaded / unloaded as needed, depending on whether there are documents to be summarized. This reduces unnecessary waste of device resources and does not affect the existing functions of the summary generation module (such as generating a summary of a document for display).

[0080] Since the time spent on summary generation is usually higher than the time spent on document segmentation, Figure 2 In the illustrated embodiment, the index building module 202 can prioritize the processing of the shard vectorization queue 205 when both the summary vectorization queue 204 and the shard vectorization queue 205 are not empty, which helps to complete the shard index construction of all documents as early as possible. In this way, when the user issues a search request, the electronic device can search based on the shard index of all documents to obtain the shard index search results.

[0081] Compared with the shard index search results obtained when searching based on the shard index of some documents, the shard index search results obtained when searching based on the shard index of all documents can be more accurate, which helps to improve the search effect.

[0082] Possibly, except Figure 2 The summary vectorized queue and the fragmented vectorized queue shown in the electronic device may also include vectorized queues of other types of indexes that need to use the vectorized model. The implementation logic of the vectorized queues of other types of indexes is the same as Figure 2 The implementation logic of the two vectorized queues shown is similar and will not be described in detail here.

[0083] In one embodiment of the present application, see Figure 3 The index building process of the electronic device may include the following steps 301 to 309. Figure 3 The illustrated embodiment reflects that in the process of constructing a summary index, the electronic device loads / unloads the summary generation model and the vectorization model on demand, and starts / shuts down the summary generation module and the index construction module on demand.

[0084] The electronic device includes a summary generation module and an index construction module, and the index construction module includes a summary vectorization queue and a fragment vectorization queue. Figure 2 Electronic equipment shown.

[0085] Step 301: Initiate a summary generation task.

[0086] Exemplarily, when there is a new document, the electronic device may initiate a summary generation task for the new document to generate a summary of the new document. The generated summary may be used for display and for building a summary index.

[0087] Step 302: Start a summary generation module.

[0088] By starting the summary generation module when initiating the summary generation task, the summary generation module can be started on demand.

[0089] In one example, after the electronic device initiates a summary generation task, it may execute an operation of starting a summary generation module.

[0090] In another example, after the electronic device initiates the summary generation task, it can determine whether the summary generation module has been started. If not, the summary generation module is started. If it has been started, no operation is performed to keep the summary generation module started.

[0091] For example, when a new document is stored in an electronic device, the summary generation module may not have completed generating a summary for the previously stored document. When the electronic device initiates a summary generation task based on the storage of the new document, the summary generation module has been started. The electronic device may perform no operation to maintain the startup of the summary generation module.

[0092] Step 303 , determining whether the summary generation model has been loaded, if so, executing step 304 , otherwise, loading the summary generation model and executing step 304 .

[0093] Preferably, the summary generation module may use the summary generation model to generate the summary of the document. Then, when the summary generation module is started, the summary generation model may be loaded to achieve on-demand loading of the summary generation model.

[0094] Step 304, determine whether the index building module has been started, if so, execute step 305, otherwise, start the index building module and load the vectorized model, and execute step 306.

[0095] Feasibly, the index construction module can vectorize the summary generated by the summary generation module to generate a summary index of the document. Then, the electronic device can start the index construction module and load the vectorization model when the summary generation module has been started, so as to realize on-demand starting of the index construction module and on-demand loading of the vectorization model.

[0096] Step 305 , determine whether the vectorized model has been loaded, if so, execute step 306 , otherwise load the vectorized model and execute step 306 .

[0097] It is feasible that the index construction module can use the vectorization model to construct a summary index of the document, and the electronic device can load the vectorization model when the index construction module is started to achieve on-demand loading of the vectorization model.

[0098] Step 306: fetch summaries from the summary task database to the summary vectorization queue, and construct a summary index.

[0099] Optionally, the summaries generated by the summary generation module can be stored in the summary task database, and the index construction module can add the summaries in the summary task database to the summary vectorization queue, and vectorize each summary in the summary vectorization queue separately to construct a summary index for the corresponding document until the summary vectorization queue is empty.

[0100] Step 307, determine whether the summary generation task is completed, if so, execute step 308, otherwise execute step 306.

[0101] If the summary generation module takes a long time to generate the summary, it is possible that the summary generation module has not yet completed the generation of the summary, but the summary vectorization queue is empty. Since the index construction module needs to vectorize the newly generated summary after the summary generation module completes the summary generation, after step 306, the electronic device can determine whether the summary generation task is completed. If it is completed, step 308 is executed to further determine whether the index construction module can be closed and the vectorization model can be unloaded. Otherwise, step 306 is executed to store the newly generated summary in the summary vectorization queue after the summary generation module completes the summary generation to continue to build the summary index. In this way, unnecessary repeated closing / starting of the index construction module and unloading / loading of the vectorization model can be avoided.

[0102] Step 308, determine whether the vectorization task is completed, if so, execute step 309, otherwise unload the summary generation model from the memory, close the summary generation module, and execute step 308 again.

[0103] It is feasible that the index building module can be used to build the summary index and the shard index. If the summary index is built and the shard index is also built (for example, the shard vectorization queue is empty), the vectorization task can be considered to be completed. If the vectorization task is not completed, the index building module is kept started and the vectorization model is loaded to continue building the shard index, while only the summary generation module is closed and the summary generation model is unloaded.

[0104] Step 309, unload the vectorization model and summary generation model from the memory, and close the index construction module and summary generation module.

[0105] If the vectorization task is completed, the electronic device can close the index construction module and the summary generation module, and uninstall the vectorization model and the summary generation model.

[0106] From the above, it can be seen that in the process of building a summary index, the electronic device can load / unload the summary generation model and the vectorization model on demand, and start / close the summary generation module and the index construction module on demand. This can reduce unnecessary model loading / unloading operations and module startup / shutdown operations, thereby reducing unnecessary waste of device resources.

[0107] In one embodiment of the present application, see Figure 4 The process of constructing a summary index by an electronic device may include the following steps 401 to 407.

[0108] Step 401, the AI ​​search system service (such as AISearchSysService) sends the document path and document status to the abstract plug-in (such as Abstract Plugin).

[0109] Exemplarily, when a new document is stored in an electronic device, the AI ​​search system service may send the document path and document status (for example, the new document is in a state where a summary index is to be constructed) of the new document to the summary plug-in.

[0110] Step 402 : The summary plug-in forwards the received document path and document status to a summary service (eg, AbstractService.exe).

[0111] In step 403, the summary service pre-processes the corresponding document according to the received document path and document status (such as parsing, cleaning, risk control, etc.), and sends the pre-processed document to the AI ​​plug-in engine (such as AIPluginEngine) to request the AI ​​plug-in engine to use the summary generation module and vectorization model.

[0112] Feasibly, the summary service may include the summary generation module and the index construction module described in other embodiments of the present application.

[0113] In step 404, the AI ​​plug-in engine generates a summary of the document using the summary generation model, generates a vectorized result of the summary using the vectorization model, and returns the summary of the document and the vectorized result of the summary to the summary service.

[0114] Step 405: The summary service saves the summary of the document and constructs a summary index of the document according to the vectorization result of the summary.

[0115] Optionally, a summary of the document may be displayed to meet the needs of users to view the summary content.

[0116] Optionally, a summary index of documents can be used to meet users' semantic search needs.

[0117] In one example, the vectorization result of the summary can be used as the summary index of the corresponding document. In other examples, the vectorization result of the summary can be processed and the processing result can be used as the summary index of the corresponding document.

[0118] In one embodiment, see Figure 5 , the processing of the summary service may include the following: According to the received document status, the received document path is stored in the document path queue; Store the document contents under each document path in the document path queue into the document content queue; Use the document parsing module to parse the contents of each document in the document content queue; Use the data cleaning module to perform data cleaning and risk control on the parsed document content; Use the summary generation module to send the cleaned document content to the AI ​​plug-in engine to request a summary of the document content, and send the summary returned by the AI ​​plug-in engine to the vectorization module; Use the vectorization module to send the summary of the document content to the AI ​​plug-in engine to request the vectorization result of the summary, and build and store the summary index of the corresponding document based on the vectorization result of the summary returned by the AI ​​plug-in engine.

[0119] Feasibly, the summary generation module described in other embodiments of the present application may include: Figure 5 The summary generation module shown in the figure, the index construction module described in other embodiments of the present application may include Figure 5 The vectorization module shown.

[0120] In one embodiment, see Figure 5 The AI ​​plug-in engine can use the deployment tool to load the summary generation model and use the summary generation model to generate a summary of the document content, and can use the deployment tool to load the vectorization model and use the vectorization model to generate a vectorized result of the summary.

[0121] Exemplarily, the deployment tool may be Openvino, which is an open source tool suite that can be used to optimize and accelerate the reasoning process of deep learning models.

[0122] Step 406: The summary service returns a success flag to the summary plug-in.

[0123] Optionally, the summary service may return flags indicating successful summary generation and successful summary index construction when the summary is successfully saved and the summary index is constructed.

[0124] Step 407: The summary plug-in returns a success flag to the AI ​​search system service.

[0125] If a summary index of a document has been constructed, when the user subsequently requests a search, the electronic device searches according to the summary index of the document to obtain a summary index search result of the document.

[0126] Exemplarily, the summary index search results of the document may be reflected in: whether the summary index search results include the document, and the ranking of the document in the summary index search results.

[0127] In one embodiment of the present application, see Figure 6 The index building process of the electronic device may include the following steps 310 to 313. Figure 6 The illustrated embodiment reflects that in the process of constructing a shard index, the electronic device loads / unloads the summary generation model and the vectorization model on demand, and starts / shuts down the index construction module on demand.

[0128] The electronic device includes a summary generation module and an index construction module, and the index construction module includes a summary vectorization queue and a fragment vectorization queue. Figure 2 Electronic equipment shown.

[0129] Step 310, initiate a sharding task.

[0130] Exemplarily, when there is a new document, the electronic device may initiate a slicing task for the new document to slice the new document. The generated slicing content may be used to construct a slicing index.

[0131] Step 311, determine whether the index construction module has been started, if so, execute step 312, otherwise start the index construction module and load the vectorized model, and then execute step 313.

[0132] It is feasible that the index construction module can segment the document and generate a segment index for the document based on the segment content. Then, when initiating a segmentation task, the electronic device can start the index construction module and load the vectorization model to realize on-demand startup of the index construction module and on-demand loading of the vectorization model.

[0133] Step 312, determine whether the vectorized model has been loaded, if so, execute step 313, otherwise load the vectorized model and execute step 313.

[0134] It is feasible that the index building module can use the vectorization model to build the segmented index of the document, and the electronic device can load the vectorization model when the index building module is started to realize on-demand loading of the vectorization model.

[0135] Step 313, fetch the shard content from the shard task database to the shard vectorization queue, and build a shard index.

[0136] It is feasible that the shard content of the document can be stored in the shard task database, then the index construction module can add the shard content in the shard task database to the shard vectorization queue, and vectorize each group of shard content in the shard vectorization queue to build the shard index of the corresponding document until the shard vectorization queue is empty.

[0137] The document segmentation module takes a low time to segment documents, so it can be considered that there is usually no situation where the document segmentation module has not completed document segmentation, but the segmentation vectorization queue is empty. In this case, if the segmentation vectorization queue is empty, it can indicate that there are no documents to be built for segmentation index.

[0138] In one embodiment, after the electronic device completes the construction of the shard index by executing step 313, it can execute the above step 308 to determine whether the vectorization task is completed based on whether there are documents for which the summary index is to be constructed, and according to the judgment result, close / maintain the startup index construction module and unload / maintain the loading of the vectorization model as needed.

[0139] From the above, it can be seen that electronic devices can load / unload vectorized models on demand and start / close summary generation modules and index construction modules on demand during the process of building shard indexes. This can reduce unnecessary model loading / unloading operations and module startup / shutdown operations, thereby reducing unnecessary waste of device resources.

[0140] In one embodiment of the present application, see Figure 7 The process of constructing a shard index by an electronic device may include the following steps 701 to 707.

[0141] Step 701, the AI ​​search system service (such as AISearchSysService) sends the document path and document status to the AI ​​document search plug-in (such as AIDocumentSearchPlugin).

[0142] Exemplarily, when a new document is stored in an electronic device, the AI ​​search system service may send the document path and document status (for example, the new document is in a state where a shard index is to be constructed) of the new document to the AI ​​document search plug-in.

[0143] Step 702 , the AI ​​document search plug-in forwards the received document path and document status to the AI ​​document search service (eg, AIDocumentSearch.exe).

[0144] In step 703, the AI ​​document search service segments and pre-processes (such as parsing, segmenting, cleaning, etc.) the corresponding document according to the received document path and document status, and sends the segmented content to the AI ​​plug-in engine (such as AIPluginEngine) to request the AI ​​plug-in engine to use the vectorized model.

[0145] Feasibly, the AI ​​document search service may include the document segmentation module and the index construction module described in other embodiments of the present application. Among them, the document segmentation module may be in the index construction module or outside the index construction module.

[0146] Step 704: The AI ​​plug-in engine generates vectorized results of the segmented content using the vectorized model, and returns the vectorized results of the segmented content to the AI ​​document search service.

[0147] Step 705: The AI ​​document search service constructs a shard index of the document based on the vectorization results of the shard content.

[0148] Optionally, sharded indexes of documents can be used to meet users' semantic search needs.

[0149] In one example, the vectorization result of the shard content can be used as the shard index of the corresponding document. In other examples, the vectorization result of the shard content can be processed and the processed result can be used as the shard index of the corresponding document.

[0150] In one embodiment, see Figure 8 , the processing of AI document search service may include the following: According to the received document status, the received document path is stored in the document path queue; Use the document parsing module to parse the document content under each document path in the document path queue; Use the document fragmentation module to fragment the parsed document content to obtain a group of fragmented content of the document content, and store the obtained group of fragmented content in a fragmented content queue; Use the index storage module to store the content of each group of fragments in the fragment content queue (for example Figure 8 Build the BM25 index of the corresponding document based on the shard content 1 and shard content 2 shown in the figure. Use the vectorization module to send each group of shard content in the shard content queue to the AI ​​plug-in engine to request the vectorization result of the shard content, and store the vectorization result of each group of shard content returned by the AI ​​plug-in engine in the vectorization result queue; Use the index storage module to store vectorized results according to the vectorized result queue (for example Figure 8 Vectorization 1 and Vectorization 2 shown in ), build and store the shard index of the corresponding document.

[0151] Optionally, the AI ​​document search service may also include a data cleaning module, which may be used to perform data cleaning on each group of shard contents in the shard content queue before the index storage module builds the BM25 index and the vectorization module sends each group of shard contents.

[0152] Feasibly, the index building module described in other embodiments of the present application may include: Figure 5 The document segmentation module, vectorization module and index storage module shown.

[0153] In one embodiment, see Figure 8 , the AI ​​plug-in engine can use the deployment tool to load the vectorized model and use the vectorized model to generate vectorized results for the sharded content.

[0154] Step 706: The AI ​​document search service returns a success flag to the AI ​​document search plug-in.

[0155] Optionally, the AI ​​document search service may return a flag indicating that the shard index is successfully built when the shard index is successfully built.

[0156] Step 707: The AI ​​document search plug-in returns a success flag to the AI ​​search system service.

[0157] If the segment index of the document has been constructed, when the user subsequently requests a search, the electronic device searches according to the segment index of the document to obtain the segment index search results of the document.

[0158] Exemplarily, the shard index search results of the document may be reflected in: whether the shard index search results include the document, and the ranking of the document in the shard index search results.

[0159] It is feasible that the electronic device can perform a non-semantic search when the user issues a search request to obtain non-semantic search results. For example, the non-semantic search results can include individual files whose file titles contain the search information, and the order of these files.

[0160] In addition to non-semantic search, the electronic device can also use various indexes that have been constructed to perform semantic search of files to obtain semantic search results. The semantic search results can include files that semantically match the user's search information and the order of these files. In addition, the order of the files can be related to the degree of semantic match between the files and the search information.

[0161] Since the time consumption of different index construction branches varies, for example, the time consumption of building a BM25 index is very low, the time consumption of building a shard index is relatively low, and the time consumption of building a summary index is relatively high, when a user requests to search for a file, it is possible that the electronic device has not yet built a summary index and / or shard index for some files.

[0162] In a feasible implementation, the search strategy can be dynamically matched according to the construction of various indexes to obtain one or more search results, and then the semantic search results can be obtained according to the obtained search results. For example, the obtained multiple search results can be weighted and fused to obtain the fused search results as semantic search results.

[0163] Exemplarily, a reciprocal rank fusion (RRF) process may be performed on each of the search results obtained to obtain a semantic search result.

[0164] For example, if the electronic device has built the BM25 index of all files but has not yet built the fragment index of some files and the summary index of some files when the user requests to search for files, the electronic device can search for files based on the BM25 index and obtain the BM25 index search results, that is, obtain one search result. Afterwards, the electronic device can generate and display the semantic search results based on the one search result.

[0165] Optionally, the BM25 index search results may include a ranking of some files matched based on the BM25 index.

[0166] For example, in the case of one-way search, the RRF score of the searched file is calculated using the following formula (1): wherein the size of the RRF score of the file can determine the ranking of the file in the file semantic search results.

[0167]

[0168] Where k is a constant, for example, it can be set to 60; D is a document collection, which contains the searched files; take the BM25 index search result as an example, It can represent the ranking of any document d in the document set D in the BM25 index search results.

[0169] For another example, if the user requests to search for files, the electronic device has built the BM25 index and the shard index for all files, but has not yet built the summary index for some files, then the electronic device can search for files based on the BM25 index and the shard index respectively, and obtain the BM25 index search results and the shard index search results, that is, obtain two search results. Afterwards, the electronic device can merge the two search results to generate and display the semantic search results.

[0170] Optionally, the shard index search results may include a ranking based on some of the files matched by the shard index.

[0171] Exemplarily, in the case of two-way search, the RRF score of the searched file is calculated using the following formula (2).

[0172]

[0173] Where k is a constant, for example, it can be set to 60; D is a document collection, which contains the searched files; take the two-way search results obtained as BM25 index search results and shard index search results as an example, It can represent the ranking of any document d in the document set D in the BM25 index search results. It can represent the ranking of document d in the shard index search results. and They are the weighting coefficients corresponding to the BM25 index and the shard index respectively, and their sum is 1.

[0174] For another example, if the user requests to search for a file, and the electronic device has already constructed the BM25 index, the fragment index, and the summary index of all files, the electronic device can perform file searches based on the BM25 index, the fragment index, and the summary index, respectively, and obtain the BM25 index search results, the fragment index search results, and the summary index search results, that is, obtain three-way search results. Afterwards, the three-way search results can be fused to generate and display semantic search results.

[0175] Optionally, the summary index search results may include a ranking of some documents matched based on the summary index.

[0176] Exemplarily, in the case of a three-way search, the RRF score of the searched file is calculated using the following formula (3).

[0177]

[0178] Where k is a constant, for example, it can be set to 60; D is a document collection, which contains the searched files; take the three-way search results obtained as BM25 index search results, shard index search results and summary index search results as an example, It can represent the ranking of any document d in the document set D in the BM25 index search results. It can represent the ranking of document d in the shard index search results. It can represent the ranking of document d in the summary index search results. and They are the weighting coefficients corresponding to the BM25 index, shard index, and summary index, and their sum is 1.

[0179] The shard index and summary index are file indexes obtained based on vectorization processing, so the electronic device can vectorize the user's search information, and use the shard index and summary index to search for files based on the vectorization results of the search information. For example, the vectorization results of the search information can be matched in the shard index database to obtain the shard index search results, and the vectorization results of the search information can be matched in the summary index database to obtain the summary index search results.

[0180] Different types of index information can reflect the matching between files and user search information at different corresponding angles. The more search results there are, the better the semantic search results of the files are. Since the time consumption of different index construction branches varies, the above dynamic matching search strategy cannot achieve full-path search (i.e., cannot obtain search results of various indexes) before all types of indexes of all files are built, which is not conducive to improving search results.

[0181] In order to improve the file semantic search effect before all kinds of indexes of all files are built, in one embodiment of the present application, regardless of whether all kinds of indexes of various files are built, the electronic device always uses the search strategy of full-path search to perform file search, obtains search results of various indexes (that is, obtains full-path search results), and when fusing the full-path search results, dynamically matches the fusion strategy according to the current index construction status of each file, so as to perform targeted full-path search result fusion processing on each file, to obtain the fused search results of each file, and then obtain the semantic search results.

[0182] Taking the case where the various types of indexes of a file are BM25 index, shard index and summary index respectively, in one example, when the BM25 index and shard index of each file have been constructed, and the summary index of some documents (excluding document 4) has been constructed, the electronic device can perform file search in the database corresponding to each type of index according to the currently constructed various types of indexes, and obtain the full-path search results (i.e., three-path search results) as shown in the following Table 1, and then use the above formula (3) to fuse the three-path search results to obtain the semantic search results.

[0183] Table 1

[0184] Taking the above Table 1 as an example, when calculating the RRF score of the searched file, the document set D contains each searched document (ie, documents 1 to 4), so the RRF scores of documents 1 to 4 can be calculated separately.

[0185] For Document 1 to Document 3, since the electronic device has constructed various indexes of Document 1 to Document 3, the electronic device can use the above formula (3) to calculate the RRF scores of Document 1 to Document 3 respectively.

[0186] In the case where the BM25 index and shard index of all files have been constructed but the summary index of some documents has not been constructed, unlike the implementation method of performing two-way search and correspondingly using formula (2) to fuse the full-way search results of documents 1 to 3, the embodiment of the present application can perform full-way search and dynamically use formula (3) to fuse the full-way search results of documents 1 to 3 according to the current index construction status of documents 1 to 3, that is, introduce the summary index search results of documents 1 to 3 to calculate the RRF scores of documents 1 to 3, which helps to improve the accuracy of the RRF score and make the document semantic search results more in line with the actual needs of users.

[0187] As for document 4, since the electronic device has constructed the BM25 index and the shard index of document 4 but has not constructed the summary index of document 4, the electronic device can use the above formula (2) to calculate the RRF score of document 4.

[0188] By dynamically using formula (2) instead of formula (3) according to the current index construction status of document 4, the full-path search results of document 4 are fused. This can reduce the impact of the failure to construct a summary index for document 4 on the RRF score of document 4. This helps to improve the accuracy of the RRF score and make the document semantic search results more in line with the actual needs of users.

[0189] In one embodiment, the electronic device can dynamically adjust the fusion weights of various types of indexes according to the current index construction status of each file. For search results of any type of index, when the electronic device has constructed the type of index, the fusion weight corresponding to the type of index can be relatively higher, and when the electronic device has not constructed the type of index, the fusion weight corresponding to the type of index can be relatively lower, so as to reduce the adverse effect of the partial loss of the type of index on the fusion result.

[0190] Exemplarily, assuming that a summary index of document 4 has been constructed, the summary index search results may include document 4, document 2, and document 1 in descending order of ranking. Referring to Table 1 above, since a summary index of document 4 has not yet been constructed, the electronic device cannot search for document 4 when searching based on the currently constructed summary indexes. As shown in Table 1, the summary index search results obtained after the search do not include document 4, but specifically include document 2 and document 1 in descending order of ranking.

[0191] It can be seen that the partial loss of the summary index may affect the accuracy of the summary index search results, which can reduce the fusion weight corresponding to the summary index.

[0192] Referring to the above formula (3), assuming that the fusion weight corresponding to the summary index (i.e. the above weight coefficient ) has a default value of x1. When various indexes for each file have been constructed, the weight coefficient The value of can be x1. When the summary index of some files is not built, the weight coefficient The value of can be x2, and x2<x1.

[0193] In one embodiment of the present application, see Fig. 9 Taking the searched file as a document as an example, the process of the electronic device performing a document search may include the following steps 901 to 911.

[0194] Step 901: receiving a user's search request.

[0195] Step 902: Search according to the various indexes that have been constructed to obtain the full-path search results.

[0196] See also Fig. 9 The full-path search result may be a three-path search result, and the three-path search result may specifically be a BM25 index search result, a shard index search result, and a summary index search result.

[0197] Feasibly, for the specific technical implementation of the electronic device performing a full-path search according to the search request, reference may be made to the relevant descriptions in other embodiments of the present application, which will not be elaborated here.

[0198] Step 903, i=1.

[0199] In practice, i can represent the number of cycles for calculating the RRF score for the searched documents, and the maximum value of i can be the number of searched documents len(D), where D is the set of searched documents. In this way, after the electronic device performs a full-path search based on the user's search information, i can be set to 1 to start the first RRF score calculation.

[0200] Exemplarily, referring to the above Table 1, set D may include document 1 to document 4.

[0201] Step 904, determine whether i<len(D) holds, if so, execute step 905, otherwise, execute step 910.

[0202] If i < len(D), it means that the RRF scores of all searched documents have not been calculated, so the RRF score calculation of the current cycle can be continued. Otherwise, it means that the RRF scores of all searched documents have been calculated, so the documents can be re-ranked according to their RRF scores to obtain the fused search results.

[0203] Step 905, d=D(i).

[0204] When i<len(D), the electronic device may start calculating the RRF score of the i-th document d in the set D.

[0205] Step 906, determine whether the shard index of document d has been constructed, if so, execute step 907, otherwise calculate the RRF score of the search path of document d and execute step 909.

[0206] The time it takes for an electronic device to build a BM25 index is usually very low, the time it takes to build a shard index is usually lower, and the time it takes to build a summary index is usually higher. Therefore, when a user requests to search for files, the BM25 indexes of all files have usually been built, but there may be situations where the electronic device has not yet built summary indexes and / or shard indexes for some files.

[0207] In this way, it can be determined whether the shard index of document d has been constructed. If not, it can mean that only the BM25 index of document d has been constructed. Then, the RRF score of the one-way search of document d can be calculated based on the BM25 index search results of document d. For example, the above formula (1) can be used to calculate the RRF score of the one-way search of document d.

[0208] Step 907 , determine whether the summary index of document d has been constructed, if so, execute step 908 , otherwise calculate the RRF score of the two-way search of document d and execute step 909 .

[0209] Step 908, calculate the RRF score of the three-way search of document d.

[0210] If the shard index of document d has been constructed, it is possible to continue to determine whether the summary index of document d has been constructed, and calculate the RRF score of the two-way search or the RRF score of the three-way search of document d according to the determination result. For example, the RRF score of the two-way search of document d can be calculated using the above formula (2), and the RRF score of the three-way search of document d can be calculated using the above formula (3).

[0211] For example, referring to the above Table 1, since various indexes of Document 1 to Document 3 have been constructed, the above formula (3) is used to calculate the RRF scores of Document 1 to Document 3, regardless of whether the search results of various indexes include Document 1 to Document 3.

[0212] For example, although neither the shard index search results nor the summary index search results include document 3, the above formula (3) is still used to calculate the RRF score of the three-way search for document 3. Feasibly, since document 3 is not in the shard index search results nor the summary index search results, it can be said that the ranking of document 3 in both the shard index search results and the summary index search results is infinite. When the above formula (3) is used to calculate the RRF score of document 3, the last two terms in formula (3) can be approximated to zero.

[0213] For example, referring to the above Table 1, since the summary index of document 4 is not constructed, when calculating the RRF score of document 4, the above formula (2) is used for calculation.

[0214] Step 909, i=i+1, and execute step 904.

[0215] After calculating the RRF score of the i-th document in document D, the electronic device can add 1 to the value of i to recalculate the RRF score of the i+1-th document in document D, and repeat this cycle until the RRF score calculation is completed for each searched document.

[0216] Step 910: sort all documents in set D according to their RRF scores to obtain a sorting result.

[0217] Step 911: Output the ranking result. The ranking result can be displayed as a semantic search result of the user's search information.

[0218] Fig. 9 In the illustrated embodiment, before all types of indexes for all documents are constructed, the electronic device may use a full-path search strategy to implement document search to fully utilize the various index information that has been constructed, and when fusing the full-path search results, perform targeted full-path search result fusion processing on each file based on the current index construction status of each file, thereby improving the fusion effect.

[0219] In one embodiment of the present application, see Fig.10 The file search process of the electronic device may include the following steps 1001 to 1007.

[0220] Step 1001, the AI ​​search main service (such as AISearchMainService) sends user search information to the AI ​​document search plug-in.

[0221] Exemplarily, when a user issues a search request, the AI ​​search main service can extract the user search information and send it to the AI ​​document search plug-in.

[0222] Step 1002: The AI ​​document search plug-in forwards the received document path and document status to the AI ​​document search service.

[0223] Step 1003, the AI ​​document search service sends the user search information to the AI ​​plug-in engine to request the use of the vectorized model.

[0224] Step 1004: The AI ​​plug-in engine generates vectorized results of the user's search information using the vectorized model, and returns the vectorized results of the user's search information to the AI ​​document search service.

[0225] Step 1005, the AI ​​document search service performs document search and merges the search results based on the vectorized results of the user's search information.

[0226] In one embodiment, see Fig.11 , the processing of AI document search service may include the following: Use the user search information acquisition module to obtain the user's search information; Use the vectorization module to send the user search information to the AI ​​plug-in engine to request the vectorization result of the user search information, and receive the vectorization result of the user search information returned by the AI ​​plug-in engine; Use the index storage module to perform document search based on the constructed BM25 index and user search information to obtain BM25 index search results, perform document search based on the constructed shard index and the vectorized results of the user search information to obtain shard index search results, and perform document search based on the constructed summary index and the vectorized results of the user search information to obtain summary index search results, that is, obtain three-way search results; Use the search result fusion module to fuse the three search results.

[0227] For the specific technical implementation of fusing the three-way search results, please refer to Fig. 9 The relevant descriptions in the illustrated embodiments are not repeated here.

[0228] In one embodiment, see Fig.11 , the AI ​​plug-in engine can use the deployment tool, load the vectorized model, and use the vectorized model to generate vectorized results for user search information.

[0229] Step 1006: The AI ​​document search service returns the fused search results to the AI ​​document search plug-in.

[0230] Step 1007: The AI ​​document search plug-in returns the fused search results to the AI ​​search main service. The fused search results can be displayed as semantic search results for the user's search information.

[0231] Preferably, the user can input search keywords or sentences to issue a search request. The electronic device can extract the user search information based on the user input information, and perform a semantic search based on the user search information and various constructed indexes to obtain full-path search results, and then integrate the full-path search results to obtain semantic search results for responding to the user search request.

[0232] In addition, the electronic device may also perform a non-semantic search based on the user's search information, thereby obtaining and displaying non-semantic search results for responding to the user's search request.

[0233] In an example, Fig.12 As shown, the electronic device can display a search page 1201 for the user to input search information and display search results. Fig.12 The user can enter the search keyword "deep learning" as the search information. The electronic device can display the name, type, path, modification date, size and other file information of each searched file through non-semantic search and semantic search respectively, so that the user can view the search results.

[0234] In another example, Fig.13 As shown, the electronic device can display a search page 1301 for the user to input search information and display search results. Fig.13 The user can enter the search keyword "last semester's paper" as search information, and the electronic device can display the names of the corresponding searched files through non-semantic search and semantic search respectively, so that the user can view the search results.

[0235] Possibly, see Fig.12 For each file whose file name contains the keyword "deep learning", the electronic device can also highlight the word "deep learning" in the file name. Fig.13 For each file whose file name contains the keyword "last semester paper", the electronic device can also highlight the word "last semester paper" in the file name.

[0236] See also Fig.12 In one embodiment, the user can click the search application icon 1202 in the taskbar to trigger the electronic device to display the search page. In another embodiment, the user can trigger the electronic device to display the search page through the application icon 1203 of the smart assistant displayed on the desktop. For example, if the user triggers the application icon 1203 of the smart assistant with the mouse, the smart assistant can display the smart search entrance through a pop-up window, so that the user can enter the search page through the smart search entrance.

[0237] Preferably, the electronic device may construct index information of various files (such as documents, pictures, applications, etc.), so that various files matching the user's search information may be searched based on the constructed index information.

[0238] See also Fig.12 In one embodiment, identification items of various files may be displayed in the search page 1201. If the user clicks on the identification item of any file, the electronic device may display the search result corresponding to the file.

[0239] In an example, Fig.12 As shown, if the user clicks on the document identification item 1204, the electronic device can display the searched documents that match the user's search information. In other examples, the electronic device can display the search results of documents by default.

[0240] In one embodiment, the electronic device can support the user to view the search results, and can also support the user to view the file content of the searched file. Feasibly, for any file in the search results displayed by the electronic device, if the user clicks on the file, the electronic device can display the file content of the file for the user to view.

[0241] like Fig.13 As shown, if the user clicks on the document 1301 whose document name is "The Development of Microeconomics", the electronic device can display the document content of the document 1301 in the search page so that the user can preview the document content.

[0242] It is feasible that the electronic device may not display the summary of the document by default when displaying the document content. In this case, if the user clicks the summary preview icon 1302 and the summary of the document 1301 has been constructed, the electronic device may display the summary content of the document 1301, and the corresponding display page may be as follows: Fig.13 shown.

[0243] See also Fig.14 An embodiment of the present application provides an index building method, which is applied to an electronic device, and the electronic device includes a first module and a second module; the first module is used to generate first information of a first file, and the first file is any file that needs to be indexed; the index building method may include the following steps 1401~1403.

[0244] Exemplarily, the first file may be a document, a picture, a video, a web page, etc.

[0245] In one embodiment, the first file may be a file in an electronic device. In other embodiments, the first file may be a file in other devices.

[0246] Step 1401: If at least one of a first type index and a second type index of a first file is to be constructed and the first model is not loaded, then the first model is loaded.

[0247] Exemplarily, if a new file is stored in the electronic device, the new file is a file for which an index needs to be constructed.

[0248] In one embodiment, the electronic device may include the first model. In other embodiments, the first model may be in other devices.

[0249] In one embodiment of the present application, the file type of the first file includes a document; the first information includes a summary of the document; and the first model includes a vectorized model. This supports the electronic device to respond to the user's file search request based on the summary of the document, which can improve the semantic search effect.

[0250] Thus, in one possible implementation, see Figure 2 , the first type of index may be a summary index, the second type of index may include a shard index, the first model may be a vectorized model, and the first module may be Figure 2 The summary generation module 201 shown in FIG. 201 , the second module may be Figure 2 The index building module 202 shown in .

[0251] In other embodiments, the first model may include other models, such as a text extraction model. For files such as pictures, videos, PPT documents, etc. containing text content, the first module may use the text extraction model to extract the text content in the file. The extracted text content may be used for display or for vectorization to construct an index for the file.

[0252] Step 1402, executing at least one of the first operation and the second operation by running the second module; The first operation includes: if a first type index of a first file is to be constructed, generating the first type index of the first file according to first information of the first file and a first model; The second operation includes: if a second type index of the first file is to be constructed, generating the second type index of the first file according to the first file and the first model.

[0253] Fig.14 In the illustrated embodiment, the second module uses the first model to construct different types of indexes respectively, thereby achieving reuse of the first model by the same module, thereby improving model utilization.

[0254] Step 1403: If there is no file to be indexed into the first type, no file to be indexed into the second type, and the first model has been loaded, then the first model is unloaded.

[0255] The electronic device may uninstall the first model by uninstalling the first model from the memory to end the loading of the first model, that is, not to load the first model. If there is a file to be constructed with the first type index and / or the second type index again, the electronic device may load the first model again.

[0256] Fig.14 In the illustrated embodiment, the electronic device loads / unloads the first model on demand in combination with the construction requirements of various types of indexes, so that the model is always kept loaded when any type of index is to be constructed, and the model is unloaded when all types of indexes do not need to be constructed. This can avoid excessively frequent loading / unloading of models, reduce unnecessary model loading / unloading operations, and thus reduce unnecessary waste of device resources.

[0257] In addition to loading / unloading the first model on demand, the second module may also be started / closed on demand. In one embodiment of the present application, the index building method may further include: if at least one of the first type index and the second type index of the first file is to be built, and the second module is not started, then starting the second module; if there is no file to be built with the first type index, no file to be built with the second type index, and the second module is already started, then closing the second module.

[0258] By starting / shutting down the second module as needed, unnecessary module start / shutdown operations can be reduced, thereby reducing unnecessary waste of device resources.

[0259] In addition to starting / closing the second module as needed, the first module may also be started / closed as needed. In one embodiment of the present application, the index building method may further include: if a first type index of a first file is to be built and the first module is not started, starting the first module; if there is no file to be built with the first type index and the first module is already started, closing the first module.

[0260] By starting / shutting down the first module as needed, unnecessary module start / shutdown operations can be reduced, thereby reducing unnecessary waste of device resources.

[0261] In one embodiment of the present application, the second module includes a first queue and a second queue; the first queue is used to temporarily store the first information of the first file; the second queue is used to temporarily store the first file or the second information of the first file, and the second information is used to generate a second type index of the first file. Based on this, the absence of a file to be constructed with the first type index includes: the first queue is empty; the absence of a file to be constructed with the second type index includes: the second queue is empty.

[0262] Feasibly, if the first queue is not empty, it may indicate that a first type index of the corresponding file is to be constructed, and if the second queue is not empty, it may indicate that a second type index of the corresponding file is to be constructed.

[0263] In one example, the first file may be a document, that is, the full text of the document, and the electronic device may vectorize the full text of the document to generate a full-text index of the document.

[0264] In another example, the first file may be a document, and the electronic device may segment the document and vectorize the segment contents of the document to generate a segment index of the document.

[0265] In another example, the second information of the first file may be the fragmented content of the document, and the electronic device may vectorize the fragmented content of the document to generate a fragmented index of the document. In this way, the electronic device may include a document fragmentation module, which is used to fragment the document, and the generated fragmented content may be stored in the second queue. Figure 2 As shown, the first queue may be a summary vectorized queue 204 , and the second queue may be a slice vectorized queue 205 .

[0266] Based on the queue situation, it is possible to accurately determine whether there are files to be indexed, which helps to accurately enable / disable modules and load / unload models on demand.

[0267] In one embodiment of the present application, generating the first information of the first file includes: generating the first information of the first file according to the second model; the index construction method also includes: if the first information of the first file is to be generated and the second model is not loaded, loading the second model; if the file to generate the first information does not exist and the second model is already loaded, unloading the second model.

[0268] See also Figure 2 The second model may be a summary generation module 208, and may specifically be a large language model.

[0269] In one embodiment, the electronic device may include the second model. In other embodiments, the second model may be in other devices.

[0270] The electronic device can load / unload the second model on demand based on the generation requirements for the first information, thereby avoiding too frequent loading / unloading of models, reducing unnecessary model loading / unloading operations, and thus reducing unnecessary waste of device resources.

[0271] In one embodiment of the present application, generating first information of a first file includes: generating the first information of the first file according to a second model; and the processing priority of the first operation is lower than that of the second operation.

[0272] Since the first module uses the second model to generate the first information, it usually takes a long time to construct the first type of index. Therefore, the second operation can be performed first to construct the second type of index first.

[0273] For example, see Figure 2 , the first operation can be used to build a summary index, and the second operation can be used to build a shard index. Compared with the summary vectorization queue, the index construction module can prioritize the shard vectorization queue to prioritize the construction of the shard index, which helps to complete the shard index construction of all files as early as possible.

[0274] Compared with the shard index search results obtained when searching based on the shard index of some documents, the shard index search results obtained when searching based on the shard index of all documents can be more accurate, which helps to improve the search effect.

[0275] In addition, since it usually takes a long time for the first module to generate the first information using the second model, there may be a situation where the first module has not yet completed the information generation, but the first queue is empty. Since after the first module generates the first information, the electronic device needs to generate a first type index based on it, in a feasible implementation, the above situation where there is no file to be constructed with the first type index may also include: the first module is in a working state.

[0276] In this way, if the first queue is empty and the first module is not working, it may mean that there is no file to be constructed of the first type index. If the second queue is empty and there is no file to be constructed of the second type index, the first model can be unloaded, thus avoiding unnecessary loading / unloading of the first model.

[0277] In one embodiment of the present application, the index construction method may also include: obtaining search information; obtaining search results corresponding to each type of index in each type of index based on the search information and various types of indexes already constructed by the electronic device to obtain multiple search results; and generating search results for the search information based on the multiple search results.

[0278] For example, see the document Fig.11 The various types of indexes that have been constructed may include BM25 indexes, shard indexes, and summary indexes, and the multiple search results may correspond to BM25 index search results, shard index search results, and summary index search results.

[0279] Regardless of whether all kinds of indexes for all files have been constructed, before all kinds of indexes for all files have been constructed, the electronic device always uses a full-path search strategy to implement file search, which can make full use of the constructed index information, thereby helping to improve the search effect.

[0280] In one embodiment of the present application, search results for search information are generated based on multiple search results, including: performing weighted fusion processing based on a first result of a target file in one or more target search results to obtain a second result of the target file; wherein the target file is any file in the multiple search results; wherein the multiple search results include one or more target search results, the electronic device has constructed an index of the type of the target file corresponding to the target search result, and the sum of the weights corresponding to the one or more target search results is one; and generating search results for the search information based on the second result of the target file.

[0281] Optionally, the first result may be a ranking, and the second result may be an RRF score.

[0282] Referring to the above Table 1, the above multiple search results are 3 search results, and the target file can be any file in the 3 search results, that is, it can be any one of Document 1 to Document 4.

[0283] If the target file is any one of Document 1 to Document 3, since the electronic device has built three indexes for Document 1 to Document 3, there are three target search results for Document 1 to Document 3. In this way, the above formula (3) can be used to calculate the RRF scores of Document 1 to Document 3 respectively. In formula (2), the sum of the weights corresponding to the three target search results is 1, that is, .

[0284] If the target file is document 4, since the electronic device has built the BM25 index and shard index of document 4, but has not built the summary index of document 4, there are two target search results for document 4 (i.e., the BM25 index search result and the shard index search result). In this way, the above formula (2) can be used to calculate the RRF score of document 4. In formula (2), the sum of the weights corresponding to the two target search results is 1, i.e. .

[0285] By performing targeted fusion processing of the full-path search results on each file according to the current index construction status of each file when fusion of the full-path search results, the fusion effect can be improved.

[0286] The method provided in any embodiment of the present application can be applicable to electronic devices such as mobile phones, tablet computers, personal digital assistants (PDA), desktops, laptops, notebook computers, ultra-mobile personal computers (UMPC), handheld computers, netbooks and wearable devices. The present application does not impose any special restrictions on the specific forms of the above-mentioned electronic devices.

[0287] The index construction method provided in any embodiment of the present application can be applied to Fig.15 In the electronic device 100 shown. Fig.15 A schematic structural diagram of an electronic device 100 is shown.

[0288] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.

[0289] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0290] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated into one or more processors. The controller may generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions.

[0291] In some embodiments, the processor 110 may be a system on chip (SOC), which may include a central processing unit (CPU) and may further include other types of processors. In some embodiments, the processor 110 may be a PWM control chip.

[0292] The processor 110 may also include necessary hardware accelerators or logic processing hardware circuits, such as ASICs, or one or more integrated circuits for controlling the execution of the technical solution program, etc. In addition, the processor 110 may have the function of operating one or more software programs, which may be stored in a storage medium.

[0293] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0294] In some embodiments, the memory of the electronic device 100 may be a read-only memory (ROM), other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), or any computer-readable medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer.

[0295] In some embodiments, the processor 110 and the memory may be combined into a processing device, or may be independent components, and the processor 110 may be used to execute program codes stored in the memory. In specific implementation, the memory may also be integrated into the processor 110, or may be independent of the processor 110.

[0296] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0297] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0298] The internal memory 121 can be used to store computer executable program codes, which include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121, and / or instructions stored in a memory provided in the processor.

[0299] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0300] A touch sensor is also called a "touch control device". The touch sensor can be arranged on the display screen 194. The touch sensor and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor can also be arranged on the surface of the electronic device 100, which is different from the position of the display screen 194.

[0301] In addition, on top of the above components, the electronic device runs an operating system. For example, iOS ® Operating system, Android ® Operating system, Windows ® Operating system, etc. Application programs can be installed and run on the operating system.

[0302] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the layered architecture as an example to exemplify the software structure of the electronic device 100.

[0303] Fig.16 1 is a software structure diagram of the electronic device 100 of the embodiment of the present application. The layered architecture can divide the software into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the operating system of the electronic device is divided into multiple layers, from top to bottom, namely, the application layer, the application framework layer (Framework, FWK), the local service layer (Native), the hardware abstraction layer (HAL) and the kernel layer (Kernel).

[0304] The application layer may include a series of application packages. Taking the electronic device 100 as a PC (personal computer) as an example, the application layer of the PC may include Fig.16 In this way, the user can use the PC search application to issue a file search request, and can use the PC document application to store documents, view stored documents, etc.

[0305] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions. The application framework layer may include a view system, a notification manager, a resource manager, a window manager, a content provider, etc.

[0306] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.

[0307] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, the terminal device vibrates, the indicator light flashes, etc.

[0308] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.

[0309] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.

[0310] Content providers are used to store and retrieve data and make the data accessible to applications. Taking a smartphone as an example, the data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0311] See also Fig.16 ,The local service layer can further include a service layer, a model layer, and an inference deployment layer.

[0312] The service layer may include AI middle-office services, and the AI ​​middle-office services may include search services that support PC search applications and document services that support PC document applications.

[0313] The model layer may include a large language model, which can be used to generate a summary of a document. The generated document summary can be used for display or to build a summary index of the document.

[0314] Preferably, the electronic device can display the summary of the document through the PC document application to meet the user's need to view the document summary.

[0315] It is feasible that the electronic device can perform file search based on the constructed summary index through the search service, obtain summary index search results, and then fuse the summary index search results with the search results of other types of indexes to obtain the search results of the user's search information. Afterwards, the electronic device can display the search results of the user's search information through the PC search application to meet the user's file search needs.

[0316] The inference deployment layer may include a large model deployment acceleration service (such as Openvino), which can be used to accelerate and optimize large speech models, etc.

[0317] The hardware abstraction layer acts as a bridge between software and hardware. It encapsulates the underlying hardware driver and provides a general interface for calling the driver to the application framework layer.

[0318] The kernel layer is the layer between hardware and software. The kernel layer contains at least camera driver, display driver, Bluetooth driver, audio driver and sensor driver.

[0319] Understandably, Fig.16 The layers in the software structure shown and the components included in each layer do not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer layers than shown, and each layer may include more or fewer components, which is not limited in the present application.

[0320] An embodiment of the present application also provides an index building device, which is applied to an electronic device, and the electronic device includes a first module and a second module; the first module is used to generate first information of a first file, and the first file is any file that needs to be indexed; the device includes: a first processing module, which is used to load the first model if at least one of the first type index and the second type index of the first file is to be built and the first model is not loaded; a second processing module, which is used to perform at least one of the first operation and the second operation by running the second module; the first operation includes: if the first type index of the first file is to be built, the first type index of the first file is generated according to the first information and the first model; the second operation includes: if the second type index of the first file is to be built, the second type index of the first file is generated according to the first file and the first model; a third processing module, which is used to unload the first model if there are no files to be indexed with the first type and the second type, and the first model has been loaded.

[0321] An embodiment of the present application also provides a chip, which is installed in an electronic device. The chip includes: a processor, which is used to execute computer program instructions stored in a memory, wherein when the computer program instructions are executed by the processor, the chip is triggered to execute the method steps provided by any method embodiment of the present application.

[0322] An embodiment of the present application also proposes a terminal device, which includes a communication module, a memory for storing computer program instructions, and a processor for executing program instructions, wherein when the computer program instructions are executed by the processor, the terminal device is triggered to execute the method steps provided by any method embodiment of the present application.

[0323] An embodiment of the present application also proposes a server device, which includes a communication module, a memory for storing computer program instructions, and a processor for executing program instructions, wherein when the computer program instructions are executed by the processor, the server device is triggered to execute the method steps provided by any method embodiment of the present application.

[0324] An embodiment of the present application also provides an electronic device, which includes multiple antennas, a memory for storing computer program instructions, a processor for executing computer program instructions, and a communication device (such as a communication module that can implement 5G communication based on the NR protocol), wherein when the computer program instructions are executed by the processor, the electronic device is triggered to execute the method steps provided by any method embodiment of the present application.

[0325] Specifically, in an embodiment of the present application, one or more computer programs are stored in the above-mentioned memory, and the one or more computer programs include instructions. When the instructions are executed by the above-mentioned device, the above-mentioned device executes the method steps described in the embodiment of the present application.

[0326] Furthermore, the devices, apparatuses, and modules described in the embodiments of the present application may be implemented by computer chips or entities, or by products having certain functions.

[0327] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code.

[0328] In the several embodiments provided in the present application, if any function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application.

[0329] Specifically, a computer-readable storage medium is also provided in an embodiment of the present application. The computer-readable storage medium stores a computer program, which, when executed on a computer, enables the computer to execute the method steps provided in the embodiment of the present application.

[0330] The embodiment of the present application also provides a computer program product, which includes a computer program. When the computer program is run on a computer, it enables the computer to execute the method steps provided by the embodiment of the present application.

[0331] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0332] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0333] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0334] The integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory, random access memory, disk or optical disk and other media that can store program code.

[0335] In the embodiments of the present application, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other identical elements in the process, method, commodity or device including the element.

[0336] The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0337] Those skilled in the art will appreciate that the various units and algorithm steps described in the embodiments of the present application can be implemented by a combination of electronic hardware, computer software, and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0338] Those skilled in the art can clearly understand that for the convenience and simplicity of description, the same or similar parts between the various embodiments in this application can be referred to each other. For example, the specific working process of the system, device and unit described in the embodiments of this application can refer to the corresponding process in the method embodiment of this application, and will not be repeated here.

[0339] The above description is only a specific embodiment of the present application and is not intended to limit the present application. The protection scope of the present application shall be based on the claims.

Claims

1. An index construction method, characterized in that: Applied to an electronic device, the electronic device comprises a first module and a second module; The first module is used to generate first information of a first file, where the first file is any file for which an index needs to be constructed; The method comprises: If at least one of the first type index and the second type index of the first file is to be constructed and the first model is not loaded, loading the first model; By running the second module, at least one of the first operation and the second operation is performed; The first operation includes: if the first type index of the first file is to be constructed, generating the first type index of the first file according to the first information of the first file and the first model; The second operation includes: if the second type index of the first file is to be constructed, generating the second type index of the first file according to the first file and the first model; If there is no file to construct the first type index, there is no file to construct the second type index, and the first model has been loaded, then the first model is unloaded.

2. The method according to claim 1, characterized in that The method further comprises: If at least one of the first type index and the second type index of the first file is to be constructed and the second module is not started, starting the second module; If there is no file to be constructed for the first type index, there is no file to be constructed for the second type index, and the second module has been started, then the second module is closed.

3. The method according to claim 1, characterized in that The method further comprises: If the first type index of the first file is to be constructed and the first module is not started, starting the first module; If there is no file for constructing the first type of index and the first module has been started, the first module is closed.

4. The method according to claim 1, characterized in that: The second module includes a first queue and a second queue; The first queue is used to temporarily store the first information of the first file; The second queue is used to temporarily store the first file or second information of the first file, and the second information is used to generate the second type index of the first file; The absence of the file to be constructed with the first type of index comprises: the first queue is empty; The absence of the file to be constructed as the second type of index includes: the second queue is empty.

5. The method according to claim 1, characterized in that The generating the first information of the first file includes: generating the first information of the first file according to the second model; The method further comprises: If the first information of the first file is to be generated and the second model is not loaded, loading the second model; If the file for generating the first information does not exist and the second model has been loaded, the second model is unloaded.

6. The method according to claim 1, characterized in that The first information for generating the first file includes: Generate first information of the first file according to the second model; The first operation has a lower processing priority than the second operation.

7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: Get search information; According to the search information and various indexes constructed by the electronic device, the search results corresponding to each type of index in the various indexes are obtained to obtain multiple search results; A search result of the search information is generated according to the multiple search results.

8. The method according to claim 7, characterized in that Generating search results of the search information according to the multiple search results includes: Performing weighted fusion processing according to the first result of the target file in one or more target search results to obtain a second result of the target file; Wherein, the target file is any file in the multiple search results; The multiple search results include the one or more target search results, the electronic device has constructed an index of the target file of a type corresponding to the target search result, and the sum of the weights respectively corresponding to the one or more target search results is one; A search result of the search information is generated according to the second result of the target file.

9. A chip, characterized in that: include: A processor, configured to execute computer program instructions stored in a memory, wherein when the computer program instructions are executed by the processor, the chip is triggered to execute the method as claimed in any one of claims 1 to 8.

10. An electronic device, characterized in that: The electronic device comprises one or more memories for storing computer program instructions, and one or more processors, wherein when the computer program instructions are executed by the one or more processors, the electronic device is triggered to execute the method as described in any one of claims 1-8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed on a computer, the computer is enabled to execute the method according to any one of claims 1 to 8.

12. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is run on a computer, the computer is caused to perform the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Method for scheduling massive three-dimensional data on basis of geographic information

    CN105718480A

  • Method and device for managing search engine index in multi-tenant system and electronic equipment

    CN113378026A

  • Index construction method and device, electronic equipment and storage medium

    CN113821704A

  • Multi-field fine-tuning large model parallel reasoning system and method thereof

    CN117474102A

  • Index file processing method and system

    CN117591521A