Information retrieval method and device, computer equipment and storage medium
By obtaining preset syntax rules from the log service system to detect the query code information, the problem of syntax and logic detection under different languages is solved, and the efficiency and comprehensiveness of code information retrieval are improved.
Patent Information
- Application Number
- CN202410877667.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2025-12-30
AI Technical Summary
The log service system is unable to perform syntax and logic checks on search statements in different languages, resulting in low efficiency in code information retrieval.
By obtaining the preset syntax rules of the pending items, the query code information is subjected to syntax and logic checks, and exception prompt text is generated to assist in the correction of the code information.
It enables syntax and logic checks on query code information in multiple different languages, improving the efficiency and comprehensiveness of code information retrieval.
Smart Images

Figure CN121233618A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to an information retrieval method, apparatus, computer equipment, and storage medium. Background Technology
[0002] Log service systems can be used for log retrieval and log analysis. For example, users can enter search queries into the log service system to retrieve relevant code information and perform rapid analysis.
[0003] In related technologies, after a search query is entered into the log service system, the system only supports the recognition of search queries in some commonly used languages, such as Structured Query Language (SQL) and Search Processing Language (SPL). It does not support syntax and logic checks for search queries in other languages.
[0004] Therefore, in related technologies, log service systems cannot perform syntax and logic checks on search statements in different languages, resulting in low efficiency in retrieving code information. Summary of the Invention
[0005] This application provides an information retrieval method, apparatus, computer device, and storage medium, which can perform syntax and logic detection on query code information in multiple different languages, thereby improving the efficiency and comprehensiveness of code information retrieval.
[0006] According to one aspect of the embodiments of this application, an information retrieval method is provided, including:
[0007] Obtain the pending items selected in the client and determine the preset syntax rules corresponding to the pending items;
[0008] Obtain the query code information entered by the client for the pending matter;
[0009] The query code information is subjected to syntax and logic checks according to the preset syntax rules to obtain the logic check results;
[0010] When the logic detection result shows a logic anomaly, the target query code information where the logic anomaly occurred is determined from the query code information, and the anomaly information corresponding to the target query code information is obtained.
[0011] An error message text corresponding to the target query code information is generated based on the error information, and the error message text is displayed in the client.
[0012] According to one aspect of the embodiments of this application, an information retrieval device is provided, comprising:
[0013] The determination module is used to obtain the pending items selected in the client and determine the preset syntax rules corresponding to the pending items;
[0014] The acquisition module is used to acquire query code information input by the client for the pending matter;
[0015] The detection module is used to perform grammatical logic detection on the query code information according to the preset grammar rules, and obtain the logic detection result;
[0016] An anomaly acquisition module is used to determine the target query code information where the logical anomaly occurs from the query code information when the logic detection result shows a logical anomaly, and to acquire the anomaly information corresponding to the target query code information;
[0017] An error message module is used to generate an error message text corresponding to the target query code information based on the error information, and to display the error message text in the client.
[0018] In some implementations, the detection module includes a parsing submodule, an extraction submodule, a construction submodule, and a detection submodule;
[0019] The parsing submodule is used to perform lexical analysis on the query code information to determine multiple sub-query code information corresponding to the query code information;
[0020] The extraction submodule is used to extract lexical units from each subquery code information to obtain the lexical units corresponding to each subquery code information.
[0021] A submodule is constructed to build a syntax logic tree corresponding to the query code information based on the lexical unit;
[0022] The detection submodule is used to perform syntax and logic detection on the query code information according to the syntax logic tree and the preset syntax rules, and obtain the logic detection result.
[0023] In some implementations, a submodule is extracted for:
[0024] Determine the code structure corresponding to each subquery code information;
[0025] Lexical units are extracted from the code composition structure of each subquery code to obtain the lexical unit corresponding to each subquery code.
[0026] In some implementations, the detection submodule is used for:
[0027] Determine the tree node depth of each node in the syntax logic tree;
[0028] Arrange each node in ascending order of tree node depth to obtain the node arrangement order;
[0029] Based on the node arrangement order and the preset syntax rules, the lexical unit corresponding to each node is subjected to syntactic logic detection to obtain the logic detection result.
[0030] In some implementations, the detection submodule is used for:
[0031] The root node in the syntax logic tree is determined, and the target lexical unit corresponding to the root node is determined;
[0032] The target lexical unit matches the target preset grammar rule in the preset grammar rule;
[0033] Based on the node arrangement order and the target preset syntax rules, the lexical unit corresponding to each node is subjected to syntactic logic detection to obtain the logic detection result.
[0034] In some implementations, the exception acquisition module is used for:
[0035] Abnormal lexical units are identified based on the logical detection results;
[0036] The subquery code information corresponding to the abnormal lexical unit is determined as the target query code information;
[0037] The exception information corresponding to the target query code information is determined according to the preset syntax rules.
[0038] In some implementations, the exception notification module is used for:
[0039] Identify multiple sub-target query code information in the target query code information, and the sub-abnormal prompt text corresponding to each sub-target query code information;
[0040] Determine the code association information among the multiple sub-target query code information and the type information of each sub-target query code information, and determine the prompt priority of each sub-target query code information based on the code association information and the type information;
[0041] The sub-error message texts are arranged according to the priority of the prompts, and the error message text corresponding to the target query code information is generated.
[0042] In some implementations, the determining module is used for:
[0043] Determine the preset syntax configuration file associated with the pending items;
[0044] The preset syntax configuration file is analyzed to determine the preset syntax rules corresponding to the items to be processed.
[0045] In some implementations, the exception notification module is used for:
[0046] Traverse the exception information to determine the location of the exception code and the exception message corresponding to the target query code information;
[0047] Generate the exception message text corresponding to the target query code information based on the exception code location and the exception message.
[0048] In some implementations, the acquisition module is used for:
[0049] Obtain the initial code information input by the object in the client, and determine the information prompt rules corresponding to the preset syntax rules;
[0050] Generate a set of prompt code information corresponding to the initial code information according to the information prompting rules;
[0051] The target prompt code information selected by the object in the prompt code information set is determined, and the query code information corresponding to the pending item is generated based on the initial code information and the target prompt code information.
[0052] According to one aspect of the embodiments of this application, a computer-readable storage medium is provided, the computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to execute the information retrieval method provided in the embodiments of this application.
[0053] According to one aspect of the embodiments of this application, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the information retrieval method provided in the embodiments of this application.
[0054] According to one aspect of the embodiments of this application, a computer program product is provided, including a computer program or instructions, which, when executed by a processor, implement the information retrieval method provided in the embodiments of this application.
[0055] In this embodiment, the following steps are taken: First, the selected pending item in the client is obtained, and the preset syntax rules corresponding to the pending item are determined. Second, the query code information input by the client for the pending item is obtained. Third, the query code information is subjected to syntax logic detection according to the preset syntax rules to obtain the logic detection result. Fourth, when the logic detection result shows a logic exception, the target query code information with the logic exception is determined from the query code information, and the exception information corresponding to the target query code information is obtained. Fifth, an exception prompt text corresponding to the target query code information is generated based on the exception information and displayed on the client. Thus, when processing the corresponding pending item, the preset syntax rules corresponding to the pending item can be obtained, and the query code information can be subjected to syntax logic detection according to the preset syntax rules to determine whether there are syntax logic errors in the query code information. By obtaining the preset syntax rules in advance, syntax logic detection of query code information in multiple different languages can be achieved. When a syntax logic error occurs, a corresponding exception prompt text can be generated to assist in the correction of the query code information. Compared with related technologies that can only detect query code information in commonly used languages, this application achieves syntax logic detection of query code information in multiple different languages, improving the efficiency and comprehensiveness of code information retrieval.
[0056] Other features and advantages of this application will be set forth in the following description and will be apparent in part from the description or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the description, claims and drawings. Attached Figure Description
[0057] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0058] Figure 1 This is a schematic diagram of the system framework of the information retrieval method provided in the embodiments of this application;
[0059] Figure 2 This is a schematic diagram of a scenario for the information retrieval method provided in an embodiment of this application;
[0060] Figure 3 This is a flowchart illustrating the information retrieval method provided in an embodiment of this application;
[0061] Figure 4 This is a schematic diagram of a scenario for the prompt code information provided in an embodiment of this application;
[0062] Figure 5 This is a flowchart illustrating step 230 provided in an embodiment of this application;
[0063] Figure 6 This is a schematic diagram of the syntax logic tree provided in the embodiments of this application;
[0064] Figure 7 This is another schematic diagram of an information retrieval scenario provided in the embodiments of this application;
[0065] Figure 8 This is another schematic flowchart of the information retrieval method provided in the embodiments of this application;
[0066] Figure 9 This is a schematic diagram of the structure of the information retrieval device provided in the embodiments of this application;
[0067] Figure 10 This is a schematic diagram of the structure of the computer device provided in the embodiments of this application. Detailed Implementation
[0068] To enable those skilled in the art to better understand the solutions of this application, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0069] It is understood that in the specific implementation of this application, data such as code are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with relevant laws, regulations and standards.
[0070] It should be noted that while some processes described in the specification, claims, and accompanying drawings contain multiple steps that appear in a specific order, it should be clearly understood that these steps may not be performed in the order they appear herein, or may be performed in parallel. The step numbers are merely used to distinguish different steps and do not represent any particular order of execution. Furthermore, descriptions such as "first," "second," or "objective" in this document are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0071] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0072] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0073] Before providing a further detailed description of the embodiments of this disclosure, the terms and concepts used in these embodiments are explained, and they are subject to the following interpretations:
[0074] Structured Query Language (SQL) is a special-purpose programming language used for database querying and programming. It is used to access, query, update, and manage relational database systems. SQL is a high-level, non-procedural programming language that allows users to work on high-level data structures. It does not require users to specify how data is stored, nor does it require users to understand the specific data storage methods. Therefore, different database systems with completely different underlying structures can use the same SQL as an interface for data input and management. SQL statements can be nested, giving it great flexibility and powerful functionality.
[0075] Search Processing Language (SPL) is a domain-specific language used for processing and querying data. It is primarily used in fields such as search engines, data mining, and machine learning. SPL provides a concise and flexible way to express complex search and data processing tasks.
[0076] Cassandra Query Language (CQL) is a query language used to interact with the Apache Cassandra database. Cassandra is a highly scalable, distributed NoSQL database primarily used for online transaction processing (OLTP) scenarios. CQL provides a SQL-like syntax, allowing users to easily query and manipulate data in the Cassandra database.
[0077] A Domain Specific Language (DSL) is a programming language designed specifically for a particular scenario or domain. Unlike general-purpose programming languages (such as Python, Java, or C++), DSLs focus on solving problems within a specific domain. They typically have concise syntax and easy-to-understand semantics, enabling developers within that domain to write code more efficiently.
[0078] A log service system is a platform that provides a one-stop log data solution, supporting functions such as log collection, storage, processing, retrieval and analysis, consumption and delivery, dashboards, and alarms. These systems aim to help users efficiently manage and analyze log data, thereby improving the efficiency of problem localization and metric monitoring.
[0079] First, let's describe the technical problems existing in the relevant technologies:
[0080] Log service systems can be used for log retrieval and log analysis. For example, users can enter search queries into the log service system to retrieve relevant code information and perform rapid analysis.
[0081] In related technologies, after a search query is entered into a log service system, the system only supports the recognition of search queries in some commonly used languages, such as Structured Query Language and Search Processing Language. It does not support syntax and logic checks for search queries in other languages.
[0082] Therefore, in related technologies, log service systems cannot perform syntax and logic checks on search statements in different languages, resulting in low efficiency in retrieving code information.
[0083] To address the aforementioned technical issues, this application embodiment, when processing a corresponding pending matter, can acquire the preset syntax rules corresponding to the pending matter. The preset syntax rules are then used to perform syntax logic checks on the query code information, thereby determining whether the query code information contains syntax logic errors. By acquiring the preset syntax rules in advance, syntax logic checks on query code information in multiple different languages can be achieved. When a syntax logic error occurs, corresponding exception prompt text can be generated to assist in correcting the query code information. Compared to related technologies that can only detect query code information in commonly used languages, this application achieves syntax logic checks on query code information in multiple different languages, improving the efficiency and comprehensiveness of code information retrieval.
[0084] The information retrieval method, apparatus, computer equipment, and storage medium provided in the embodiments of this application will be described in detail below.
[0085] This application provides an information retrieval method, apparatus, computer device, and storage medium. Specifically, this application will describe the information retrieval apparatus from the perspective of the information retrieval device, which can be integrated into a computer device, and the computer device can be a server. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, 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, CDN, and big data and artificial intelligence platforms. This application can be applied to various scenarios, including but not limited to cloud technology and artificial intelligence.
[0086] Please see Figure 1 , Figure 1 This is a schematic diagram of the system framework of the information retrieval method provided in the embodiments of this application. The information retrieval method provided in the embodiments of this application can be applied to this system framework.
[0087] Please refer to the details. Figure 1 , Figure 1 This is a system architecture diagram of the information retrieval method provided in this application embodiment. It includes a terminal 140, an Internet 130, a gateway 120, a server 110, etc.
[0088] Server 110 can be a device that performs information retrieval methods.
[0089] Terminal 140 includes, but is not limited to, mobile phones, computers, smart voice interaction devices, smart home appliances, vehicle terminals, and aircraft. This application embodiment can be applied to various scenarios, including but not limited to cloud technology and artificial intelligence. Furthermore, it can be a single device or a collection of multiple devices. For example, multiple desktop computers connected to each other via a local area network, sharing a single monitor, etc., can work collaboratively to form a terminal 140. Terminal 140 can communicate with the Internet 130 via wired or wireless means to exchange data.
[0090] Server 110 refers to a computer system that can provide certain services to terminal 140. Compared to ordinary terminal 140, server 110 has higher requirements in terms of stability, security, and performance. Server 110 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides 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, CDN, and big data and artificial intelligence platforms.
[0091] Gateway 120, also known as an internetwork connector or protocol converter, is a computer system or device that acts as a translator, enabling network interconnection at the transport layer. It bridges the gap between two systems using different communication protocols, data formats, languages, or even completely different architectures. Gateways can also provide filtering and security functions. Messages sent from terminal 140 to server 110 are forwarded to the corresponding server 110 via gateway 120. Messages sent from server 110 to terminal 140 are also forwarded to the corresponding terminal 140 via gateway 120.
[0092] The information retrieval method in this application can be applied in various scenarios, such as database maintenance, log services, and information security. This application does not impose any limitations on the scenarios in which the information retrieval method in this application can be used.
[0093] Please see Figure 2 , Figure 2 This is a schematic diagram illustrating an application scenario of the information retrieval method provided in the embodiments of this application.
[0094] The log service system can include various functions, such as log querying, code querying, and code writing. The log service system has a corresponding client page where users can select corresponding pending tasks, such as pending task 1, pending task 2, pending task 3, and so on, up to pending task N. Each pending task has its own preset syntax rules, which contain the syntactic logic of a programming language. The language corresponding to the preset syntax rules can be a commonly used programming language, such as a structured query language or a search processing language. Alternatively, the language can be a custom programming language, i.e., a programming language created through its own understanding and possessing corresponding language logic.
[0095] like Figure 2 As shown, when the object selects item 1 to be processed, the preset syntax rules corresponding to item 1 can be called. For example, the preset syntax configuration file of item 1 to be processed can be determined in the database, and then the preset syntax configuration file can be analyzed to obtain the preset syntax rules of item 1 to be processed.
[0096] The user can enter corresponding input content in the input box of "Pending Item 1," such as query code information. The system can then retrieve the query code information entered by the client for the pending item. This query code information can be a retrieval statement used to query information in the database, or a code statement used to write code functionality.
[0097] Then, the query code information can be subjected to syntax and logic checks according to preset syntax rules to obtain logic check results. For example, the syntax and logic of the query code information can be compared with the syntax and logic in the preset syntax rules to determine whether there are errors in the syntax and logic of the query code information, thereby obtaining logic check results.
[0098] When the logic detection result shows a logic anomaly, the target query code information where the logic anomaly occurred is determined from the query code information, and the corresponding anomaly information is obtained; based on the anomaly information, an anomaly message text corresponding to the target query code information is generated and displayed on the client. For example... Figure 2 As shown, the client can display the location and cause of errors in the query code information. This helps the user quickly query and modify the code based on the exception message text, thereby obtaining the query code information with correct syntax and logic. Finally, information retrieval can be performed using the query code information with correct syntax and logic, such as retrieving code information from databases or log files in logs.
[0099] As can be seen from the above, in this embodiment of the application, by using the preset syntax rules corresponding to the items to be processed, it is possible to perform syntax logic detection on the corresponding query code information, thereby improving the retrieval efficiency of query code information.
[0100] It should be noted that the scenarios exemplified above are only a part of the examples. The information retrieval method provided in this application embodiment can also be applied to other scenarios, and no restrictions are imposed here.
[0101] Please see Figure 3 , Figure 3 This is a flowchart illustrating the information retrieval method provided in this application embodiment. The executing entity of this information retrieval method can be a server, and the information retrieval method may include the following steps:
[0102] Step 210: Obtain the pending items selected in the client and determine the preset syntax rules corresponding to the pending items;
[0103] Step 220: Obtain the query code information entered in the client for the pending item;
[0104] Step 230: Perform syntax and logic checks on the query code information according to preset syntax rules to obtain the logic check results;
[0105] Step 240: When the logic detection result shows a logic anomaly, determine the target query code information where the logic anomaly occurred from the query code information, and obtain the anomaly information corresponding to the target query code information;
[0106] Step 250: Generate the exception message text corresponding to the target query code information based on the exception information, and display the exception message text in the client.
[0107] Steps 210 to 250 will be described in detail below.
[0108] In step 210, the pending items selected in the client are obtained, and the preset syntax rules corresponding to the pending items are determined.
[0109] It should be noted that the mapping relationship between pending items and preset syntax rules can be set in advance. For example, the pending item "log query" can be mapped to the preset syntax rules of the structured query language, and the pending item "processing function" can be mapped to the preset syntax rules of the custom language.
[0110] The client can provide a variety of pending items. When an object selects the corresponding pending item, the server can implement the corresponding service based on the pending item. For example, pending items can include "log query", "code query", "processing function" and other items.
[0111] Once the object selects the corresponding pending item, it can obtain the selected pending item sent by the client, and then determine the programming language required for the pending item based on the mapping rules between the pending item and the programming language, and then determine the preset syntax rules corresponding to the programming language.
[0112] The programming language can be a general-purpose programming language commonly used by programmers, such as a structured query language or a search processing language. It can also be a custom programming language defined by the object, such as a domain-specific language. Each programming language has corresponding syntax rules, including specific syntactic logic. In this way, the server can quickly find the preset syntax rules related to the task at hand and then provide subsequent syntax logic checking services based on those rules.
[0113] For example, taking the pending items "log query", "code query" and "processing function" as examples, the pending item "log query" corresponds to a first programming language. The first programming language can be a user-defined programming language or an existing programming language, such as Java or C. Each programming language has corresponding syntax rules, which can be used to express syntactic logic for programming and subsequent calculation, compilation and execution. Thus, the first programming language corresponds to a first preset syntax rule. The first preset syntax rule contains a first syntax logic. The first syntax logic can realize the expression and detection of syntactic logic on the input characters, thereby guiding the computer program to execute the corresponding function according to the input characters, so as to realize the processing of the pending item "log query".
[0114] The pending item "code query" corresponds to a second programming language. The second programming language can be a custom programming language or an existing programming language. The second programming language corresponds to a second preset syntax rule. The second preset syntax rule contains a second syntax logic. The second syntax logic can express and detect the syntax logic of the input characters, thereby guiding the computer program to perform the corresponding function according to the input characters, so as to realize the processing of the pending item "code query".
[0115] The pending item "processing function" corresponds to a third programming language. The first programming language can be a custom programming language or an existing programming language. The third programming language corresponds to a third preset syntax rule. The third preset syntax rule contains a third syntax logic. The third syntax logic can realize the syntax logic expression and syntax logic detection of the input characters, thereby guiding the computer program to execute the corresponding function according to the input characters, so as to realize the processing of the pending item "processing function".
[0116] It should be noted that the first grammatical logic, the second grammatical logic, and the third grammatical logic are different; therefore, the first preset grammatical rule, the second preset grammatical rule, and the third preset grammatical rule are also different. Preset grammatical rules can be understood as the reference criteria for expressing and checking the grammatical logic of the input characters to be processed.
[0117] In some implementations, the pending items selected by the client are obtained, and the preset syntax rules corresponding to the pending items are determined, including:
[0118] (1.1) Determine the default syntax configuration file associated with the pending items;
[0119] (1.2) Analyze the preset syntax configuration file to determine the preset syntax rules corresponding to the items to be processed.
[0120] For example, by obtaining the preset syntax configuration file associated with the pending item, which contains preset syntax rules and other configuration files, the preset syntax rules corresponding to the pending item can be determined by analyzing the preset syntax configuration file.
[0121] Taking the selected pending task as "log query" as an example, the associated preset syntax configuration file can be determined as the first preset syntax configuration file based on the pending task "log query". By parsing the first preset syntax configuration file, the first preset syntax rules can be determined. The first preset syntax rules contain the first syntax logic. Through the first syntax logic, the input code can be expressed and checked in terms of syntax logic, thereby guiding the computer to execute the pending task "log query" according to the input code, and realizing the query of a certain target log data.
[0122] The preset grammar configuration file also includes other configuration files, such as the lexical analysis file and syntax analysis file corresponding to the preset grammar rule. The lexical analysis file is used to parse the lexical information in the subsequent input query code information to obtain lexical units, and the syntax analysis file is used to construct the syntax logic tree of the query code information based on the lexical units. These will be described in detail later.
[0123] In step 220, the query code information entered by the client for the pending matter is obtained.
[0124] Among them, querying code information can be used to retrieve relevant information from the database, such as code information, log information, etc. Querying code information can also be used to retrieve relevant information about writing code functions, such as the function call function of the input code.
[0125] In some implementations, the onChange event in the client-side page can be detected. The onChange event is a common JavaScript event used to detect changes in HTML form elements (such as...). <input> , <select>、< / select> <textarea> The `onChange` event is triggered when the value of an element changes. The `onChange` event is triggered when a user interacts with these elements (e.g., enters text in a text box, selects an option from a dropdown list, or enters text in a text area). When the `onChange` event is triggered, the query code information entered by the object on the client side can be obtained.< / textarea>
[0126] In some implementations, obtaining query code information entered by the client for the pending matter includes:
[0127] (1.1) Obtain the initial code information entered by the object in the client and determine the information prompt rules corresponding to the preset syntax rules;
[0128] (1.2) Generate a set of prompt code information corresponding to the initial code information according to the information prompt rules;
[0129] (1.3) Determine the target prompt code information selected by the object in the prompt code information set, and generate the query code information corresponding to the pending item based on the initial code information and the target prompt code information.
[0130] The object can make initial input in the input box of the client to obtain initial code information. During the process of the object inputting initial code information, the information prompting rules corresponding to the preset syntax rules are determined. The information prompting rules can be understood as the information prompting rules used to prompt the input code. The information prompting rules are related to the preset syntax rules. Because the syntax logic of different preset syntax rules is different, the information prompting rules of different preset syntax rules are also different.
[0131] In this way, by generating corresponding prompt code information through information prompt rules, it is beneficial for the object to quickly input in the input box of the item to be processed. It is also beneficial for reminding the object of some correct input methods and parameter details, which helps the object to input query code information with correct syntax and logic, and can improve the retrieval efficiency of query code information.
[0132] Please refer to the following: Figure 4 , Figure 4 This is a schematic diagram of a scenario for the prompt code information provided in the embodiments of this application.
[0133] For example, when a user enters an initial code, the initial code information is "parse_int". At this time, the "parse_int" information prompt rules can be matched to determine multiple prompt code information corresponding to the initial code information. These prompt code information are collected as a set of prompt code information and then displayed on the client interface. This is how the prompt code information can be displayed.
[0134] Then, the object can select the target hint code from the displayed hint code information. For example, if the selected target hint code is "parse_int(value, sep)", then the target hint code can be entered into the input box. Combining the initial code information and the target hint code information, the query code information is generated. For example, "(value, sep)" from the target hint code information is filled after the initial code information "parse_int" to generate the query code information "parse_int(value, sep)".
[0135] It should be noted that some suggestion codes cannot be selected in the suggestion code information set, such as "Value, required parameter". This suggestion code information is mainly for reminder purposes, not for input purposes.
[0136] In some implementations, after generating the set of prompt code information corresponding to the initial code information according to the prompt rules, the method further includes:
[0137] (1.2.1) Determine the display priority of each prompt code in the prompt code information set;
[0138] (1.2.2) Sort the prompt code information from high to low according to the display priority to obtain the sorting result;
[0139] (1.2.3) Display at least some of the prompt code information in the client based on the sorting results.
[0140] For example, in a set of tooltip codes, some tooltip codes can be selected by an object and have a higher display priority, while others cannot be selected and have a lower display priority. Alternatively, some tooltip codes have shorter character lengths and higher display priority, while others have longer character lengths and lower display priority.
[0141] After determining the display priority of each prompt code, the prompt codes can be sorted from high to low according to their display priority. Then, the part with higher display priority can be selected from the sorted result and displayed in the client.
[0142] As can be seen from the above, displaying different suggestion codes by prioritizing them helps the user see more relevant suggestion codes, select the suggested code, and combine it with the initial code information to generate query code information, thereby improving the efficiency of query code generation and the correctness of the query code's syntax and logic.
[0143] In step 230, the query code information is subjected to syntax logic detection according to preset syntax rules to obtain the logic detection result.
[0144] The preset syntax rules include corresponding syntax logic, such as the logical relationships between path characters and other path characters in the code, the logical relationships between class characters and other class characters in the code, and the logical relationships between function characters and variable characters in the code. Therefore, the preset syntax rules can detect the syntax logic in the queried code information, thereby determining whether there are logical errors in the syntax logic of the queried code information, and obtaining the logic detection results.
[0145] Please refer to the following: Figure 5 , Figure 5 This is a flowchart illustrating step 230 provided in the embodiments of this application.
[0146] In some implementations, the query code information is subjected to syntax and logic checks according to preset syntax rules to obtain logic check results, including:
[0147] Step 301: Perform lexical analysis on the query code information to determine the multiple sub-query code information corresponding to the query code information;
[0148] Step 302: Extract lexical units from each subquery code information to obtain the lexical units corresponding to each subquery code information;
[0149] Step 303: Construct the syntax logic tree corresponding to the query code information based on the lexical units;
[0150] Step 304: Perform syntax and logic checks on the query code information based on the syntax logic tree and preset syntax rules to obtain the logic check results.
[0151] Steps 301 to 304 will be described in detail below.
[0152] In step 301, lexical analysis is performed on the query code information to determine multiple sub-query code information corresponding to the query code information.
[0153] A lexical analyzer can be constructed from a lexical analysis file. A lexical analyzer can be understood as a programming tool used to decompose an input string (such as source code) into lexical units (tokens). A lexical unit is a basic unit used to represent a meaningful element in source code or a text stream. The lexical analyzer can further decompose subquery code information into a series of tokens, each token representing a lexical unit with specific meaning. The lexical units corresponding to the query code information can then be used to construct the syntax logic tree of the query code information. The lexical analyzer performs lexical analysis on the query code information. During the analysis, special symbols, such as delimiters, can be identified in the query code information, enabling the separation of different code segments within the query code information. After separation using these special symbols, multiple subquery code segments are obtained. Each subquery code segment can be understood as a part of the query code information, or a piece of code. Further processing can then be performed on these subquery code segments.
[0154] Alternatively, by identifying certain keywords in the query code information, and then using these keywords to separate the query code information, multiple sub-query code information corresponding to the query code information can be obtained.
[0155] The lexical parser can also extract lexical units from the subquery code information.
[0156] In step 302, lexical units are extracted from each subquery code information to obtain the lexical units corresponding to each subquery code information.
[0157] Understandably, not all characters in a piece of code need to be extracted using lexical units, as this would waste a lot of computational resources and time. Therefore, it is more effective to extract some keywords that are mainly related to the grammar. For example, in everyday Chinese, there are subjects, predicates, and objects. By extracting the keywords corresponding to the subject, predicate, and object respectively, the grammatical logical structure of a sentence can be clearly understood.
[0158] In some implementations, lexical unit extraction is performed on each subquery code information to obtain the lexical unit corresponding to each subquery code information, including:
[0159] (1.1) Determine the code structure corresponding to each subquery code information;
[0160] (1.2) Extract lexical units from the code information of each subquery based on the code composition structure to obtain the lexical units corresponding to each subquery code information.
[0161] Understandably, a code segment contains a corresponding code structure. This structure can be analyzed to determine the code structure corresponding to each subquery. For example, given a code structure that includes a main function, calling functions, and declarations, the code structure can be generated from these components.
[0162] In a code snippet, code structure refers to the way the code is organized and arranged. It defines how the program is broken down into manageable parts and specifies the relationships between these parts. For example, code structure includes conditional statements (such as if-else), loop statements (such as for and while), and branching statements (such as switch), which determine the program's execution flow.
[0163] After obtaining the code structure, some structural keywords are extracted from the code structure, such as the main function name and the calling function name. Then, a corresponding lexical unit is generated for each structural keyword, thus obtaining the lexical unit corresponding to each subquery code information.
[0164] It should be noted that a lexical unit can be understood as an abstract representation of subquery code information, which retains the lexical structure of the subquery code information. These lexical structures can then form the syntactic structure of the query code information.
[0165] As described above, by determining the code structure corresponding to each subquery code information, and extracting lexical units from each subquery code information based on the code structure, the lexical units corresponding to each subquery code information are obtained. This allows for the removal of some useless characters while preserving the lexical structure, thus facilitating the rapid construction of the syntax logic tree corresponding to the query code information.
[0166] In step 303, a syntax logic tree corresponding to the query code information is constructed based on the lexical unit.
[0167] After obtaining the lexical units, different lexical units can be set in different logic tree nodes. For example, the lexical units can be set in different logic tree nodes according to their arrangement order. The earlier the lexical unit is, the shallower the depth of its corresponding logic tree node, and the later the lexical unit is, the deeper the depth of its corresponding logic tree node.
[0168] By placing all lexical units into their respective logic tree nodes, a syntax logic tree corresponding to the query code information is constructed. Each logic tree node corresponds to one lexical unit, and edges exist between logic tree nodes, which can be understood as the associations between lexical units. The syntax logic tree is a representation of the syntactic structure of the query code information, reflecting its syntactic logic.
[0169] Please refer to the following: Figure 6 , Figure 6 This is a schematic diagram of the syntax logic tree provided in the embodiments of this application.
[0170] In this example, assuming the query code is "var average=(min+max) / 2", parsing this query code yields multiple lexical units. These lexical units include "average", " / ", "+", "2", "max", and "min". A syntax logic tree is then constructed based on these lexical units. The root node corresponds to the lexical unit "average", the nodes at the second depth correspond to the lexical unit " / ", and other lexical units are sequentially placed in their respective logic tree nodes. Using this syntax logic tree, the grammatical logic for writing the corresponding syntax can be determined.
[0171] In some implementations, a syntax parser can also be generated from a syntax parsing file. The syntax parser is a key component of a compiler or interpreter, responsible for converting the sequence of lexical units generated by the lexical parser into an abstract syntax tree (AST) representing the program structure, which is the syntax logic tree constructed by lexical units in the embodiments of this application.
[0172] In step 304, the query code information is subjected to syntax logic detection based on the syntax logic tree and preset syntax rules to obtain the logic detection result.
[0173] After obtaining the syntax logic tree corresponding to the query code information, the query code information can be subjected to syntax logic checks based on the syntax logic tree and preset syntax rules. For example, the lexical units of each logic tree node in the syntax logic tree can be checked to obtain the logic check results.
[0174] In some implementations, the query code information is subjected to syntax and logic checks based on the syntax logic tree and preset syntax rules to obtain logic check results, including:
[0175] (2.1) Determine the depth of each node in the syntax logic tree;
[0176] (2.2) Arrange each node in ascending order of tree node depth to obtain the node arrangement order;
[0177] (2.3) Perform grammatical logic detection on the lexical unit corresponding to each node according to the node arrangement order and preset grammatical rules to obtain the logic detection result.
[0178] In the syntax tree, each node has a corresponding depth. For example, the root node has the smallest depth, and the depth of subsequent nodes increases progressively. Each node can be arranged in ascending order of depth to obtain the node arrangement. Finally, based on this arrangement, each node is traversed according to preset syntax rules to obtain the logic detection result.
[0179] Specifically, logical checks can be performed on the lexical units of each node by pre-setting grammatical rules, thereby determining whether each lexical unit has a grammatical or logical error, and thus obtaining the logical check results.
[0180] It's important to note that the node arrangement, based on ascending depth, is primarily chosen to address syntactic logic. For instance, in querying code information, earlier code often references or calls later functions. Therefore, the node depth is determined by the order and / or logic of code occurrence. By performing syntactic logic checks on the lexical units corresponding to each node according to this arrangement and predefined syntactic rules, the results can be obtained. This allows for a more accurate and efficient analysis of the query information, identifying code with syntactic or logical errors.
[0181] In some implementations, syntactic logic checks are performed on the lexical units corresponding to each node according to the node arrangement order and preset syntactic rules to obtain logic check results, including:
[0182] (2.3.1) Determine the root node in the syntax logic tree and the target lexical unit corresponding to the root node;
[0183] (2.3.2) Match the target preset grammar rule with the target lexical unit in the preset grammar rules;
[0184] (2.3.3) Perform grammatical logic detection on the lexical unit corresponding to each node according to the node arrangement order and the target preset grammatical rules to obtain the logic detection result.
[0185] It is understandable that a programming language may correspond to many preset syntax rules. Therefore, in the syntax logic tree corresponding to the query code information, the root node can be found, and then the target preset syntax rule can be matched in the preset syntax rules based on the target lexical unit of the root node. For example, by matching specific characters in the target lexical unit, the target preset syntax rule whose header contains that character can be found.
[0186] Finally, based on the node arrangement order and the target preset grammar rules, the lexical units corresponding to each node are subjected to grammatical logic checks to obtain the logic check results. In this way, the target preset grammar rule suitable for the syntax logic tree can be found among multiple preset grammar rules, thereby improving the efficiency of logic checks on the syntax logic tree.
[0187] As described in steps 301 to 304, in this embodiment, lexical analysis of the query code information is performed to determine multiple sub-query code information corresponding to the query code information; lexical units are extracted from each sub-query code information to obtain the lexical unit corresponding to each sub-query code information; a syntax logic tree corresponding to the query code information is constructed based on the lexical unit; and syntax logic detection is performed on the query code information based on the syntax logic tree and preset syntax rules to obtain the logic detection result. By traversing and detecting the syntax logic tree through preset syntax rules, the syntax logic in the query code information can be detected efficiently and accurately to obtain the logic detection result.
[0188] In step 240, when the logic detection result shows a logic anomaly, the target query code information where the logic anomaly occurred is determined from the query code information, and the anomaly information corresponding to the target query code information is obtained.
[0189] After performing syntax and logic checks on the query code information, if the logic check results show a logic exception, the target query code information where the logic exception occurs can be determined from the query code information. For example, if an abnormal code segment is identified in the query code information, it can be identified as the target query code information with the logic exception. Then, further exception analysis can be performed on the target query code information with the logic exception to obtain the exception information of the target query code information with the logic exception.
[0190] In some implementations, obtaining the exception information corresponding to the target query code information includes:
[0191] (1.1) Identify the abnormal lexical units based on the logic detection results;
[0192] (1.2) The subquery code information corresponding to the abnormal lexical unit is determined as the target query code information;
[0193] (1.3) Determine the exception information corresponding to the target query code information according to the preset syntax rules.
[0194] For example, the lexical unit whose logic detection result is abnormal can be directly located through the syntax logic tree. Then, the subquery code information corresponding to the abnormal lexical unit can be determined as the target query code information. For example, if there is a code snippet corresponding to the abnormal lexical unit, this code snippet can be determined as the target query code information.
[0195] Finally, based on preset syntax rules, the exception information corresponding to the target query code can be determined, such as the number of rows, columns, reference relationships, call relationships, and characters where errors occurred. This information can then be identified as exception information.
[0196] In step 250, an exception message text corresponding to the target query code information is generated based on the exception information, and the exception message text is displayed on the client.
[0197] The system allows for the creation of error messages, including information such as the row and column number where the error occurred, reference relationships, call relationships, and characters. Different colors can be used to emphasize different errors; for example, the row and column number can be displayed in yellow, reference relationships in red, and individual characters in purple. Finally, the error messages are sent to the client and displayed there.
[0198] In some implementations, an exception message text corresponding to the target query code information is generated based on the exception information, including:
[0199] (1.1) Traverse the exception information to determine the location of the exception code and the exception message corresponding to the target query code information;
[0200] (1.2) Generate the exception message text corresponding to the target query code information based on the exception code location and exception message.
[0201] For example, the location of the abnormal code and the abnormal message can be determined by the node depth of the abnormal lexical unit in ascending order. For example, the location of the abnormal code includes the row number and the column number, and the abnormal message includes the reason for the abnormality.
[0202] Then, based on the location of the exception code and the exception message, the exception message text corresponding to the target query code information is generated. For example, the exception message text corresponding to the target query code information is "Exception location, row X, column Y, exception reason, character spelling error". For another example, the exception message text corresponding to the target query code information is "Exception location, row Xx, column Yy, exception reason, call error".
[0203] In this way, the code that caused the exception can be quickly located in the query code information, and an exception message text can be generated. This can help the object to correct the query code information and then use the corrected query code information to retrieve information.
[0204] In some implementations, an exception message text corresponding to the target query code information is generated based on the exception information, including:
[0205] (2.1) Determine multiple sub-target query code information in the target query code information, and the sub-exception prompt text corresponding to each sub-target query code information;
[0206] (2.2) Determine the code association information between multiple sub-target query code information and the type information of each sub-target query code information, and determine the prompt priority of each sub-target query code information based on the code association information and the type information;
[0207] (2.3) Arrange the sub-exception message texts according to the priority of the prompts, and generate the exception message text corresponding to the target query code information.
[0208] There may be multiple anomalies in the target query code information. Multiple sub-target query code information can be identified in the target query code information, and then the sub-anomaly prompt text corresponding to each sub-target query code information can be determined.
[0209] Then, the code association information between multiple sub-target query code information and the type information of each sub-target query code information are determined. For example, the code association information between some sub-target query code information can be a reference relationship, a call relationship, an inclusion relationship, etc. For example, the type information of sub-target query code information can be various types such as main function, sub-function, header declaration, etc.
[0210] Based on code association and type information, it's possible to identify sub-target query code information that has a significant impact on syntax and logic from multiple sub-target query code information. For example, the main function type and actively called sub-target query code information have a greater impact on syntax and logic, and can be given a higher priority for suggestion. Sub-function type and passively called sub-target query code information have a smaller impact on syntax and logic, and can be given a lower priority for suggestion.
[0211] Finally, the sub-exception message texts of the sub-target query code information are arranged in descending order of priority, and the exception message text corresponding to the target query code information is generated.
[0212] This allows error messages that significantly impact syntax and logic to be displayed first, enabling users to quickly correct syntax errors in the query code and obtain syntactically correct query code. Using syntactically correct query code leads to faster retrieval of desired information, thus improving information retrieval efficiency.
[0213] In some implementations, within the log service system, in addition to existing pending items, new pending items will appear as business develops or projects progress. For each new pending item, the target programming language can be determined. Then, all saved preset syntax configuration files are identified, and the programming language corresponding to each preset syntax configuration file is determined. If any programming language matches the target programming language, the new pending item can be directly associated with the preset syntax configuration file corresponding to the matching programming language. Subsequently, when processing new pending items, preset syntax rules can be obtained directly by analyzing the corresponding preset syntax configuration file. These preset syntax rules are then used to perform syntax logic checks on the query code information of the new pending items. This eliminates the need to set preset syntax configuration files for new pending items, thereby improving the efficiency of syntax logic checks on the query code information of new pending items.
[0214] As described above, in this embodiment, the following steps are taken: First, the selected pending item in the client is obtained, and the corresponding preset syntax rules are determined. Second, the query code information input by the client for the pending item is obtained. Third, the query code information is subjected to syntax logic detection according to the preset syntax rules to obtain the logic detection result. Fourth, when the logic detection result shows a logic error, the target query code information with the logic error is determined from the query code information, and the corresponding error information is obtained. Fifth, an error message text corresponding to the target query code information is generated based on the error information and displayed on the client. Thus, when processing a pending item, the preset syntax rules corresponding to the pending item can be obtained, and the query code information can be subjected to syntax logic detection according to the preset syntax rules to determine whether there are syntax logic errors in the query code information. By pre-obtaining the preset syntax rules, syntax logic detection of query code information in multiple different languages can be achieved. When a syntax logic error occurs, a corresponding error message text can be generated to assist in correcting the query code information. Because the detection tools provided in related technologies only include a few commonly used programming languages, they cannot support queries in different languages, nor can they perform syntax and logic checks on query code information in custom programming languages. Even if custom programming languages are supported, rapid syntax and logic checks on query code information in custom programming languages cannot be achieved. Compared to related technologies, this application can quickly construct a syntax logic tree corresponding to the query code information by using preset syntax rules, lexical analysis files, and syntax analysis files contained in a preset syntax configuration file. This allows for rapid and accurate syntax and logic checks on the query code information, rather than simply relying on configuration files to support different programming languages. As a result, this application can perform syntax and logic checks on query code information in multiple different languages, improving the efficiency and comprehensiveness of code information retrieval.
[0215] Additionally, it should be noted that in this application, by performing syntax and logic checks on the query code information, the correctness of the input query code information can be guaranteed, thereby ensuring that the database will not run erroneous code for log queries or function writing, thus ensuring the security of the code in the database.
[0216] Please continue reading. Figure 7 , Figure 7 This is a schematic diagram of another information retrieval scenario provided in the embodiments of this application.
[0217] In this embodiment, the description can be performed from the server's perspective. Figure 7The content shown refers to virtual devices or virtual data used by the server for data processing. In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program with a predetermined function, which works together with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0218] The information retrieval method provided in this application embodiment is mainly applied in two components, which are virtual components for performing data processing. One is a basic component, and the other is a language parsing component. The basic component can be understood as being in one server, while the language parsing component is in another server. The basic component and the language parsing component can be understood as two tools that work together.
[0219] The basic component can be a code editor that runs in a browser environment. This basic component provides rich editor features and syntax highlighting, intelligent suggestions, code folding, and code completion for various languages. It also boasts high scalability and flexibility, making it easier for developers to write code remotely. Figure 7 The core editor of the underlying components in the software is used to implement these functionalities. These underlying components can be tools like the Monaco Editor.
[0220] The basic components also include a basic language service module, which provides services for basic programming languages, such as syntax analysis. The basic components also include a syntax detection module, which performs syntax logic checks on the query code information input by the client to obtain a syntax logic tree. The basic components also include an exception detection module, used to detect abnormal syntax logic in the syntax logic tree. Finally, the basic components include a diagnostic module, which can be used to diagnose the query code information input by the user.
[0221] It should be noted that when processing pending matters, if the programming language corresponding to the pending matter is supported by the basic components, the basic components can execute the information retrieval method provided in this application embodiment. If the programming language corresponding to the pending matter is not supported by the basic components, the basic components need to call the language parsing component to assist in processing.
[0222] Specifically, when the basic components call the language parsing component, they can do so through a thread manager. This thread manager can utilize Web Worker technology, a browser technology that enables script operations to run in a background thread independent of the web application's main execution thread. The advantage of this is that time-consuming processing tasks can be executed in a separate thread, preventing the main thread (usually the UI thread) from being blocked or slowed down.
[0223] The language parsing component can retrieve the preset syntax configuration file associated with the pending task. This file is then parsed to obtain a lexical parsing file, a syntax parsing file, and preset syntax rules. The lexical parsing file can be used to generate a lexical parser. The lexical parser performs lexical analysis on the query code information, identifying multiple sub-query codes corresponding to the query code. Then, it extracts lexical units from each sub-query code to obtain the corresponding lexical units. The syntax parsing file can be used to generate a syntax parser, which constructs a syntax logic tree corresponding to the query code information based on the lexical units.
[0224] The lexical analyzer and syntax analyzer can be generated by a parser generator based on the parsed file. For example, a parser generator can generate a lexical analyzer based on a lexical parsing file and a syntax analyzer based on a syntax parsing file. Specifically, the parser generator can be the Antlr tool, a powerful parser generator used to read, process, execute, and translate structured text or binary files. It is widely used in building compilers, interpreters, code generators, and other tools.
[0225] The AntLR tool works by describing the language to be recognized based on a specification called a grammar. The grammar describes the syntactic structure and lexical rules of the language, specifying how to recognize and process language elements by defining production rules. AntLR generates a parser and a lexer based on the given grammar, used to parse the input text or data stream into an Abstract Syntax Tree (AST), also known as a syntax tree. Further processing, such as syntax analysis, code generation, or other target operations, can then be performed based on the AST.
[0226] The language parsing component can send the syntax logic tree to the base component, which can then call the corresponding modules for further processing. For example, it can perform syntax and logic checks on the query code information based on the syntax logic tree and preset syntax rules to obtain the logic check results. When the logic check results show a logic exception, it can determine the target query code information where the logic exception occurred from the query code information and obtain the exception information corresponding to the target query code information. Based on the exception information, it can generate the exception prompt text corresponding to the target query code information and display the exception prompt text on the client.
[0227] As can be seen from the above, in this embodiment of the application, syntax and logic detection can be performed on query code information in multiple different languages to obtain logic detection results. When a logic error occurs in the query code information, an exception prompt text can be generated based on the logic detection results to assist in correcting the query code information and improve the retrieval efficiency of code information.
[0228] Please continue reading. Figure 8 , Figure 8 This is another flowchart illustrating the information retrieval method provided in this application embodiment.
[0229] Step 501: Obtain the pending items selected in the client and determine the preset syntax rules corresponding to the pending items;
[0230] Step 502: Obtain the initial code information entered by the object in the client and determine the information prompt rules corresponding to the preset syntax rules;
[0231] Step 503: Generate a set of prompt code information corresponding to the initial code information according to the information prompt rules;
[0232] Step 504: Determine the target prompt code information selected by the object in the prompt code information set, and generate the query code information corresponding to the pending item based on the initial code information and the target prompt code information;
[0233] Step 505: Perform lexical analysis on the query code information to determine multiple sub-query code information corresponding to the query code information;
[0234] Step 506: Extract lexical units from each subquery code information to obtain the lexical units corresponding to each subquery code information;
[0235] Step 507: Construct the syntax logic tree corresponding to the query code information based on the lexical units;
[0236] Step 508: Perform syntax and logic checks on the query code information based on the syntax logic tree and preset syntax rules to obtain the logic check results;
[0237] Step 509: When the logic test result shows a logic anomaly, determine the abnormal lexical unit based on the logic test result;
[0238] Step 510: Determine the subquery code information corresponding to the abnormal lexical unit as the target query code information;
[0239] Step 511: Determine the exception information corresponding to the target query code information according to the preset syntax rules;
[0240] Step 512: Traverse the exception information to determine the location of the exception code and the exception message corresponding to the target query code information;
[0241] Step 513: Generate the exception message text corresponding to the target query code information based on the exception code location and exception message.
[0242] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the detailed description of the information retrieval method above, which will not be repeated here.
[0243] Please continue reading. Figure 9 , Figure 9 This is a schematic diagram of the structure of an information retrieval device provided in an embodiment of this application. This information retrieval device is used to execute the information retrieval method described above.
[0244] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0245] like Figure 9 As shown, the information retrieval device may include:
[0246] The determination module 510 is used to obtain the pending items selected in the client and determine the preset syntax rules corresponding to the pending items;
[0247] The acquisition module 520 is used to acquire query code information entered by the client for the pending item;
[0248] The detection module 530 is used to perform syntax and logic detection on the query code information according to preset syntax rules and obtain the logic detection results.
[0249] The exception acquisition module 540 is used to determine the target query code information where the logic exception occurred from the query code information when the logic detection result shows a logic exception, and to obtain the exception information corresponding to the target query code information.
[0250] The exception prompt module 550 is used to generate exception prompt text corresponding to the target query code information based on the exception information, and display the exception prompt text in the client.
[0251] In some implementations, the detection module 530 includes a parsing submodule, an extraction submodule, a construction submodule, and a detection submodule;
[0252] The parsing submodule is used to perform lexical analysis on the query code information to determine the multiple subquery code information corresponding to the query code information;
[0253] The extraction submodule is used to extract lexical units from each subquery code information to obtain the lexical units corresponding to each subquery code information.
[0254] The submodule is used to construct the syntax logic tree corresponding to the query code information based on the lexical unit.
[0255] The detection submodule is used to perform syntax and logic checks on the query code information based on the syntax logic tree and preset syntax rules, and obtain the logic detection results.
[0256] In some implementations, a submodule is extracted for:
[0257] Determine the code structure corresponding to each subquery code information;
[0258] Lexical units are extracted from the code information of each subquery based on the code composition structure to obtain the lexical units corresponding to each subquery code information.
[0259] In some implementations, the detection submodule is used for:
[0260] Determine the depth of each node in the syntax logic tree;
[0261] Arrange each node in ascending order of its depth to obtain the node arrangement order;
[0262] Based on the node arrangement order and preset grammar rules, the lexical unit corresponding to each node is subjected to grammatical logic detection to obtain the logic detection result.
[0263] In some implementations, the detection submodule is used for:
[0264] Identify the root node in the syntax logic tree and determine the target lexical unit corresponding to the root node;
[0265] The target preset grammar rule is matched with the target lexical unit in the preset grammar rule;
[0266] Based on the node arrangement order and the target preset grammar rules, the lexical unit corresponding to each node is subjected to grammatical logic detection to obtain the logic detection result.
[0267] In some implementations, the exception acquisition module 540 is used for:
[0268] Abnormal lexical units are identified based on the results of logical detection;
[0269] The subquery code information corresponding to the abnormal lexical unit is determined as the target query code information;
[0270] The exception information corresponding to the target query code information is determined based on the preset syntax rules.
[0271] In some implementations, the exception notification module 550 is used for:
[0272] Identify multiple sub-target query code information within the target query code information, and the corresponding sub-exception prompt text for each sub-target query code information;
[0273] Determine the code association information between multiple sub-target query code information and the type information of each sub-target query code information, and determine the prompt priority of each sub-target query code information based on the code association information and type information;
[0274] Arrange the sub-exception message texts according to the priority of the prompts, and generate the exception message text corresponding to the target query code information.
[0275] In some implementations, the determining module 510 is used for:
[0276] Determine the default syntax configuration file associated with the pending tasks;
[0277] Analyze the preset syntax configuration file to determine the preset syntax rules corresponding to the tasks to be processed.
[0278] In some implementations, the exception notification module 550 is used for:
[0279] Traverse the exception information to determine the location of the exception code and the exception message corresponding to the target query code information;
[0280] Generate the exception message text corresponding to the target query code information based on the exception code location and exception message.
[0281] In some implementations, the acquisition module 520 is used for:
[0282] Obtain the initial code information entered by the object in the client and determine the information prompt rules corresponding to the preset syntax rules;
[0283] Generate a set of prompt code information corresponding to the initial code information according to the information prompt rules;
[0284] Determine the target prompt code information selected by the object in the prompt code information set, and generate the query code information corresponding to the pending item based on the initial code information and the target prompt code information.
[0285] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the detailed description of the information retrieval method above, which will not be repeated here.
[0286] As described above, in this embodiment, the determining module 510 obtains the pending items selected in the client and determines the preset syntax rules corresponding to the pending items; the obtaining module 520 obtains the query code information input in the client for the pending items; the detecting module 530 performs syntax logic detection on the query code information according to the preset syntax rules and obtains the logic detection result; when the logic detection result shows a logic exception, the exception obtaining module 540 determines the target query code information where the logic exception occurs from the query code information and obtains the exception information corresponding to the target query code information; the exception prompting module 550 generates the exception prompt text corresponding to the target query code information based on the exception information and displays the exception prompt text in the client. Therefore, when processing corresponding pending items, the preset syntax rules corresponding to the pending items can be obtained. The query code information can be checked for syntax and logic errors by using the preset syntax rules, thereby determining whether there are any syntax and logic errors in the query code information. By obtaining the preset syntax rules in advance, it is possible to check the syntax and logic of query code information in multiple different languages. When a syntax and logic error occurs, a corresponding exception message can be generated to assist in the correction of the query code information. Compared with the related technologies that can only check the query code information in commonly used languages, this application realizes the syntax and logic check of query code information in multiple different languages, improving the efficiency and comprehensiveness of code information retrieval.
[0287] The computer device provided in this application embodiment can be a server, such as... Figure 10 As shown, it illustrates a schematic diagram of the server structure involved in an embodiment of this application. Specifically:
[0288] The server may include components such as a processor 601 with one or more processing cores, a memory 602 with one or more computer-readable storage media, a power supply 603, and an input unit 604. Those skilled in the art will understand that... Figure 10The server architecture shown does not constitute a limitation on the server and may include more or fewer components than illustrated, or combine certain components, or have different component arrangements. Wherein:
[0289] The processor 601 is the control center of the server, connecting various parts of the server via various interfaces and lines. It performs various server functions and processes data by running or executing software programs and / or modules stored in the memory 602, and by calling data stored in the memory 602, thereby providing overall control of the server. Optionally, the processor 601 may include one or more processing cores; preferably, the processor 601 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 601.
[0290] The memory 602 can be used to store software programs and modules. The processor 601 executes various functional applications and data processing by running the software programs and modules stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the server, etc. In addition, the memory 602 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 602 may also include a memory controller to provide the processor 601 with access to the memory 602.
[0291] The computer device also includes a power supply 603 that supplies power to the various components. Optionally, the power supply 603 can be logically connected to the processor 601 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 603 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0292] The computer device may also include an input unit 604, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0293] Although not shown, the computer device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 601 in the computer device loads the executable files corresponding to the processes of one or more applications into the memory 602 according to the following instructions, and the processor 601 runs the applications stored in the memory 602, thereby implementing the various method steps provided in the foregoing embodiments, as follows:
[0294] Get the pending items selected in the client and determine the preset syntax rules corresponding to the pending items;
[0295] Retrieve the query code information entered by the client for the pending item;
[0296] The query code information is subjected to syntax and logic checks according to preset syntax rules, and the logic check results are obtained.
[0297] When the logic detection result shows a logic anomaly, determine the target query code information where the logic anomaly occurred from the query code information, and obtain the anomaly information corresponding to the target query code information;
[0298] Generate an exception message text corresponding to the target query code information based on the exception information, and display the exception message text on the client.
[0299] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the detailed description of the information retrieval method above, which will not be repeated here.
[0300] As described above, in this embodiment of the application, the following steps are taken: First, the pending items selected in the client are obtained, and the preset syntax rules corresponding to the pending items are determined. Second, the query code information input in the client for the pending items is obtained. Third, the query code information is subjected to syntax logic detection according to the preset syntax rules to obtain the logic detection result. Fourth, when the logic detection result shows a logic exception, the target query code information with the logic exception is determined from the query code information, and the exception information corresponding to the target query code information is obtained. Fifth, an exception prompt text corresponding to the target query code information is generated based on the exception information, and the exception prompt text is displayed in the client. Therefore, when processing corresponding pending items, the preset syntax rules corresponding to the pending items can be obtained. The query code information can be checked for syntax and logic errors by using the preset syntax rules, thereby determining whether there are any syntax and logic errors in the query code information. By obtaining the preset syntax rules in advance, it is possible to check the syntax and logic of query code information in multiple different languages. When a syntax and logic error occurs, a corresponding exception message can be generated to assist in the correction of the query code information. Compared with the related technologies that can only check the query code information in commonly used languages, this application realizes the syntax and logic check of query code information in multiple different languages, improving the efficiency and comprehensiveness of code information retrieval.
[0301] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0302] Therefore, embodiments of this application provide a computer-readable storage medium storing a plurality of instructions that can be loaded by a processor to execute steps in any of the information retrieval methods provided in embodiments of this application. For example, the instructions can execute the following steps:
[0303] Get the pending items selected in the client and determine the preset syntax rules corresponding to the pending items;
[0304] Retrieve the query code information entered by the client for the pending item;
[0305] The query code information is subjected to syntax and logic checks according to preset syntax rules, and the logic check results are obtained.
[0306] When the logic detection result shows a logic anomaly, determine the target query code information where the logic anomaly occurred from the query code information, and obtain the anomaly information corresponding to the target query code information;
[0307] Generate an exception message text corresponding to the target query code information based on the exception information, and display the exception message text on the client.
[0308] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the detailed description of the information retrieval method above, which will not be repeated here.
[0309] As described above, in this embodiment of the application, the following steps are taken: First, the pending items selected in the client are obtained, and the preset syntax rules corresponding to the pending items are determined. Second, the query code information input in the client for the pending items is obtained. Third, the query code information is subjected to syntax logic detection according to the preset syntax rules to obtain the logic detection result. Fourth, when the logic detection result shows a logic exception, the target query code information with the logic exception is determined from the query code information, and the exception information corresponding to the target query code information is obtained. Fifth, an exception prompt text corresponding to the target query code information is generated based on the exception information, and the exception prompt text is displayed in the client. Therefore, when processing corresponding pending items, the preset syntax rules corresponding to the pending items can be obtained. The query code information can be checked for syntax and logic errors by using the preset syntax rules, thereby determining whether there are any syntax and logic errors in the query code information. By obtaining the preset syntax rules in advance, it is possible to check the syntax and logic of query code information in multiple different languages. When a syntax and logic error occurs, a corresponding exception message can be generated to assist in the correction of the query code information. Compared with the related technologies that can only check the query code information in commonly used languages, this application realizes the syntax and logic check of query code information in multiple different languages, improving the efficiency and comprehensiveness of code information retrieval.
[0310] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the information retrieval methods provided in the various optional implementations of the above embodiments.
[0311] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the detailed description of the information retrieval method above, which will not be repeated here.
[0312] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0313] Since the instructions stored in the computer-readable storage medium can execute the steps of any of the information retrieval methods provided in the embodiments of this application, the beneficial effects that any of the information retrieval methods provided in the embodiments of this application can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.
[0314] The above provides a detailed description of an information retrieval method, apparatus, computer device, and storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, those skilled in the art will recognize that there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. An information retrieval method, characterized by, The method comprises the following steps: acquiring a to-be-processed matter selected in a client, and determining a preset syntax rule corresponding to the to-be-processed matter; acquiring query code information input in the client for the to-be-processed matter; performing syntax logic detection on the query code information according to the preset syntax rule to obtain a logic detection result; when the logic detection result shows a logic exception, determining target query code information in which the logic exception occurs from the query code information, and acquiring exception information corresponding to the target query code information; generating an exception prompt text corresponding to the target query code information according to the exception information, and displaying the exception prompt text in the client.
2. The information retrieval method of claim 1, wherein, The syntax logic detection on the query code information according to the preset syntax rule to obtain a logic detection result comprises the following steps: performing lexical analysis on the query code information to determine a plurality of sub-query code information corresponding to the query code information; extracting a lexical unit corresponding to each sub-query code information; constructing a syntax logic tree corresponding to the query code information according to the lexical unit; performing syntax logic detection on the query code information according to the syntax logic tree and the preset syntax rule to obtain a logic detection result.
3. The information retrieval method of claim 2, wherein, The extraction of the lexical unit corresponding to each sub-query code information comprises the following steps: determining a code composition structure corresponding to each sub-query code information; extracting a lexical unit corresponding to each sub-query code information according to the code composition structure.
4. The information retrieval method of claim 2, wherein, The syntax logic detection on the lexical unit corresponding to each node according to the node arrangement order and the preset syntax rule to obtain a logic detection result comprises the following steps: determining a tree node depth of each node in the syntax logic tree; arranging the nodes in a descending order of the tree node depth to obtain a node arrangement order; performing syntax logic detection on the lexical unit corresponding to each node according to the node arrangement order and the preset syntax rule to obtain a logic detection result.
5. The information retrieval method of claim 4, wherein, The syntax logic detection on the lexical unit corresponding to each node according to the node arrangement order and the preset syntax rule to obtain a logic detection result comprises the following steps: determining a root node in the syntax logic tree, and determining a target lexical unit corresponding to the root node; matching a target preset syntax rule in the preset syntax rule according to the target lexical unit; performing syntax logic detection on the lexical unit corresponding to each node according to the node arrangement order and the target preset syntax rule to obtain a logic detection result.
6. The information retrieval method of claim 4, wherein, The acquisition of the exception information corresponding to the target query code information comprises the following steps: determining an abnormal lexical unit according to the logic detection result; determining a sub-query code information corresponding to the abnormal lexical unit as target query code information; determining exception information corresponding to the target query code information according to the preset syntax rule.
7. The information retrieval method of claim 1, wherein, The generation of the exception prompt text corresponding to the target query code information according to the exception information comprises the following steps: determine a plurality of sub-target query code information in the target query code information, and a sub-exception prompt text corresponding to each sub-target query code information; determine code association information between the plurality of sub-target query code information and type information of each sub-target query code information, and determine a prompt priority of each sub-target query code information according to the code association information and the type information; arrange the sub-exception prompt text according to the prompt priority, and generate an exception prompt text corresponding to the target query code information.
8. The information retrieval method of claim 1, wherein, The method further includes: determining a preset syntax configuration file associated with the to-be-handled matter; analyzing the preset syntax configuration file to determine the preset syntax rule corresponding to the to-be-handled matter.
9. The information retrieval method of claim 1, wherein, The method further includes: traversing the exception information to determine an exception code position and an exception prompt text corresponding to the target query code information; generating the exception prompt text corresponding to the target query code information according to the exception code position and the exception prompt text.
10. The information retrieval method of claim 1, wherein, The method further includes: obtaining initial code information input by the object in the client, and determining an information prompt rule corresponding to the preset syntax rule; generating a prompt code information set corresponding to the initial code information according to the information prompt rule; determining target prompt code information selected by the object in the prompt code information set, and generating the query code information corresponding to the to-be-handled matter according to the initial code information and the target prompt code information.
11. An information retrieval apparatus characterized by comprising: The method further includes: a determining module, configured to obtain a to-be-handled matter selected in a client, and determine a preset syntax rule corresponding to the to-be-handled matter; an obtaining module, configured to obtain query code information input by the object in the client for the to-be-handled matter; a detecting module, configured to perform syntax logic detection on the query code information according to the preset syntax rule, and obtain a logic detection result; an exception obtaining module, configured to, when the logic detection result shows a logic exception, determine target query code information in which a logic exception occurs from the query code information, and obtain exception information corresponding to the target query code information; an exception prompt module, configured to generate an exception prompt text corresponding to the target query code information according to the exception information, and display the exception prompt text in the client.
12. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a plurality of instructions adapted to be loaded by the processor to execute the information retrieval method of any one of claims 1 to 10.
13. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the information retrieval method of any one of claims 1 to 10.
14. A computer program product comprising computer programs or instructions, characterized in that, The computer program or instructions are executed by the processor to implement the information retrieval method of any one of claims 1 to 10.