Data query method and device based on index weight promotion, equipment and medium
By building an indexed document library and calculating the index weight values of fields, and using Boolean queries for weight boosting, the problem of inaccurate query results in Elasticsearch after the data type is increased is solved, thus improving the accuracy and recall of data queries.
Patent Information
- Application Number
- CN202210891693.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-27
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2042-07-27
AI Technical Summary
Traditional relational databases are inefficient at storing and retrieving massive amounts of data, especially in full-text search where query results are inaccurate. Elasticsearch's query recall deteriorates as the data types increase, leading to inaccurate query results.
By building an indexed document library, calculating the index weight values of fields, and using Boolean queries to perform weight boosting, the weight of query requests is dynamically adjusted to improve query accuracy.
It improved the accuracy and recall of data queries and solved the problem of inaccurate query results.
Smart Images

Figure CN115098534B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and in particular to a data query method, apparatus, electronic device, and readable storage medium based on index weight enhancement. Background Technology
[0002] With technological advancements, stored data is growing exponentially. Traditional relational databases struggle to meet the efficiency demands of storing and retrieving massive amounts of data, particularly in full-text search. Elasticsearch, a big data storage, search, and analytics engine, effectively addresses these challenges. As a widely adopted full-text search solution, Elasticsearch is a go-to engine for this purpose. However, with the growth and changes in project operations, more and more data types are added to Elasticsearch, leading to a corresponding increase in the number of indexes. These changes result in increasingly poor query recall, making search results less accurate. Summary of the Invention
[0003] This invention provides a data query method, apparatus, electronic device, and readable storage medium based on index weight enhancement, the main purpose of which is to solve the problem of inaccurate data query.
[0004] To achieve the above objectives, the present invention provides a data query method based on index weight enhancement, comprising:
[0005] Obtain the data set to be queried, and construct an indexed document library based on the data types in the data set to be queried;
[0006] Obtain the original data query request, and perform field marking processing on the original data query request to obtain a set of marked fields;
[0007] Calculate the index weight value of each field in the set of marked fields based on the indexed document library;
[0008] The index weight value is boosted based on the Boolean query to obtain a standard data query request;
[0009] The standard data query request is used to perform a loop query on the indexed document library to obtain the data query results.
[0010] Optionally, constructing an indexed document library based on the data types in the dataset to be queried includes:
[0011] The data documents in the dataset to be queried are segmented using a preset data query engine to obtain a document segmentation set.
[0012] An index mapping configuration is constructed based on the data types in the document word segmentation set. The index mapping configuration is then used to perform index mapping processing on the document word segmentation set, so that the index and the document word segmentation correspond one-to-one, thus obtaining the indexed document library.
[0013] Optionally, the process of performing field tagging on the original data query request to obtain a set of tagged fields includes:
[0014] Parse the query keywords in the original data query request, perform character filtering on the query keywords, and obtain standard keywords;
[0015] The set of marked fields is obtained by setting highlighted field tags based on the standard keywords.
[0016] Optionally, calculating the index weight value of each field in the tag field set based on the indexed document library includes:
[0017] The number of documents corresponding to each index in the indexed document library is counted, and the proportion of documents corresponding to all indexes is calculated.
[0018] The index weight value of the successfully matched field is calculated by matching each field in the set of marked fields with the index in the indexed document library, and by using a preset weight formula and the proportion of the corresponding document in the index.
[0019] Optionally, matching the indexes in the indexed document library using each field in the set of marked fields includes:
[0020] Calculate the similarity between each field in the tag field set and the index in the indexed document library in sequence;
[0021] Fields with similarity scores less than or equal to a preset first similarity threshold are determined to have failed to match.
[0022] Fields with similarity greater than the first similarity threshold are determined to be successfully matched, and fields with similarity greater than or equal to a preset second similarity threshold are selected as fully matched fields from the successfully matched fields.
[0023] Optionally, the step of performing weight boosting on the index weight value based on a Boolean query to obtain a standard data query request includes:
[0024] Construct subqueries based on the fields that are successfully matched, and summarize all subqueries to obtain the original Boolean query;
[0025] A weighted subquery is added to the original Boolean query based on the exact match field to obtain the standard data query request.
[0026] Optionally, the step of performing a cyclic data query on the indexed document library using the standard data query request to obtain data query results includes:
[0027] The indexed document library is queried using the standard data query request to obtain the original recall results;
[0028] The index weight value is adjusted based on the original recall result, and the step of weight boosting the index weight value according to the Boolean query is returned until the preset recall requirements are met, and the standard recall result is obtained.
[0029] A preset number of data points are selected from the standard recall results as the data query results.
[0030] To address the aforementioned problems, the present invention also provides a data query device based on index weight enhancement, the device comprising:
[0031] The index document library construction module is used to obtain a set of data to be queried and construct an index document library based on the data types in the set of data to be queried.
[0032] The field tagging module is used to obtain the original data query request, perform field tagging processing on the original data query request, and obtain a set of tagged fields.
[0033] The index weight enhancement module is used to calculate the index weight value of each field in the tag field set based on the indexed document library, perform weight enhancement processing on the index weight value according to Boolean query, and obtain a standard data query request;
[0034] The data query module is used to perform a cyclic data query on the indexed document library using the standard data query request to obtain the data query results.
[0035] To address the above problems, the present invention also provides an electronic device, the electronic device comprising:
[0036] Memory, storing at least one computer program; and
[0037] The processor executes the computer program stored in the memory to implement the data query method based on index weight enhancement described above.
[0038] To address the aforementioned problems, the present invention also provides a computer-readable storage medium storing at least one computer program, which is executed by a processor in an electronic device to implement the data query method based on index weight enhancement described above.
[0039] This invention constructs an index document library based on the data types in the dataset to be queried, performs field marking on the original data query request to obtain a marked field set, calculates the index weight value of each field in the marked field set based on the index document library, and performs weight boosting processing on the index weight values according to Boolean queries to obtain a standard data query request. When performing iterative data queries on the index document library using the standard data query request, the weight of the standard data query request can be dynamically adjusted based on the index weight values of each field in the marked field set, thereby improving the accuracy of data queries. Therefore, the data query method, apparatus, electronic device, and computer-readable storage medium based on index weight enhancement proposed in this invention can solve the problem of inaccurate data queries. Attached Figure Description
[0040] Figure 1 This is a flowchart illustrating a data query method based on index weight enhancement according to an embodiment of the present invention.
[0041] Figure 2 for Figure 1 A detailed implementation flowchart of one of the steps;
[0042] Figure 3 for Figure 1 A detailed implementation flowchart for another step in the process;
[0043] Figure 4 This is a functional block diagram of a data query device based on index weight enhancement provided in an embodiment of the present invention;
[0044] Figure 5 This is a schematic diagram of the structure of an electronic device that implements the data query method based on index weight enhancement, as provided in an embodiment of the present invention.
[0045] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0046] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0047] This invention provides a data query method based on index weight enhancement. The execution entity of this data query method includes, but is not limited to, at least one of the following electronic devices that can be configured to execute the method provided in this invention: a server, a terminal, etc. In other words, the data query method based on index weight enhancement can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes, but is not limited to, a single server, a server cluster, a cloud server, or a cloud server cluster. The server can be an independent server or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0048] Reference Figure 1 The diagram shown is a flowchart illustrating a data query method based on index weight enhancement according to an embodiment of the present invention. In this embodiment, the data query method based on index weight enhancement includes the following steps S1-S4:
[0049] S1. Obtain the data set to be queried, and construct an indexed document library based on the data types in the data set to be queried.
[0050] In this embodiment of the invention, the data set to be queried refers to a collection of original data documents that need to be queried in different fields. For example, in the financial field, the data set to be queried includes insurance data, user Q&A data, etc., where each piece of insurance data or user Q&A data is a document.
[0051] Specifically, the step of constructing an indexed document library based on the data types in the dataset to be queried includes:
[0052] The data documents in the dataset to be queried are segmented using a preset data query engine to obtain a document segmentation set.
[0053] An index mapping configuration is constructed based on the data types in the document word segmentation set. The index mapping configuration is then used to perform index mapping processing on the document word segmentation set, so that the index and the document word segmentation correspond one-to-one, thus obtaining the indexed document library.
[0054] In this embodiment of the invention, the preset data query engine can be an Elasticsearch (ES) data query engine, which is a distributed, highly scalable, and real-time search and data analysis engine. It can easily enable large amounts of data to be searched, analyzed, and explored. Fully utilizing Elasticsearch's horizontal scalability makes data more valuable in production environments. The implementation principle of Elasticsearch mainly involves the following steps: First, several data items are submitted to Elasticsearch. Then, the corresponding data documents are segmented into words by a word segmentation controller (Standard, Simple, Whitespace, etc.), and the weights and segmentation results are stored together. When performing a data query, a search is performed based on the user's input search keywords, and the search results are ranked according to their weights before being returned to the user.
[0055] In an optional embodiment of the present invention, for example, for a certain user question and answer data, the index mapping configuration is as follows: ugc-search-question-with-answer (question and answer index): "singleQuestionEs" (question): {"properties" (property): {"id": {"type" (type): "long"},"title" (title)……..
[0056] In an optional embodiment of the present invention, the indexed document library is a collection of "Key-Value" type data, such as "title": "XX problem".
[0057] S2. Obtain the original data query request, and perform field marking processing on the original data query request to obtain a set of marked fields.
[0058] In this embodiment of the invention, the original data query request is a query instruction containing query keywords input by the user.
[0059] For details, refer to Figure 2 As shown, the process of performing field marking processing on the original data query request to obtain a set of marked fields includes the following steps S20-S21:
[0060] S20. Parse the query keywords in the original data query request, perform character filtering on the query keywords, and obtain standard keywords;
[0061] S21. Set highlight field tags based on the standard keywords to obtain the set of tag fields.
[0062] In an optional embodiment of the present invention, the query keywords refer to the original keywords entered by the user. Since these keywords may include special characters (such as \\, +, !, &, / , ?, etc.), it is necessary to filter these special characters to improve the accuracy of data queries. Furthermore, since user queries often focus on titles and names, setting highlighted fields based on standard keywords can further improve the accuracy of data queries. For example, highlighting fields for queries could include singleQuestionEstitle (question title) and specialName (topic name).
[0063] S3. Calculate the index weight value of each field in the tag field set based on the indexed document library.
[0064] For details, refer to Figure 3 As shown, the calculation of the index weight value of each field in the tag field set based on the indexed document library includes the following steps S30-S31:
[0065] S30. Count the number of documents corresponding to each index in the indexed document library, and calculate the proportion of documents corresponding to all indexes;
[0066] S31. Match each field in the set of marked fields with the indexes in the indexed document library, and calculate the index weight value of the successfully matched field using a preset weight formula and the proportion of the document corresponding to the index.
[0067] In an optional embodiment of the present invention, the corresponding data volume of each index in the indexed document library is queried and their ratio values are calculated. For example: ugc-search-question-with-answer (question-answer index): ugc-pan-video (video index): ugc-pan-program (album index): ugc-pan-album (collection index): question-topic (topic index): question-special-topic (special topic index) = 516777:10032:12:6681117:28:14. Simultaneously, index matching can be achieved by calculating the similarity (such as cosine similarity) between each field in the tag field set and the indexes in the indexed document library.
[0068] Specifically, the step of matching the indexes in the indexed document library using each field in the set of marked fields includes:
[0069] Calculate the similarity between each field in the tag field set and the index in the indexed document library in sequence;
[0070] Fields with similarity scores less than or equal to a preset first similarity threshold are determined to have failed to match.
[0071] Fields with similarity greater than the first similarity threshold are determined to be successfully matched, and fields with similarity greater than or equal to a preset second similarity threshold are selected as fully matched fields from the successfully matched fields.
[0072] In an optional embodiment of the present invention, for example, fields with a similarity greater than 80% (first similarity threshold) are identified as successfully matched, and fields with a similarity of 100% (second similarity threshold) are identified as completely matched fields.
[0073] In an optional embodiment of the present invention, the index weight value can be calculated using the following formula:
[0074] Q i =K / logN i
[0075] Among them, Q i The index weight value of the i-th field that is successfully matched, where K is the adjustment factor and N is the index weight value of the i-th field. i This represents the proportion of documents corresponding to the index of the i-th field that successfully matches.
[0076] S4. Perform weight boosting on the index weight value according to the Boolean query to obtain a standard data query request.
[0077] In this embodiment of the invention, Boolean query is a commonly used combined query in Elasticsearch. When multiple expressions are combined, that is, when multiple subqueries are combined into a Boolean expression, the logical relationship between all subqueries is AND, thereby improving the accuracy of data query.
[0078] Further, the step of performing weight boosting on the index weight value based on the Boolean query to obtain a standard data query request includes:
[0079] Construct subqueries based on the fields that are successfully matched, and summarize all subqueries to obtain the original Boolean query;
[0080] A weighted subquery is added to the original Boolean query based on the exact match field to obtain the standard data query request.
[0081] In an optional embodiment of the present invention, a Boolean query is used, and a weighted subquery is added to the exact match field within the Boolean query, thereby increasing the weight of the document retrieved by the corresponding index and making the corresponding document rank higher in the result score. For example, singleQuestionEs.title.keyword^10, where keyword^10 represents the increased weight.
[0082] S5. Use the standard data query request to perform a loop data query on the indexed document library to obtain the data query results.
[0083] In detail, the step of performing a cyclic data query on the indexed document library using the standard data query request to obtain data query results includes:
[0084] The indexed document library is queried using the standard data query request to obtain the original recall results;
[0085] The index weight value is adjusted based on the original recall result, and the step of weight boosting the index weight value according to the Boolean query is returned until the preset recall requirements are met, and the standard recall result is obtained.
[0086] A preset number of data points are selected from the standard recall results as the data query results.
[0087] In one optional embodiment of the present invention, after obtaining the search statement through a Boolean query, a search request is initiated, the recall results are observed and recorded, and the K adjustment factor is adjusted according to the recall results, thereby adjusting the index weight values until the recall results contain documents that can be recalled when each index is searched individually (i.e., the preset recall requirements). The top 20 data entries are selected as the data query results. Therefore, by dynamically adjusting the weights of each index according to the amount of data under different indexes and the number of documents that match exactly during data query, the recall rate of the search can be improved, thereby improving the accuracy of the data query.
[0088] This invention constructs an indexed document library based on the data types in the dataset to be queried. The original data query request is then marked with fields to obtain a set of marked fields. The index weight value of each field in the marked field set is calculated based on the indexed document library, and the index weight values are then weighted using a Boolean query to obtain a standard data query request. When performing iterative data queries on the indexed document library using the standard data query request, the weight of the standard data query request can be dynamically adjusted based on the index weight values of each field in the marked field set, thereby improving the accuracy of data queries. Therefore, the data query method based on index weight enhancement proposed in this invention can solve the problem of inaccurate data queries.
[0089] like Figure 4 The diagram shown is a functional block diagram of a data query device based on index weight enhancement provided in an embodiment of the present invention.
[0090] The data query device 100 based on index weight enhancement described in this invention can be installed in an electronic device. Depending on the functions implemented, the data query device 100 based on index weight enhancement may include an index document library construction module 101, a field tagging module 102, an index weight enhancement module 103, and a data query module 104. The module described in this invention can also be referred to as a unit, which refers to a series of computer program segments that can be executed by the processor of an electronic device and can perform a fixed function, and which are stored in the memory of the electronic device.
[0091] In this embodiment, the functions of each module / unit are as follows:
[0092] The index document library construction module 101 is used to obtain a data set to be queried and construct an index document library based on the data types in the data set to be queried.
[0093] The field marking module 102 is used to obtain the original data query request, perform field marking processing on the original data query request, and obtain a set of marked fields.
[0094] The index weight enhancement module 103 is used to calculate the index weight value of each field in the tag field set based on the index document library, and perform weight enhancement processing on the index weight value according to Boolean query to obtain a standard data query request;
[0095] The data query module 104 is used to perform a cyclic data query on the indexed document library using the standard data query request to obtain data query results.
[0096] In detail, the specific implementation methods of each module of the data query device 100 based on index weight enhancement are as follows:
[0097] Step 1: Obtain the data set to be queried, and build an indexed document library based on the data types in the data set to be queried.
[0098] In this embodiment of the invention, the data set to be queried refers to a collection of original data documents that need to be queried in different fields. For example, in the financial field, the data set to be queried includes insurance data, user Q&A data, etc., where each piece of insurance data or user Q&A data is a document.
[0099] Specifically, the step of constructing an indexed document library based on the data types in the dataset to be queried includes:
[0100] The data documents in the dataset to be queried are segmented using a preset data query engine to obtain a document segmentation set.
[0101] An index mapping configuration is constructed based on the data types in the document word segmentation set. The index mapping configuration is then used to perform index mapping processing on the document word segmentation set, so that the index and the document word segmentation correspond one-to-one, thus obtaining the indexed document library.
[0102] In this embodiment of the invention, the preset data query engine can be an Elasticsearch (ES) data query engine, which is a distributed, highly scalable, and real-time search and data analysis engine. It can easily enable large amounts of data to be searched, analyzed, and explored. Fully utilizing Elasticsearch's horizontal scalability makes data more valuable in production environments. The implementation principle of Elasticsearch mainly involves the following steps: First, several data items are submitted to Elasticsearch. Then, the corresponding data documents are segmented into words by a word segmentation controller (Standard, Simple, Whitespace, etc.), and the weights and segmentation results are stored together. When performing a data query, a search is performed based on the user's input search keywords, and the search results are ranked according to their weights before being returned to the user.
[0103] In an optional embodiment of the present invention, for example, for a certain user question and answer data, the index mapping configuration is as follows: ugc-search-question-with-answer (question and answer index): "singleQuestionEs" (question): {"properties" (property): {"id": {"type" (type): "long"},"title" (title)……..
[0104] In an optional embodiment of the present invention, the indexed document library is a collection of "Key-Value" type data, such as "title": "XX problem".
[0105] Step 2: Obtain the original data query request, and perform field marking processing on the original data query request to obtain a set of marked fields.
[0106] In this embodiment of the invention, the original data query request is a query instruction containing query keywords input by the user.
[0107] Specifically, the process of performing field tagging on the original data query request to obtain a set of tagged fields includes:
[0108] Parse the query keywords in the original data query request, perform character filtering on the query keywords, and obtain standard keywords;
[0109] The set of marked fields is obtained by setting highlighted field tags based on the standard keywords.
[0110] In an optional embodiment of the present invention, the query keywords refer to the original keywords entered by the user. Since these keywords may include special characters (such as \\, +, !, &, / , ?, etc.), it is necessary to filter these special characters to improve the accuracy of data queries. Furthermore, since user queries often focus on titles and names, setting highlighted fields based on standard keywords can further improve the accuracy of data queries. For example, highlighting fields for queries could include singleQuestionEstitle (question title) and specialName (topic name).
[0111] Step 3: Calculate the index weight value of each field in the tag field set based on the indexed document library.
[0112] Specifically, the calculation of the index weight value of each field in the tag field set based on the indexed document library includes:
[0113] The number of documents corresponding to each index in the indexed document library is counted, and the proportion of documents corresponding to all indexes is calculated.
[0114] The index weight value of the successfully matched field is calculated by matching each field in the set of marked fields with the index in the indexed document library, and by using a preset weight formula and the proportion of the corresponding document in the index.
[0115] In an optional embodiment of the present invention, the corresponding data volume of each index in the indexed document library is queried and their ratio values are calculated. For example: ugc-search-question-with-answer (question-answer index): ugc-pan-video (video index): ugc-pan-program (album index): ugc-pan-album (collection index): question-topic (topic index): question-special-topic (special topic index) = 516777:10032:12:6681117:28:14. Simultaneously, index matching can be achieved by calculating the similarity (such as cosine similarity) between each field in the tag field set and the indexes in the indexed document library.
[0116] Specifically, the step of matching the indexes in the indexed document library using each field in the set of marked fields includes:
[0117] Calculate the similarity between each field in the tag field set and the index in the indexed document library in sequence;
[0118] Fields with similarity scores less than or equal to a preset first similarity threshold are determined to have failed to match.
[0119] Fields with similarity greater than the first similarity threshold are determined to be successfully matched, and fields with similarity greater than or equal to a preset second similarity threshold are selected as fully matched fields from the successfully matched fields.
[0120] In an optional embodiment of the present invention, for example, fields with a similarity greater than 80% (first similarity threshold) are identified as successfully matched, and fields with a similarity of 100% (second similarity threshold) are identified as completely matched fields.
[0121] In an optional embodiment of the present invention, the index weight value can be calculated using the following formula:
[0122] Q i =K / logN i
[0123] Among them, Q i The index weight value of the i-th field that is successfully matched, where K is the adjustment factor and N is the index weight value of the i-th field. i This represents the proportion of documents corresponding to the index of the i-th field that successfully matches.
[0124] Step 4: Perform weight boosting on the index weight value based on the Boolean query to obtain the standard data query request.
[0125] In this embodiment of the invention, Boolean query is a commonly used combined query in Elasticsearch. When multiple expressions are combined, that is, when multiple subqueries are combined into a Boolean expression, the logical relationship between all subqueries is AND, thereby improving the accuracy of data query.
[0126] Further, the step of performing weight boosting on the index weight value based on the Boolean query to obtain a standard data query request includes:
[0127] Construct subqueries based on the fields that are successfully matched, and summarize all subqueries to obtain the original Boolean query;
[0128] A weighted subquery is added to the original Boolean query based on the exact match field to obtain the standard data query request.
[0129] In an optional embodiment of the present invention, a Boolean query is used, and a weighted subquery is added to the exact match field within the Boolean query, thereby increasing the weight of the document retrieved by the corresponding index and making the corresponding document rank higher in the result score. For example, singleQuestionEs.title.keyword^10, where keyword^10 represents the increased weight.
[0130] Step 5: Use the standard data query request to perform a loop data query on the indexed document library to obtain the data query results.
[0131] In detail, the step of performing a cyclic data query on the indexed document library using the standard data query request to obtain data query results includes:
[0132] The indexed document library is queried using the standard data query request to obtain the original recall results;
[0133] The index weight value is adjusted based on the original recall result, and the step of weight boosting the index weight value according to the Boolean query is returned until the preset recall requirements are met, and the standard recall result is obtained.
[0134] A preset number of data points are selected from the standard recall results as the data query results.
[0135] In one optional embodiment of the present invention, after obtaining the search statement through a Boolean query, a search request is initiated, the recall results are observed and recorded, and the K adjustment factor is adjusted according to the recall results, thereby adjusting the index weight values until the recall results contain documents that can be recalled when each index is searched individually (i.e., the preset recall requirements). The top 20 data entries are selected as the data query results. Therefore, by dynamically adjusting the weights of each index according to the amount of data under different indexes and the number of documents that match exactly during data query, the recall rate of the search can be improved, thereby improving the accuracy of the data query.
[0136] This invention constructs an index document library based on the data types in the dataset to be queried. The original data query request is then processed by marking fields to obtain a set of marked fields. The index weight value of each field in the marked field set is calculated based on the index document library. Furthermore, the index weight values are boosted using a Boolean query to obtain a standard data query request. When performing iterative data queries on the index document library using the standard data query request, the weight of the standard data query request can be dynamically adjusted based on the index weight values of each field in the marked field set, thereby improving the accuracy of data queries. Therefore, the data query device based on index weight boosting proposed in this invention can solve the problem of inaccurate data queries.
[0137] like Figure 5 The diagram shown is a structural schematic of an electronic device that implements the data query method based on index weight enhancement according to an embodiment of the present invention.
[0138] The electronic device may include a processor 10, a memory 11, a communication interface 12 and a bus 13, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as a data query program based on index weight enhancement.
[0139] The memory 11 includes at least one type of readable storage medium, such as flash memory, portable hard drive, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of an electronic device, such as a portable hard drive. In other embodiments, the memory 11 can be an external storage device of the electronic device, such as a plug-in portable hard drive, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc. Furthermore, the memory 11 can include both internal and external storage units of the electronic device. The memory 11 can be used not only to store application software and various types of data installed on the electronic device, such as the code of a data query program based on index weight enhancement, but also to temporarily store data that has been output or will be output.
[0140] In some embodiments, the processor 10 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 10 is the control unit of the electronic device, connecting various components of the entire electronic device through various interfaces and lines. It executes programs or modules stored in the memory 11 (e.g., data query programs based on index weight enhancement) and calls data stored in the memory 11 to perform various functions of the electronic device and process data.
[0141] The communication interface 12 is used for communication between the aforementioned electronic device and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a Wi-Fi interface, Bluetooth interface, etc.), typically used to establish communication connections between the electronic device and other electronic devices. The user interface may be a display, an input unit (such as a keyboard), or, optionally, a standard wired or wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen, etc. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the electronic device and to display a visual user interface.
[0142] The bus 13 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus 13 can be divided into an address bus, a data bus, a control bus, etc. The bus 13 is configured to enable communication between the memory 11 and at least one processor 10, etc.
[0143] Figure 5 Only electronic devices with components are shown; it will be understood by those skilled in the art that... Figure 5 The structure shown does not constitute a limitation on the electronic device and may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0144] For example, although not shown, the electronic device may also include a power supply (such as a battery) to power the various components. Preferably, the power supply can be logically connected to the at least one processor 10 through a power management device, thereby enabling functions such as charging management, discharging management, and power consumption management. The power supply may also include one or more DC or AC power supplies, recharging devices, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be described in detail here.
[0145] Furthermore, the electronic device may also include a network interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a Wi-Fi interface, a Bluetooth interface, etc.), which is typically used to establish communication connections between the electronic device and other electronic devices.
[0146] Optionally, the electronic device may further include a user interface, which may be a display, an input unit (such as a keyboard), and optionally, a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen, etc. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the electronic device and to display a visual user interface.
[0147] It should be understood that the embodiments described are for illustrative purposes only and are not limited to this structure in the scope of the patent application.
[0148] The data query program based on index weight boosting stored in the memory 11 of the electronic device is a combination of multiple instructions, which, when run in the processor 10, can achieve the following:
[0149] Obtain the data set to be queried, and construct an indexed document library based on the data types in the data set to be queried;
[0150] Obtain the original data query request, and perform field marking processing on the original data query request to obtain a set of marked fields;
[0151] Calculate the index weight value of each field in the set of marked fields based on the indexed document library;
[0152] The index weight value is boosted based on the Boolean query to obtain a standard data query request;
[0153] The standard data query request is used to perform a loop query on the indexed document library to obtain the data query results.
[0154] Specifically, the specific implementation method of the processor 10 for the above instructions can be referred to the description of the relevant steps in the corresponding embodiment of the accompanying drawings, and will not be repeated here.
[0155] Furthermore, if the modules / units integrated into the electronic device are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, or a read-only memory (ROM).
[0156] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor of an electronic device, can perform the following:
[0157] Obtain the data set to be queried, and construct an indexed document library based on the data types in the data set to be queried;
[0158] Obtain the original data query request, and perform field marking processing on the original data query request to obtain a set of marked fields;
[0159] Calculate the index weight value of each field in the set of marked fields based on the indexed document library;
[0160] The index weight value is boosted based on the Boolean query to obtain a standard data query request;
[0161] The standard data query request is used to perform a loop query on the indexed document library to obtain the data query results.
[0162] In the several embodiments provided by this invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.
[0163] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0164] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.
[0165] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0166] Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within the invention. No appended diagram markings in the claims should be construed as limiting the scope of the claims.
[0167] The embodiments of this invention can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that utilize digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0168] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0169] The blockchain referred to in this invention is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.
[0170] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in a system claim may also be implemented by a single unit or device through software or hardware. The term "second class" is used to indicate names and does not indicate any specific order.
[0171] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A data query method based on index weight enhancement, characterized in that, The method includes: Obtain the data set to be queried, and use the preset index mapping configuration to perform index mapping processing on the document word segmentation set in the data set to be queried, so that the index and the document word segmentation correspond one-to-one, and obtain the indexed document library; Obtain the original data query request, and perform field marking processing on the original data query request to obtain a set of marked fields; The document count corresponding to each index in the indexed document library is counted and its proportion to the total document count of all indexes is calculated. Based on the proportion, the index weight value of each field in the tag field set is calculated. The index weight value is weighted according to the Boolean query to obtain a standard data query request, including: constructing a subquery based on the successfully matched field, summarizing all subqueries to obtain the original Boolean query, and adding a weighted subquery based on the exactly matched field in the original Boolean query to obtain the standard data query request; The process of performing a cyclical data query on the indexed document library using the standard data query request to obtain data query results includes: querying the indexed document library using the standard data query request to obtain a raw recall result; adjusting the index weight value based on the raw recall result; and returning to the step of performing weight boosting processing on the index weight value according to Boolean query, until a preset recall requirement is met, to obtain a standard recall result; and selecting a preset number of data from the standard recall result as the data query result.
2. The data query method based on index weight enhancement as described in claim 1, characterized in that, Before performing index mapping processing on the document word segmentation set in the dataset to be queried using a preset index mapping configuration, the method further includes: The data documents in the dataset to be queried are segmented using a preset data query engine to obtain a document segmentation set. An index mapping configuration is constructed based on the data types in the document word segmentation set.
3. The data query method based on index weight enhancement as described in claim 1, characterized in that, The original data query request is subjected to field marking processing to obtain a set of marked fields, including: Parse the query keywords in the original data query request, perform character filtering on the query keywords, and obtain standard keywords; The set of marked fields is obtained by setting highlighted field tags based on the standard keywords.
4. The data query method based on index weight enhancement as described in claim 1, characterized in that, The calculation of the index weight value of each field in the set of marked fields based on the ratio value includes: The indexes in the indexed document library are matched using each field in the set of marked fields, and the index weight value of the successfully matched fields is calculated using a preset weight formula and the ratio value.
5. The data query method based on index weight enhancement as described in claim 4, characterized in that, The step of matching the indexes in the indexed document library using each field in the set of marked fields includes: Calculate the similarity between each field in the tag field set and the index in the indexed document library in sequence; Fields with similarity scores less than or equal to a preset first similarity threshold are determined to have failed to match. Fields with similarity greater than the first similarity threshold are determined to be successfully matched, and fields with similarity greater than or equal to a preset second similarity threshold are selected as fully matched fields from the successfully matched fields.
6. A data query device based on index weight enhancement, characterized in that, The device includes: The index document library construction module is used to obtain the data set to be queried, and to perform index mapping processing on the document word segmentation set in the data set to be queried using a preset index mapping configuration, so that the index and the document word segmentation correspond one-to-one, and thus obtain the index document library; The field tagging module is used to obtain the original data query request, perform field tagging processing on the original data query request, and obtain a set of tagged fields. The index weight enhancement module is used to count the number of documents corresponding to each index in the indexed document library and calculate its proportion to the total number of documents in all indexes. Based on the proportion, it calculates the index weight value of each field in the tag field set. It then performs weight enhancement processing on the index weight value according to a Boolean query to obtain a standard data query request, including: constructing a subquery based on the successfully matched fields, summarizing all subqueries to obtain an original Boolean query, and adding a weighted subquery based on the perfectly matched fields in the original Boolean query to obtain the standard data query request. The data query module is used to perform a cyclic data query on the indexed document library using the standard data query request to obtain data query results. The module includes: querying the indexed document library using the standard data query request to obtain the original recall results; adjusting the index weight value based on the original recall results; and returning to the step of performing weight boosting processing on the index weight value according to Boolean query, until the preset recall requirements are met, to obtain the standard recall results; and selecting a preset number of data from the standard recall results as the data query results.
7. An electronic device, characterized in that, The electronic device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the data query method based on index weight enhancement as described in any one of claims 1 to 5.
8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the data query method based on index weight enhancement as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Seat taking query method and device, and server
CN108664509A
Data set retrieval method and system
CN111026710A