A data indexing method, computing device, and storage medium
By performing word segmentation and matching on the data table and search query, and building an array index, the problem of low efficiency in full-text search in MongoDB Community Edition was solved, achieving efficient full-text search in a self-hosted environment and improving the database's search performance.
Patent Information
- Application Number
- CN202510652933.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-20
- Publication Date
- 2026-11-27
AI Technical Summary
MongoDB Community Edition's text indexing functionality cannot meet the needs of substring matching and custom word segmentation, resulting in low efficiency for full-text search under large data volumes, and requiring the introduction of additional search engines or being only applicable to the Atlas hosting environment.
By segmenting multiple fields of a data table into words, creating an array index, and performing word segmentation and matching on user search statements to calculate the matching degree and determine the target statement, multi-granularity word segmentation and matching functions are achieved without the need for an external engine.
It improves the efficiency of full-text search in MongoDB databases, enabling efficient full-text search in a self-hosted environment and avoiding dependence on additional engines.
Smart Images

Figure CN123178522A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of database retrieval, and more particularly to a data indexing method, computing device, and storage medium. Background Technology
[0002] MongoDB Community Edition's built-in text indexing only supports matching complete words and simple stemming, failing to meet substring matching and custom word segmentation requirements. For example, MongoDB text indexes only search for complete and correctly spelled words, unable to match substrings within words. When dealing with large datasets, this necessitates scanning numerous index entries or documents, hindering efficient scaling. While Elasticsearch and MongoDB Atlas Search offer full-text search capabilities, they require additional search engines or are only applicable to Atlas-hosted environments, making them unsuitable for all users. Therefore, improving the full-text search functionality of MongoDB Community Edition is necessary. Summary of the Invention
[0003] Embodiments of this disclosure provide a data indexing method, computing device, and storage medium to at least solve the aforementioned problems.
[0004] To achieve the above objectives, the embodiments of this disclosure adopt the following technical solutions:
[0005] A first aspect of this disclosure provides a data indexing method, comprising:
[0006] The statements corresponding to multiple fields in the data table are segmented into words to obtain the first word element of each field;
[0007] Build an array index for the data table based on the first term of each field;
[0008] The user's search query is segmented into words to obtain the second word element of the search query;
[0009] Match the second word with the first word in the array index;
[0010] The matching degree between the second term and each field is calculated based on the number and importance of the matched second term; and
[0011] Based on the matching degree, the target statement expected by the user is determined from the data table.
[0012] In another aspect, this disclosure provides a computing device, comprising:
[0013] processor; and
[0014] A memory that stores program instructions that, when executed by the processor, cause the device to perform the method according to the present disclosure.
[0015] In another aspect, this disclosure provides a computer-readable storage medium storing program instructions that, when executed by a processor of a computing device, cause the device to perform a method according to this disclosure.
[0016] According to the technical solution disclosed herein, by segmenting the field values of the data table and the search query separately, the field values corresponding to the search query can be determined through segmentation matching, thereby improving the efficiency of full-text retrieval of the database without a full table scan. Especially for MonogoDB databases, multi-granularity segmentation and matching functions are achieved without an external engine, enabling full-text retrieval of the database in a self-hosted environment. Attached Figure Description
[0017] The accompanying drawings exemplify embodiments and form part of the specification, serving together with the textual description to explain exemplary implementations of the embodiments. Obviously, the drawings described below are merely some embodiments of the present invention, and those skilled in the art can obtain other drawings based on these drawings without creative effort. In all the drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0018] Figure 1 A block diagram of a computing device 100 according to an example embodiment of this application is shown;
[0019] Figure 2 A flowchart of a data indexing method 200 according to an example embodiment of this application is shown. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are merely some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0021] In this disclosure, the term "multiple" means two or more, unless otherwise stated. In this disclosure, the term "and / or" describes the relationship between related objects, encompassing any one of the listed objects and all possible combinations thereof. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship.
[0022] In this disclosure, unless otherwise stated, the terms "first," "second," etc., are used to distinguish similar objects and are not intended to limit their positional, temporal, or importance relationships. It should be understood that such terms are interchangeable where appropriate so that the embodiments of the invention described herein can be implemented in ways other than those illustrated or described herein.
[0023] Furthermore, the terms “comprising” and “having”, and any variations thereof, are intended to cover non-exclusive inclusion, such that a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such process, method, system, product, or apparatus.
[0024] Figure 1 A block diagram of a computing device 100 according to an example embodiment of this application is shown. The computing device 100 may be a server, personal computer (PC), laptop computer, tablet computer, personal digital assistant (PDA), cellular phone, smartphone, or any other similar device. The computing device 100 may include one or more memories and one or more processors. The processor may include a central processing unit (CPU) and a graphics processing unit (GPU).
[0025] Specifically, computing device 100 may include a CPU, a GPU, and memory (also referred to as main memory to distinguish it from the GPU memory described below) that communicate with each other via a bus. For example, Figure 1 As shown, computing device 100 includes a CPU 110, a GPU 120, and a main memory 140 that communicate with each other via a bus 190. The number of CPUs 110 can be one or more. The CPU can be embodied as a single-core or multi-core processor, a digital signal processor, a microcontroller, or other processor or processing / control circuitry.
[0026] A GPU may include an array of processor cores or parallel processors, each capable of executing multiple parallel and concurrent threads to handle specific types of GPU tasks. Computing device 100 may also include memory for the GPU (also referred to as GPU memory to distinguish it from main memory 140). For example, as Figure 1 As shown, computing device 100 includes GPU memory 170, which can communicate with GPU 120 via a data cable. The number of GPUs 120 can be one or more. In some embodiments, GPU 120 can be connected to bus 190 via an interface for GPUs (hereinafter referred to as GPU interface), such as a PCI interface. In some embodiments, computing device 100 may not have a GPU and GPU memory.
[0027] Memory (e.g., main memory 140 and GPU memory 170) is an example of a computer-readable storage medium. The term computer-readable storage medium can be understood to include a single non-transitory medium or multiple non-transitory media (e.g., centralized or distributed databases and / or associated caches and computing systems) storing one or more instruction sets. The term computer-readable storage medium can also be understood to include any one or more non-transitory media capable of storing, encoding, or carrying instruction sets for machine execution and causing the machine to perform various embodiments of methods, or capable of storing, encoding, or carrying data structures utilized by or associated with such instruction sets. The term computer-readable storage medium can therefore be understood to include, but is not limited to, solid-state memory, optical media, and magnetic media.
[0028] The computing device 100 may also include various input / output devices or interfaces 150 (such as touchscreen displays, audio jacks, voice interfaces) and a network interface 160. In an example embodiment, the network interface 160 may include one or more radio transceivers configured to work with any one or more standard wireless and / or cellular protocols or access technologies (e.g., second-generation (2G), 2.5G, third-generation (3G), fourth-generation (4G), and next-generation radio access for cellular systems, Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Enhanced Data GSM Environment (EDGE), Wideband Code Division Multiple Access (WCDMA), LTE, CDMA2000, WLAN, Wireless Router (WR) mesh, etc.). The network interface 160 may also be configured to work with various other wired and / or wireless communication protocols (including TCP / IP, UDP, SIP, SMS, RTP, WAP, CDMA, TDMA, UMTS, UWB, WiFi, WiMax, etc.). It can be used in conjunction with IEEE 802.11x, etc. Essentially, network interface 160 can virtually include or support any wired and / or wireless communication and data processing mechanism through which information / data can be transmitted between computing device 100 and other devices via the network. The network can be, for example, a wired or wireless network.
[0029] Figure 2 A data indexing method 200 according to an embodiment of the present disclosure is illustrated, adapted to be executed in a computing device. For example... Figure 2 As shown, method 200 includes:
[0030] Step S210: Segment the statements corresponding to multiple fields in the data table to obtain the first word element of each field;
[0031] Step S220: Build an array index for the data table based on the first term of each field;
[0032] Step S230: Segment the user's search query to obtain the second word element of the search query;
[0033] Step S240: Match the second word with the first word in the array index;
[0034] Step S250: Calculate the matching degree between the second term and each field based on the number and importance of the matched second term; and
[0035] Step S260: Based on the matching degree, determine the target statement desired by the user from the data table. Optionally, select the statement with the highest matching degree as the target statement.
[0036] In some embodiments, the data table is a data table in a MonogDB database, and the fields in the data table include, but are not limited to, cluster identifier, POD identifier, node identifier, task name, and progress status. The data table can be a row-column structure, with one column of values used to store the fields and another column of values used to store the statements corresponding to the fields, or field values.
[0037] In some embodiments, step S210, which involves word segmentation of the statements corresponding to multiple fields in the data table, includes:
[0038] For each of the multiple fields:
[0039] Step S211: Select a predetermined number of statements from the statements corresponding to this field;
[0040] Step S212: Determine the proportion of different character types contained in the statement;
[0041] Step S213: Select the corresponding word segmentation method according to the proportion of different character types to segment the statement corresponding to the field.
[0042] The character types include at least one of date characters, text characters, and delimiter characters. Date characters can be identified using regular expressions; for example, characters in common date formats such as YYYYMMDD, YYYY / MM / DD, and YYYY-MM-DD are date characters. Plain text characters include, but are not limited to, numbers, letters, and mixed characters. Delimiter characters include, but are not limited to, spaces, commas, and hyphens.
[0043] In one implementation, step S213, selecting the corresponding word segmentation method based on the proportion of different character types, specifically includes:
[0044] In response to the fact that the proportion of date characters is greater than or equal to the first one, a regular expression matching method is used for word segmentation;
[0045] In response to the fact that the proportion of the delimiter character is greater than or equal to the second proportion, the delimiter splitting method is used for word segmentation;
[0046] In response to the proportion of text characters greater than or equal to the third and the proportion of delimiter characters less than or equal to the fourth, the N-gram segmentation method (NGram) or the prefix N-gram segmentation method (Edge N-Gram) is used for word segmentation.
[0047] The N-Gram method uses N values from 3 to 63, meaning it cuts the field into multiple tokens of length 3 to 63. For example, "hello" will be cut into five tokens: "hel", "ell", "lllo", "hell", "ello", and "hello". The Edge N-Gram method cuts the field into multiple tokens of length 3 to 63 starting from the left. For example, "hello" will be cut into three tokens: "hel", "hell", and "hello".
[0048] Optionally, the first percentage can be greater than the second percentage. The first percentage can be 80%, the second percentage can be 50%, the third percentage can be 50%-60%, and the fourth percentage can be 10%-20%, but it is not limited to these.
[0049] For example, if a node identifier field in a data table might have thousands of rows, a predetermined number of statements (e.g., 200 rows) are randomly selected from these rows as a sample set. This sample set is then analyzed to identify the proportion of different character types. If the proportion of date characters is greater than or equal to the first proportion, regular expression matching is applied to all thousands of rows of node identifier fields. If the proportion of delimiter characters is greater than or equal to the second proportion, the Split delimiter segmentation method is used to segment all thousands of rows of node identifier fields. For example, "my pod,1" is segmented into three tokens: "my", "pod", and "1".
[0050] If the sample mainly consists of letters and has no obvious separators, then choose the NGram or EdgeGram segmentation method to generate tokens.
[0051] Optionally, selecting the corresponding word segmentation method based on the proportion of the different character types includes:
[0052] In response to a predetermined number of statements matching a predefined keyword list, keyword segmentation is used for word segmentation. The keyword list includes a set of keywords from commonly used fields in the current database. This keyword list can be pre-stored in the database or matched against a keyword list stored in the cloud. If a predetermined proportion of words in a predetermined number of statements match this keyword list, then the keyword segmentation method is used for word segmentation.
[0053] In some embodiments, step S210, which segments the statements corresponding to multiple fields in the data table, further includes segmenting the different language parts of the statements separately. Specifically, for Chinese or other languages not separated by spaces, a dictionary-based segmentation engine (such as Jieba segmentation) can be used to accurately segment the sentences, or character-level NGRAM can be used for segmentation. If the fields contain mixed languages, different segmentation strategies can be applied to the Chinese and English parts respectively.
[0054] In some embodiments, method 100 further includes: for a search statement or a statement in a data table, removing redundant characters from the statement, such as various punctuation marks like "-", "_", ".", etc.
[0055] In some embodiments, method 100 further includes: for search statements or statements in a data table, unifying the case format of characters in the statement, such as unifying letters to uppercase letters or unifying them to lowercase letters.
[0056] In some embodiments, method 100 further includes: uniformly replacing different forms of the same word with the root word, for example, replacing "has", "had", and "having" with "have".
[0057] In some embodiments, method 100 further includes: replacing multiple synonyms with the same word, or setting them to the same word, for example, replacing both "car" and "vehicle" with the same word representing a vehicle, or by setting them.
[0058] In some embodiments, method 100 further includes removing custom stop words.
[0059] After the above word segmentation and character processing methods, the segmented word elements can be written into the corresponding rows of the fields in the form of arrays. Multiple word element arrays from multiple fields then form an array index. For example...
[0060] JSON
[0061] db.applications.createIndex({name_tokens:1});
[0062] During searches, MongoDB utilizes this index for efficient queries, rather than performing a full table scan like with $regex. If different fields use different tokenizers, the tokens for each field can be stored across multiple fields accordingly.
[0063] This disclosure, in addition to segmenting the data table, also needs to segment the user's search query. When the user input contains multiple words, it can first be segmented into individual tokens, and then combined using $in or $and / $all. For example,
[0064]
[0065]
[0066] In some embodiments, segmenting a user's search query into words includes: segmenting the user's search query into words using a keyword segmentation method based on a predefined keyword list. This keyword list may be a keyword list from a data table.
[0067] In some embodiments, segmenting a user's search query further includes generating similar spellings of the search term, which can be done based on edit distance or by using a small number of replacements. Edit distance is a metric used to measure the degree of difference between two strings; it represents the minimum number of editing operations required to transform one string into another.
[0068] Additionally, search queries can be broken down into multiple possible NGRAM tokens and merged, increasing tolerance for user input errors. For search queries that have already been segmented once, the segmented units can be further segmented or normalized (e.g., stemmed) before matching with NGRAM, depending on actual needs. For example, in a multilingual environment, different languages have different segmentation rules, and the initial segmentation may not accurately identify the lexical structure of all languages, potentially requiring re-segmentation based on the specific language.
[0069] Alternatively, the second terminology obtained from the initial word segmentation can be matched with the array index of the data table, and the number of fields in the array index that can match a predetermined proportion of the second terminology can be counted. If the number of fields is less than or equal to a predetermined threshold, the search query can be segmented again. For example, if the initial word segmentation yields 4 second terminology entries, and there are 1000 fields in the data index, if only 5 fields can match 2 second terminology entries, the search query can be segmented again, and the second terminology can be replaced with synonyms.
[0070] After both the data table and the search query have undergone word segmentation, search matching can be performed. The search query is processed into a second word tuple (i.e., a combination of multiple second word elements). Each row of the data table is processed into a first word tuple (i.e., each row of fields corresponds to a combination of first word elements), and each row of the array index is also a first word tuple. Then, the second word tuple can be matched with multiple first word tuples. Specifically, each word element in the second word tuple is matched with a first word tuple to determine the number and position of second word elements that the second word tuple can match in each first word tuple. For example, if the search query is segmented into 4 second word elements from beginning to end using the keyword segmentation method, then the second word tuple contains 4 words. The first row of the array index matches second word element 1 and second word element 3, the second row of the array index matches the first 3 second word elements, and so on.
[0071] In some embodiments, the match degree between the second term and each field is calculated based on the number and importance of the matched second term: the match degree between the second term and each field is calculated based on the number, importance, and rarity of the matched second term. The importance of the second term is related to its position in the search statement. Optionally, by default, terms that are ranked to the left (or earlier) in the statement are more important than terms that are ranked to the right (or later); the earlier a term appears, the higher its importance. For example, if the second term pair is "my" and "pod", then by default, "my" which appears earlier is more important, and its match weight value is higher.
[0072] It can be seen that the matching degree is related to the number, importance, and rarity of the matched second word units. A weight can be set for each parameter, and the influence of each parameter can be combined using a weighted average to obtain the final matching degree result. Moreover, each second word unit also has its corresponding weight value, and the importance of each word unit is obtained by combining the weight values of each word unit.
[0073] As mentioned earlier, the fields in the data table can include POD identifier, cluster identifier, task name, task progress status, etc. Tasks run on nodes within the cluster. The data table stores the task's attribute information, the cluster, POD, and node executing the task, as well as the attribute information of the cluster, POD, and node. Computing devices can be configured to manage multiple nodes across multiple clusters, acquiring the attribute information of each cluster, POD, node, and task, and storing it in the database table. The computing device can periodically, in real-time, or continuously monitor this attribute information and update the data table accordingly. Furthermore, the computing device can periodically, in real-time, or continuously generate new array indexes for the updated data table.
[0074] In some embodiments, the computing device can also receive and store user-submitted dataset creation requests or dataset update requests, cache newly generated datasets in one or more clusters, or update cached datasets in the clusters. A cluster can have multiple nodes; a cluster that caches datasets is called a data caching cluster, and nodes that cache datasets are called data caching nodes. Nodes that do not cache datasets are called non-data caching nodes. A data caching node may cache one or more datasets, and each dataset can be used to perform different tasks.
[0075] Multiple nodes in multiple clusters can cache the same dataset, forming a redundant cache. Alternatively, multiple nodes in multiple clusters can cache different parts of a dataset, forming a distributed cache.
[0076] The computing device can record data cache clusters in multiple clusters, the availability zone of each data cache cluster, the data cache nodes and non-data cache nodes within each availability zone, and the datasets cached by the data cache nodes in a data table of a database (e.g., MonogoDB). It should be understood that the computing device performing the data indexing method and the computing device monitoring and recording various cluster attribute information can be the same device or different devices; this disclosure does not impose any restrictions on this.
[0077] Therefore, the attribute information that a database table can record includes, but is not limited to, cluster identifier, cluster idle resources, cluster resource utilization, and cluster availability zone identifier; node identifier, node idle resources, and node resource utilization; dataset version, dataset generation time, dataset update information, dataset type, dataset purpose (such as executable task label), dataset location (including but not limited to the cluster identifier, availability zone identifier, and node identifier where the dataset is cached), dataset characteristics (including the dataset's cache medium and capacity), dataset permission information, and mount directory information. Among these, dataset permission information indicates which nodes can read or write the dataset. When a node needs to access the dataset, it first verifies whether the node has permission to access the dataset. Idle resources include idle CPU, GPU, and memory, while resource utilization includes CPU, GPU, and memory that are currently in use or already occupied.
[0078] The dataset types include, but are not limited to, raw data, preprocessed data, labeled data, and model data. Preprocessed data includes data obtained after preprocessing the raw data, such as video cropping or cutting. Labeled data is generated manually or automatically, such as descriptive information for images and videos, bounding boxes for objects, and further includes pre-packaged data generated according to the model's required format. Preprocessed and labeled data can be used as training sets for model training. Different models can have different training sets, and different training sets can be used to perform different tasks. For example, an original image training set is used to train original image generation; this training set includes labeled original images. A subtitle training set is used to train subtitle generation; this training set includes labeled subtitles. An object detection training set is used to train object detection; this training set includes labeled detection boxes. Model data is used to store the parameters and hyperparameters of each model, representing a model. Each dataset may also have executable task labels, such as labels for training original image generation, labels for training subtitle generation, and labels for training object detection.
[0079] In one implementation, the computing device can cache the dataset upon receiving a user's dataset update request or dataset creation request, and record the cached results in a data table in a database (such as MonogoDB). That is, the dataset can be cached as soon as it is detected that it has been generated or updated. The cached results include, but are not limited to, the type of the cached dataset, the cluster where the caching took place, and the node identifier.
[0080] In another implementation, the computing device can also cache the dataset upon receiving a user-submitted POD scheduling request and record the cached result in a data table. That is, the dataset is only cached when it is determined that scheduling requires its use.
[0081] Computing devices can select the cluster to cache a dataset based on the available resources of each cluster and the association between the stored dataset and the dataset to be cached. Associations include iterative relationships or data dependencies; iterative versions of existing datasets are preferentially stored in the cluster containing the existing dataset. Datasets that depend on other datasets are also preferentially stored in the cluster containing the datasets they depend on.
[0082] When allocating user-submitted task processing requests, the computing device prioritizes selecting nodes for task execution based on the type of target dataset required by the task. Specifically, it determines the target node for a given cluster based on whether the target dataset is already cached and the cluster's attribute information, and then schedules the POD to be scheduled to that target node. If the POD needs to access the output results of other PODs, it is preferentially assigned to the cluster of those other PODs. Various attribute information can have different weights, and a weighted average is used to determine the cluster with the best results as the target cluster.
[0083] Each attribute can be used as a filtering condition, and the score of each node in the cluster for each filtering condition is evaluated. Then, based on the weight of each filtering condition, a weighted average is used to obtain the final score for each node, from which the target node is determined. Furthermore, a plugin can be set for each filtering condition, with a plugin weight representing the importance of the corresponding filtering condition. A plugin weight of 0 means that the corresponding filtering condition is not considered and does not participate in the final score calculation. A higher plugin weight indicates that the corresponding filtering condition is more important. Therefore, different plugin weights can be set according to user needs.
[0084] When determining the target node, if multiple data caching nodes within the target cluster cache the target dataset, the data caching node that does not cache other datasets has a higher priority than the data caching node that does cache other datasets. For example, if a POD to be scheduled requires a first dataset, and node A in the cluster stores both the first and second datasets, while node B stores the first dataset, then node B is prioritized as the target node for the POD to be scheduled, so that node A can be allocated to the POD that needs the second dataset during the subsequent allocation process.
[0085] The computing device can also adjust the resource requirements of the POD to be scheduled based on the actual resource consumption of historical PODs of the same type, and compare the adjusted resource requirements with the resources of each idle node. It should be understood that user-submitted POD resource requirements are usually higher than the actual expected value; therefore, the resource requirements of the POD to be scheduled can be adjusted based on historical data, and the target cluster and target nodes can be allocated based on the adjusted resource requirements to improve node resource utilization.
[0086] The PODs to be scheduled are used to execute tasks. The computing device can also monitor the nodes running tasks across multiple nodes in the cluster to determine if any components (GPUs, CPUs, memory, network interfaces, etc.) on the nodes are failing.
[0087] The computing device determines whether a node's components have failed and identifies the type of failure based on acquired cluster metric data. If a node's components fail, the component is called a faulty component, and the node constitutes a faulty node. The computing device marks the faulty node as unschedulable in the data table; nodes with this mark will not be assigned tasks. When a faulty node is successfully repaired and returns to a normal state, the computing device removes the unschedulable mark from the data table or restores it to a schedulable mark, allowing subsequent task assignments to that node.
[0088] This disclosure also provides a computing device including a processor and a memory, the memory storing program instructions that, when executed by the processor, cause the device to perform a method according to this disclosure.
[0089] This disclosure also provides a computer-readable storage medium that stores program instructions that, when executed by a processor of a computing device, cause the device to perform a method according to this disclosure.
[0090] According to this disclosure, when a node in the cluster fails, tasks are handled differently depending on the circumstances, thereby minimizing the impact of the failure on the tasks and improving the efficiency of the cluster in executing tasks.
[0091] While this document includes numerous details, these details should not be construed as limiting the scope of the claimed invention, but rather as descriptions of features specific to particular embodiments. Certain features described herein in the context of different embodiments may also be combined in a single embodiment. Conversely, various features described in the context of a single embodiment may be implemented separately or in any suitable sub-combination in multiple embodiments. Furthermore, while features may be described above as acting in certain combinations and even initially claimed, one or more features from a claimed combination may be removed from the combination in some cases, and the claimed combination may be for sub-combinations or variations thereof. Similarly, although operations are depicted in a specific order in the figures, this should not be construed as requiring such operations to be performed in the specific order shown or in a sequential order, or to perform all illustrated operations to achieve the desired result.
[0092] Note that the above description is merely a preferred embodiment and the technical principles employed in this disclosure. Those skilled in the art will understand that this disclosure is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of this disclosure. Therefore, although this disclosure has been described in detail through the above embodiments, it is not limited to the above embodiments. Many other equivalent embodiments may be included without departing from the concept of this disclosure, and the scope of this disclosure is determined by the scope of the appended claims.
Claims
1. A data indexing method, comprising: The statements corresponding to multiple fields in the data table are segmented into words to obtain the first word element of each field; Build an array index for the data table based on the first term of each field; The user's search query is segmented into words to obtain the second word element of the search query; Match the second word with the first word in the array index; The matching degree between the second term and each field is calculated based on the number and importance of the matched second term; as well as Based on the matching degree, the target statement expected by the user is determined from the data table.
2. The method as described in claim 1, wherein, Tokenization of statements corresponding to multiple fields in a data table includes: For each of the multiple fields: Select a predetermined number of statements from the statements corresponding to this field; Determine the proportion of different character types contained in the statement; The corresponding word segmentation method is selected based on the proportion of different character types to segment the statement corresponding to the field.
3. The method as described in claim 2, wherein, The character type includes at least one of date characters, plain text characters, and delimiter characters, and the method for selecting the corresponding word segmentation method based on the proportion of the different character types includes: In response to the fact that the proportion of date characters is greater than or equal to the first one, a regular expression matching method is used for word segmentation; In response to the fact that the proportion of the delimiter character is greater than or equal to the second proportion, the delimiter splitting method is used for word segmentation; In response to the fact that the proportion of plain text characters is greater than or equal to the third and the proportion of delimiter characters is less than or equal to the fourth, the N-gram model segmentation method or the prefix N-gram model segmentation method is used for word segmentation.
4. The method of claim 2, wherein, The method for selecting the corresponding word segmentation method based on the proportion of different character types includes: In response to the predetermined number of statements matching a predefined list of keywords, a keyword segmentation method is used for word segmentation.
5. The method of claim 1, wherein, The matching degree between the second term and each field is calculated based on the number and importance of the matched second term: The matching degree between the second term and each field is calculated based on the number of matched second terms, their importance, and their rarity.
6. The method of claim 1, wherein, The importance of the second term is related to its position in the search statement.
7. The method of claim 1, wherein, Tokenization of a user's search query includes: Based on a predefined list of keywords, the user's search query is segmented using a keyword segmentation method.
8. The method of claim 1, further comprising: Remove redundant characters from a statement; Standardize the capitalization of characters in statements; Replace the different forms of the same word with the root word; Replace the same word with multiple synonyms.
9. The method of claim 1, wherein, Word segmentation of statements corresponding to multiple fields in a data table also includes word segmentation of different language parts of the statement; The word segmentation of the user's search query also includes generating words with similar spellings to the search query.
10. The method of claim 1, wherein, The data table is a data table in a MonogoDB database, and the fields include at least one of the following: cluster identifier, POD identifier, node identifier, task name, and progress status.
11. A computing device, comprising: processor; and A memory that stores program instructions that, when executed by the processor, cause the device to perform the method according to any one of claims 1-10.
12. A computer-readable storage medium storing program instructions that, when executed by a processor of a computing device, cause the device to perform the method according to any one of claims 1-10.
