Query processing method and device, electronic equipment and storage medium

By identifying whether the file path of the target element contains the target source code path, the usage location is determined from the source code file and the compiled file respectively, which solves the problem of low query efficiency in the existing technology and achieves a more efficient query result merging and development experience.

CN121387364APending Publication Date: 2026-01-23GUANGZHOU BOGUAN TELECOMM TECH LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511387240.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-25
Publication Date
2026-01-23

AI Technical Summary

Technical Problem

Existing source code element location query solutions are inefficient, requiring developers to perform too many repetitive operations across different code modules, which impacts query efficiency.

Method used

By identifying whether the file path of the target element contains the target source code path, the usage location is determined from the source code file and the compiled file respectively, and the query results are merged to reduce duplicate operations.

Benefits of technology

It improves query efficiency, reduces repetitive manual operations across different code modules, ensures the completeness and accuracy of query results, and enhances the development experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121387364A_ABST
    Figure CN121387364A_ABST
Patent Text Reader

Abstract

The invention discloses a query processing method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining element information of a target element and file path information corresponding to the target element by responding to a use position query operation of the target element in a code of a target item; under the condition that the file path information indicates that a target source code path is contained, determining a first query result of a use position of a target element from a source code file of the target item based on the element information, and determining a second query result of the use position of the target element from a compiled file of the target item; and based on the first query result and the second query result, determining a query result of the use position of the target element. Therefore, under the condition that the file path associated with the element needing to be subjected to position query contains the target source code path, the element is subjected to multi-layer use position query, so that repeated manual operation under different code modules is reduced, and the query efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, specifically to a query processing method, apparatus, electronic device, and storage medium. Background Technology

[0002] The existing project design employs a component-based acceleration approach, with the exposed source code located under `${moduleName} / src / main / sdk`, where `moduleName` is the module name. The source code in this directory is pre-compiled into a `${moduleName}.jar` file, which is then used as a dependency by the source code in ` / src / main / java`. In other words, when other modules use the Software Development Kit (SDK) code, they are actually using the JAR file, not the SDK's source code.

[0003] The above process means that when querying the usage location of a source code element in a certain code module, developers need to query the usage location of that source code element in different code modules separately. This results in too many repetitive operations in the query process, affecting query efficiency.

[0004] Therefore, existing source code element location query schemes suffer from low query efficiency. Summary of the Invention

[0005] This application provides a query processing method, apparatus, electronic device, and storage medium. By identifying whether the file path associated with the element to be queried contains the target source code path, a multi-level usage location query is performed on the element if the file path associated with the element contains the target source code path. This reduces repetitive manual operations in different code modules and improves query efficiency.

[0006] In a first aspect, embodiments of this application provide a query processing method, the method comprising:

[0007] In response to a query operation on the usage location of a target element in the code of a target project, the element information of the target element and the file path information corresponding to the target element are obtained.

[0008] When the file path information indicates that the target source code path is included, based on the element information, a first query result is obtained from the source code file of the target project to determine the usage location of the target element, and a second query result is obtained from the compiled file of the target project to determine the usage location of the target element.

[0009] Based on the first query result and the second query result, the query result determines the usage location of the target element.

[0010] Secondly, embodiments of this application provide a query processing apparatus, including:

[0011] The information acquisition module is used to respond to a query operation on the usage location of a target element in the code of the target project, and to acquire the element information of the target element and the file path information corresponding to the target element.

[0012] The query module is used to determine, based on the element information, a first query result of the location of the target element in the source code file of the target project and a second query result of the location of the target element in the compiled file of the target project, when the file path information indicates that the target source code path is included;

[0013] The result determination module is used to determine the query result of the usage position of the target element based on the first query result and the second query result.

[0014] Thirdly, embodiments of this application also provide an electronic device, which includes a processor and a memory, wherein the memory stores a computer program that, when executed by the processor, causes the processor to perform the steps of any query processing method.

[0015] Fourthly, embodiments of this application also provide a computer-readable storage medium including a processor and a memory, wherein the memory stores a computer program that, when executed by the processor, causes the processor to perform the steps of any query processing method.

[0016] Fifthly, embodiments of this application also provide a computer program product, including a computer program stored in a computer-readable storage medium; when a processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, causing the electronic device to perform the steps of any of the query processing methods provided in embodiments of this application.

[0017] The solution adopted in this application embodiment can obtain element information and corresponding file path information of the target element in response to a query operation on the usage location of the target element in the code of the target project. If the file path information indicates that it includes the target source code path, a first query result for determining the usage location of the target element is obtained from the source code file of the target project, and a second query result is obtained from the compiled file of the target project, based on the element information. Based on the first and second query results, a query result for determining the usage location of the target element is determined. Thus, by identifying whether the file path associated with the element requiring a location query contains the target source code path, multi-level usage location queries can be performed on the element if the file path associated with the element contains the target source code path, thereby reducing repetitive manual operations in different code modules and improving query efficiency. Attached Figure Description

[0018] 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.

[0019] Figure 1 This is a schematic diagram of an implementation environment scenario for the query processing method provided in this application embodiment;

[0020] Figure 2 This is a flowchart illustrating the query processing method provided in the embodiments of this application;

[0021] Figure 3 This is a schematic diagram of the specific process of the query processing method provided in the embodiments of this application;

[0022] Figure 4 This is a schematic diagram of the project structure of a specific embodiment of the query processing method provided in this application.

[0023] Figure 5 This is a schematic diagram of the structure of the query processing device provided in the embodiments of this application;

[0024] Figure 6 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0025] 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 a part of the embodiments of this application, and not all of the 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. At the same time, in the description of the embodiments of this application, the terms "first," "second," etc., are only used to distinguish descriptions and should not be construed as indicating or implying relative importance. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly specified.

[0026] This application provides a query processing method, apparatus, electronic device, and computer-readable storage medium.

[0027] Specifically, this embodiment will be described from the perspective of a query processing device, which can be integrated into an electronic device, meaning that the query processing method of this application embodiment can be executed by an electronic device. This electronic device can be a server, a terminal, or other similar device.

[0028] 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, content delivery network (CDN) acceleration services, and big data and artificial intelligence platforms. The terminal can be a device that includes both receiving and transmitting hardware, i.e., a device with receiving and transmitting hardware capable of performing bidirectional communication over a bidirectional communication link. Terminals can include, but are not limited to, mobile phones, computers, smart voice interaction devices, smart home appliances, vehicle terminals, and aircraft. Terminals and servers can be directly or indirectly connected via wired or wireless communication methods; this application does not impose any restrictions.

[0029] Please see Figure 1 Taking the integration of query processing devices into electronic devices as an example, Figure 1This is a schematic diagram illustrating an implementation scenario of the query processing method provided in this application. The electronic device can be a terminal device, used to respond to a query operation on the usage location of a target element in the code of a target project. The terminal device obtains element information of the target element and file path information corresponding to the target element. If the file path information indicates that it includes the target source code path, based on the element information, it determines a first query result of the usage location of the target element from the source code file of the target project, and a second query result of the usage location of the target element from the compiled file of the target project. Based on the first and second query results, it determines the query result of the usage location of the target element. Thus, by identifying whether the file path associated with the element requiring a location query contains the target source code path, and if the file path associated with the element contains the target source code path, multi-level usage location queries are performed on the element, thereby reducing repetitive manual operations in different code modules and improving query efficiency.

[0030] It should be noted that, Figure 1 The illustrated scenario of the query processing method is merely an example. The implementation environment of the query processing method described in this application is intended to more clearly illustrate the technical solutions of this application and does not constitute a limitation on the technical solutions provided in this application. Those skilled in the art will recognize that, with the evolution of data processing and the emergence of new business scenarios, the technical solutions provided in this application are equally applicable to similar technical problems.

[0031] The solutions provided in this application are specifically illustrated through the following embodiments. It should be noted that the order of description of the following embodiments is not intended to limit the preferred order of the embodiments.

[0032] This embodiment will be described from the perspective of a query processing device, which can be integrated into an electronic device, which can be a terminal and / or a server, and this application does not impose any limitations on it.

[0033] This application provides a query processing method; please refer to [link / reference]. Figure 2 , Figure 2 The specific flow of the query processing method provided in this application embodiment can be summarized in the following steps 101 to 103:

[0034] Step 101: In response to the query operation on the usage location of the target element in the code of the target project, obtain the element information of the target element and the file path information corresponding to the target element.

[0035] The target project refers to the project launched within the integrated development environment (IDE). The IDE can be determined based on the specific environment in which the project is launched; no restrictions are imposed here. For example, the IDE could be Android Studio.

[0036] The target element refers to the code element that needs to be used for location lookup, and location lookup refers to the method of finding the location of the target element in the code of the target project.

[0037] Understandably, integrated development environments (IDEs) offer a "find and use" function. When a project is started in the IDE, the code is displayed through the IDE's interface. Users can select a specific element within the project's code to trigger the "find and use" function. This element can include at least one of the following: class, variable, method, or function; the specific element can be selected based on the actual situation and is not restricted here.

[0038] The location query operation refers to the operation that triggers the "find and use" function. There are various triggering methods, which can be adjusted according to the actual situation; this application embodiment does not impose any restrictions. For example, the location query operation can be triggered based on a shortcut. Alternatively, the location query operation can also be triggered based on a preset touch method (such as a double-click or triple-click using a mouse or finger).

[0039] Here, element information refers to the relevant information contained in the target element. Element information includes, but is not limited to, the element name and element type of the target element, and its specific details can be adjusted according to the actual situation. This application embodiment does not impose any restrictions.

[0040] The file path information includes multiple file paths associated with the target element, which can be adjusted according to actual circumstances, and this application embodiment does not impose any limitations. For example, the file path information includes the file path of the file where the target element is located. Another example is that the file path information includes the file path of the file where the target element is located, and the file path of the class inherited by the target element. Yet another example is that the file path information includes the file path of the file where the target element is located, the file path of the class inherited by the target element, and the file path of the interface corresponding to the target element.

[0041] Specifically, the process of obtaining the element information of the target element and the file path information corresponding to the target element in response to the query operation on the usage location of the target element in the code of the target project may include: generating a query request for the target element in response to the query operation on the usage location of the target element in the code of the target project, the query request including the element information of the target element and the file path information corresponding to the target element; intercepting the query request through a preset component and extracting the element information and file path information from the query request.

[0042] The preset components can be plugins installed in an integrated open environment, or other components, and the specific implementation of this application is not limited thereto.

[0043] Step 102: If the file path information indicates that the target source code path is included, based on the element information, determine the first query result of the location where the target element is used from the source code file of the target project, and the second query result of the location where the target element is used from the compiled file of the target project.

[0044] The target source code path refers to the source code path where multi-level queries of elements are required. The source code path indicates that the file corresponding to the file path is a source code file. A source code file is a file that stores the source code elements contained in the target project.

[0045] It is understood that the specific content of the target source code path can be adjusted according to the actual situation, and this application embodiment does not impose any restrictions. For example, the target source code path indicates a source code path containing "src / main / sdk". Another example is that the target source code path indicates a source code path containing "src / main / specific name".

[0046] The first query result refers to the query result obtained from the source code file, which shows the location where the target element is used.

[0047] The second query result refers to the query result obtained from the compiled file, which shows the location where the target element is used. The compiled file refers to the file obtained by compiling at least a portion of the source code files of the target project.

[0048] There are multiple ways to determine whether the file path information includes the target source code path, and the specific method can be adjusted according to the actual situation. This application embodiment does not impose any restrictions.

[0049] In one embodiment, when the file path information includes the file path of the file containing the target element, a first path of the file containing the target element can be determined from the file path information, and a first path identifier can be extracted from the first path; if the first path identifier matches the target source code path identifier, it is determined that the file path information indicates that the target source code path is included.

[0050] The first path indicates the file path of the file containing the target element. The first path identifier identifies the first path. The target source code path identifier identifies the target source code path.

[0051] In one embodiment, if the file path information includes the file path of the file containing the class inherited by the target element, a second path of the file containing the class inherited by the target element can be determined from the file path information, and a second path identifier can be extracted from the second path; if the second path identifier matches the target source code path identifier, the file path information is determined to indicate that the target source code path is included.

[0052] The second path indicates the file path of the class inherited by the target element. The second path identifier is used to identify the second path.

[0053] The class inherited by the target element can include only the parent class inherited by the target element. Alternatively, the class can include the parent class inherited by the target element, and the parent class's superparent class. The class can also include the parent class inherited by the target element, the parent class's superparent class, and the superparent class's superparent class, up to the point where there are no classes to inherit from.

[0054] When the file path information includes the file path of the file containing the class inherited by the target element, the above query processing method further includes: obtaining the node hierarchy structure of the target project that contains the class inherited by the target element, wherein the node hierarchy structure includes at least one class node.

[0055] The node hierarchy indicates the hierarchical structure formed by multiple classes inherited by the target element. Each class node indicates a class inherited by the target element.

[0056] A node hierarchy can include only the class nodes corresponding to the parent class inherited by the target element. Alternatively, it can include the class nodes corresponding to the parent class inherited by the target element, and the class nodes corresponding to the parent's previous-level parent class, and so on, until no class is inherited.

[0057] It should be noted that the number of parent classes inherited by the target element, the number of parent classes inherited by the target element, and the number of parent classes inherited by the target element can be adjusted according to specific circumstances, and this application embodiment does not impose any restrictions.

[0058] Based on this, the process of determining the second path of the file containing the class inherited by the target element from the file path information can include: for each type of node, determining the second path of the file containing the second type corresponding to the class node from the file path information.

[0059] The second category refers to the class inherited by the target element and the class node corresponding to the currently determined second path.

[0060] It should be noted that in this example, there are multiple second paths, and the number of class nodes contained in the node hierarchy of the class inherited by their target element is the same.

[0061] Based on this, when the second path identifier matches the target source code path identifier, the step of determining that the file path information indicates that the target source code path is included may include: when there is a second path identifier that matches the target source code path identifier, determining that the file path information indicates that the target source code path is included.

[0062] In one embodiment, if the file path information includes the file path of the file containing the interface corresponding to the target element, a third path of the file containing the interface corresponding to the target element can be determined from the file path information, and a third path identifier can be extracted from the third path; if the third path identifier matches the target source code path identifier, the file path information is determined to indicate that the target source code path is included.

[0063] The third path indicates the file path of the file containing the interface corresponding to the target element. The third path identifier is used to identify the third path.

[0064] In this context, the target element's corresponding interface refers to the interface that contains that target element. In programming, an interface is a specification or protocol used to define the interaction methods and communication rules between different software components. It constrains the behavior of implementers through a collection of abstract methods, properties, and events, ensuring loose coupling and flexible expansion between components.

[0065] It is understood that the file path information includes at least the file path of the file where the target element is located, and may also include at least one of the following: the file path of the file where the class inherited by the target element is located, and the file path of the file where the interface corresponding to the target element is located.

[0066] Whether the file path information indicates the execution order in the target source code path can be adjusted according to the actual situation, and this application embodiment does not impose any restrictions.

[0067] In one embodiment, determining whether file path information indicates the inclusion of a target source code path may further include: determining from the file path information a first path of the file where the target element is located, a second path of the file where the class inherited by the target element is located, and a third path of the file where the interface corresponding to the target element is located; extracting a first path identifier from the first path, a second path identifier from the second path, and a third path identifier from the third path; and determining that the file path information indicates the inclusion of a target source code path if one of the first path identifier, the second path identifier, and the third path identifier matches the target source code path identifier.

[0068] In one embodiment, determining whether file path information indicates the inclusion of a target source code path may further include: determining a first path of the file containing the target element from the file path information, and extracting a first path identifier from the first path; if the first path identifier matches the target source code path identifier, determining that the file path information indicates the inclusion of a target source code path; if the first path identifier does not match the target source code path identifier, determining a second path of the file containing the class inherited by the target element from the file path information, and extracting a second path identifier from the second path; if the second path identifier matches the target source code path identifier, determining that the file path information indicates the inclusion of a target source code path; if the second path identifier does not match the target source code path identifier, determining a third path of the file containing the interface corresponding to the target element from the file path information, and extracting a third path identifier from the third path; if the third path identifier matches the target source code path identifier, determining that the file path information indicates the inclusion of a target source code path; otherwise, determining that the file path information indicates the exclusion of a target source code path.

[0069] In one embodiment, determining whether file path information indicates the inclusion of a target source code path may further include: determining a first path of the file containing the target element from the file path information, and extracting a first path identifier from the first path; if the first path identifier matches the target source code path identifier, determining that the file path information indicates the inclusion of a target source code path; if the first path identifier does not match the target source code path identifier, determining a second path of the file containing the class inherited by the target element, and / or determining a third path of the file containing the interface corresponding to the target element; extracting a second path identifier from the second path and / or extracting a third path identifier from the third path, and determining that the file path information indicates the inclusion of a target source code path if the second path identifier matches the target source code path identifier and / or the third path identifier matches the target source code path identifier.

[0070] For example, the method of obtaining the class inherited by the target element and the interface corresponding to the target element can be determined by the following code:

[0071] Obtain the container class using the following code:

[0072]

[0073] Thus, the containing class of the current element can be obtained using PsiTreeUtil.getParentOfType. Both Java classes (PsiClass) and Kotlin classes (KtClassOrObject) are supported. If the containing class is not found, an empty list is returned to terminate the search.

[0074] Initialize the lookup data structure using the following code:

[0075] val visited=mutableSetOf <psielement>() / / Access records to prevent circular references

[0076] val result = mutableListOf <psielement>() / / Store search results

[0077] val toVisit = mutableListOf(containingClass) / / Breadth-first search queue

[0078] Determine the inheritance hierarchy (i.e., node level structure) using the following code:

[0079]

[0080] Thus, breadth-first search ensures a complete traversal of the inheritance hierarchy; the visited collection avoids infinite loops caused by circular inheritance; and all parent classes and interfaces are collected in hierarchical order.

[0081] To look up the parent class interface of a Java type, you can use the following code:

[0082]

[0083] In this way, it is possible to find the direct parent class of a Java class (i.e., single inheritance), find the differences among all interfaces implemented by the Java class, and add the found parent class and interface to the queue to be accessed.

[0084] For searching the supertype of a Kotlin type, you can use the following code:

[0085]

[0086] In this way, it is possible to traverse all supertype declarations of Kotlin classes; obtain specific classes or interfaces through type reference resolution; only process successfully resolved PsiClass or KtClassOrObject types; and support Kotlin class inheritance and interface implementation.

[0087] Finally, the class inherited by the target element and the interface corresponding to the target element are returned as follows:

[0088] result.removeAt(0) / / Remove the initial current class

[0089] result / / Returns all parent classes and interfaces

[0090] Thus, by removing the first element in the list, which is the containing class of the target element itself, we can return the true list of parent classes and interfaces of the target element.

[0091] The code above enables a comprehensive search of SDK source code and library versions. When searching for methods in classes that implement SDK interfaces, the SDK interface itself is found, triggering a full search. Furthermore, when searching for methods in subclasses that inherit from SDK classes, the search is recursively performed upwards to the SDK parent class, ensuring that even multi-level inheritance can trace back to the original SDK class. It also handles complex cases involving interface implementations and class inheritance, ensuring that all relevant SDK elements are identified. This recursive search mechanism for parent classes and interfaces intelligently identifies interface implementations and inheritance relationships, ensuring that even code not directly located in the SDK path can benefit from the full search functionality if it implements an SDK interface or inherits from an SDK class.

[0092] The specific content of the first query result, which determines the usage location of the target element from the source code file of the target project based on element information, and the second query result, which determines the usage location of the target element from the compiled file of the target project, can be specifically adjusted according to the method of determining whether the file path information indicates that the target source code path is included. This application embodiment does not impose any restrictions.

[0093] Specifically, when the first path identifier matches the target source code path identifier, the first query result of determining the usage location of the target element from the source code file of the target project based on element information may include: determining at least one usage location that matches the element name from the file where the target element is located, and obtaining the first query result.

[0094] The steps described above for determining the second query result of the usage location of the target element from the compiled file of the target project include: determining the file containing the first class and / or the first method of the target element from the compiled file of the target project; and determining the second query result of the usage location of the target element from the file containing the first class and / or the first method.

[0095] The first category refers to the class containing the target element in the compiled file of the target project, and the first method refers to the method containing the target element in the compiled file.

[0096] Specifically, when the second path identifier matches the target source code path identifier, the first query result of determining the usage location of the target element from the source code file of the target project based on element information may include: determining the usage location of the element name that matches the class name of the class inherited by the target element from the file containing the class inherited by the target element, and including the element name, to obtain the first query result.

[0097] Specifically, when the class inherited by the target element is the parent class of the target element, the class name refers to the name of the parent class of the target element. When the class inherited by the target element is the parent class of the target element's parent class, the class name refers to the name of that parent class. Other cases are similar and will not be elaborated here.

[0098] The second query result for determining the usage location of the target element from the compiled file of the target project may include: determining the file containing the target class whose class name matches the class inherited by the target element from the compiled file of the target project; and determining the second query result for determining the usage location of the target element from the file containing the target class.

[0099] The target class refers to the class in the compiled file of the target project whose class name matches the class inherited by the target element and contains the element name.

[0100] Specifically, when the third path identifier matches the target source code path identifier, the first query result of determining the usage location of the target element from the source code file of the target project based on element information includes: determining the usage location containing the element name from the file where the interface corresponding to the target element is located, and obtaining the first query result.

[0101] The steps described above for determining the second query result of the usage location of the target element from the compiled file of the target project include: determining the target interface file containing the interface corresponding to the target element from the compiled file of the target project; and determining the second query result of the usage location of the target element from the target interface file.

[0102] The target interface file refers to the file in the compiled file of the target project that contains the interface corresponding to the target element.

[0103] In some embodiments, when the file path information indicates that the target source code path is included, the process of determining a first query result of the usage location of the target element from the source code file of the target project and a second query result of the usage location of the target element from the compiled file of the target project, based on the element information, may include: when the file path information indicates that the target source code path is included and the element type of the target element belongs to a specific element type, determining a first query result of the usage location of the target element from the source code file of the target project and a second query result of the usage location of the target element from the compiled file of the target project, based on the element information. When the file path information indicates that the target source code path is included and the element type of the target element does not belong to a specific element type, or when the file path information indicates that the target source code path is not included, the query result of determining the usage location of the target element directly from the source code file of the target project based on the element information is obtained, without the need to additionally determine the query result of determining the usage location of the target element from the compiled file of the target project.

[0104] The specific element types can be adjusted according to the actual situation, and this application embodiment does not impose any restrictions. For example, specific element types include Java classes, Java methods, Java fields, Kotlin classes, Kotlin objects, Kotlin functions, and Kotlin properties.

[0105] In this way, most of the useless searches can be reduced, thereby avoiding the consumption of more performance during the search process and improving query performance.

[0106] Step 103: Based on the first query result and the second query result, determine the query result of the usage position of the target element.

[0107] Specifically, the query results that summarize the first and second query results determine the location where the target element is used.

[0108] The solution adopted in this application embodiment can obtain element information and file path information corresponding to the target element by responding to a query operation on the usage location of the target element in the code of the target project. If the file path information indicates that it includes the target source code path, based on the element information, a first query result for determining the usage location of the target element is obtained from the source code file of the target project, and a second query result is obtained from the compiled file of the target project. Based on the first and second query results, a query result for determining the usage location of the target element is determined. Thus, by identifying whether the file path associated with the element requiring a location query contains the target source code path, multi-level usage location queries can be performed on the element if the file path associated with the element contains the target source code path, thereby reducing repetitive manual operations in different code modules and improving query efficiency. It should be noted that existing project designs, using a component-based acceleration approach, place the exposed source code under ${moduleName} / src / main / sdk. The source code in this directory is pre-compiled into a ${moduleName}.jar package before being depended upon by the source code in ** / src / main / java. In other words, when other modules use the SDK code, they are actually using the JAR file instead of the SDK source code.

[0109] In the scenario of querying element usage location, if the element being queried is a source code element, the usual approach is as follows: the developer manually finds the set A of usage locations of the source code element in the source code file of the target project, and then the developer manually finds the set B of usage locations of the source code element in the bytecode after decompiling the Jar (i.e., compiled file) package corresponding to the source code file. The set A and the set B of usage locations are then merged to obtain the query result.

[0110] However, the above solution has the following problems: When querying the usage location of a source code element within a specific code module, developers need to perform the query separately for that element in different code modules. This results in excessive repetitive operations and impacts query efficiency. Furthermore, developers may not realize that the element is a source code element and only perform the usage location query within its own code module, leading to incomplete results, as the usage location queries for that element in other code modules are ignored. Since the search results after merging usage location set A and usage location set B may span source code, decompiled bytecode, and even different modules, developers are prone to losing context during multiple jumps, further affecting location efficiency.

[0111] The query processing method described in this application can solve at least some of the above-mentioned problems.

[0112] To facilitate understanding of the query processing method of this application, a specific embodiment is provided below for explanation. For example... Figure 3 As shown, the specific steps of the query processing method provided in this application are as follows:

[0113] Step 1: The user selects field A1 in the Android Studio integrated development environment. Field A1 is the target element, which includes specific classes, methods, member variables, etc.

[0114] Step 2: The user uses the search function on field A1 to generate a query request for field A1.

[0115] Step 3: The plugin intercepts the query request and retrieves the field information of field A1 from the query request.

[0116] The field information includes the element information of field A1 and the file path information. Step 4: The plugin determines whether field A1 is in the target source code path based on the file path information.

[0117] The target source code path is, for example, src / main / sdk.

[0118] Step 5: The plugin finds field A2, which is the same as field A1, in the project dependency library.

[0119] The project's dependency libraries include the project's compiled files.

[0120] Step 6: The plugin first performs a usage query on field A1 in the project to obtain the first query result, and then performs a usage query on field A2 in the project's dependency library to obtain the second query result;

[0121] Step 7: Merge the first and second query results and return the two query results to Android Studio so that users can see the merged field usage information.

[0122] Before step 3 above, it can be determined whether a function switch is enabled. This function switch indicates whether the plugin is enabled to use the query function. If the function switch is not enabled, multi-level queries will not be performed even if field A1 is in the target source code path.

[0123] In the process of determining whether field A1 is in the target source code path, it is also possible to determine whether the parent class or interface of field A1 is in the target source code path.

[0124] During the query process, exception handling and re-throwing of cancellation exceptions can be performed to ensure that the user's cancellation operation is handled correctly, thereby ensuring the stability of the plugin and preventing the normal use of the integrated development environment from being affected by exceptions.

[0125] For example, such as Figure 4 In the traditional approach, when you right-click on the `loginUser` method of `UserManager.kt` and select "Find Use", the following results should be returned:

[0126] user_module / src / main / java / UserActivity.kt:15.

[0127] Therefore, traditional methods can only find the usage location within the same code module as the target element.

[0128] In the solution of this application, when right-clicking on the loginUser method of UserManager.kt and selecting "Find Use", the following results should be returned:

[0129] user_module / src / main / java / UserActivity.kt: 15;

[0130] order_module / src / main / java / OrderActivity.kt: 8;

[0131] payment_module / src / main / java / PaymentService.kt: 4.

[0132] In this way, the plugin can automatically determine whether a field belongs to the `src / main / sdk` directory and automatically merge usage information from source code and JAR package dependencies, greatly simplifying the process for developers to find the location of field usage, improving search efficiency, and saving development time. Furthermore, the plugin automatically handles complex search logic, eliminating the need for developers to manually switch between files in different directories before searching, reducing the probability of errors and learning costs, and improving the development experience. Intelligent element type filtering and path judgment reduce unnecessary processing overhead. In addition, it avoids omissions caused by relying solely on source code or bytecode, comprehensively covering all usage scenarios of the source code and its compilation artifacts, ensuring the completeness and accuracy of field usage queries. A multi-layered search mechanism ensures the completeness of search results. Moreover, developers can directly obtain all information from a familiar search interface without frequently jumping between source code, decompiled views, and dependency libraries, effectively reducing context switching and disorientation, and improving the smoothness of code reading and maintenance.

[0133] This embodiment also provides a query processing device, which can be integrated into a terminal device. For example, such as... Figure 5 As shown, the query processing device may include:

[0134] The information acquisition module 201 is used to respond to the query operation on the usage location of the target element in the code of the target project, and to obtain the element information of the target element and the file path information corresponding to the target element.

[0135] The query module 202 is used to determine the first query result of the location of the target element from the source code file of the target project based on the element information, when the file path information indicates that the target source code path is included, and the second query result of the location of the target element from the compiled file of the target project.

[0136] The result determination module 203 is used to determine the query results of the usage position of the target element based on the first query result and the second query result.

[0137] In one embodiment, the query processing apparatus further includes:

[0138] The first extraction unit is used to determine the first path of the file where the target element is located from the file path information, and extract the first path identifier from the first path;

[0139] The first determining unit is used to determine, when the first path identifier matches the target source code path identifier, that the file path information indicates that the target source code path is included.

[0140] In one embodiment, the element information includes the element name of the target element.

[0141] Based on this, the query module 202, based on element information, determines the first query result from the source code file of the target project, including:

[0142] The first query unit is used to determine at least one usage location that matches the element name from the file where the target element is located, and to obtain the first query result;

[0143] The query module 202 above determines the second query result from the compiled file of the target project, which identifies the location where the target element is used. This result includes:

[0144] The first file determination unit is used to determine, from the compiled files of the target project, the file containing the first class and / or the first method of the target element;

[0145] The second query unit is used to determine the second query result of the usage location of the target element from the file containing the first type and / or the first method.

[0146] In one embodiment, the query processing apparatus further includes:

[0147] The second extraction unit is used to determine the second path of the file where the class inherited by the target element is located from the file path information, and extract the second path identifier from the second path.

[0148] The second determining unit is configured to, when the second path identifier matches the target source code path identifier, determine that the file path information indicates the inclusion of the target source code path; and / or,

[0149] The third extraction unit is used to determine the third path of the file where the interface corresponding to the target element is located from the file path information, and extract the third path identifier from the third path.

[0150] The third determining unit is used to determine the file path information indicating that the target source code path is included when the third path identifier matches the target source code path identifier.

[0151] In one embodiment, the query processing apparatus further includes:

[0152] The structure acquisition unit is used to acquire the node hierarchy structure of the target project, which contains the classes inherited by the target elements, wherein the node hierarchy structure includes at least one class node;

[0153] Based on this, the second extraction unit above determines the second path of the file containing the class inherited by the target element from the file path information, including:

[0154] The path determination unit is used to determine the second path of the file containing the second type of node corresponding to the type node from the file path information for each type of node.

[0155] In one embodiment, the element information includes the element name of the target element.

[0156] Based on this, when the second path identifier matches the target source code path identifier, the query module 202, based on the element information, determines the first query result of the location of the target element from the source code file of the target project, including:

[0157] The third query unit is used to determine, from the file where the class inherited by the target element is located, the class name that matches the class inherited by the target element, and includes the usage position of the element name, to obtain the first query result;

[0158] The query module 202 above determines the second query result from the compiled file of the target project, which identifies the location where the target element is used. This result includes:

[0159] The second file determination unit is used to determine, from the compiled files of the target project, the file containing the target class whose class name matches the class inherited by the target element and includes the element name.

[0160] The fourth query unit is used to determine the second query result from the file where the target class is located, which is used to determine the location of the target element.

[0161] In one embodiment, the element information includes the element name of the target element.

[0162] Based on this, when the third path identifier matches the target source code path identifier, the query module 202, based on the element information, determines the first query result of the usage location of the target element from the source code file of the target project, including:

[0163] The fifth query unit is used to determine the location of the element name from the file containing the interface corresponding to the target element, and obtain the first query result;

[0164] The query module 202 above determines the second query result from the compiled file of the target project, which identifies the location where the target element is used. This result includes:

[0165] The third file determination unit is used to determine the target interface file containing the interface corresponding to the target element from the compiled file of the target project;

[0166] The sixth query unit is used to determine the second query result from the target interface file to determine the usage location of the target element.

[0167] In some embodiments, the information acquisition module 201, in response to a query operation on the usage location of a target element in the code of the target project, acquires element information of the target element and file path information corresponding to the target element, including:

[0168] The request generation unit is used to generate a query request for the target element in response to a query operation on the usage location of the target element in the code of the target project. The query request includes the element information of the target element and the file path information corresponding to the target element.

[0169] The information acquisition unit is used to intercept query requests through preset components and extract element information and file path information from the query requests.

[0170] The solution adopted in this application embodiment can be implemented by information acquisition module 201 responding to a query operation on the usage location of a target element in the code of a target project, acquiring element information of the target element and file path information corresponding to the target element; query module 202, when the file path information indicates that it includes the target source code path, determines a first query result of the usage location of the target element from the source code file of the target project based on the element information, and a second query result of the usage location of the target element from the compiled file of the target project; result determination module 203 determines the query result of the usage location of the target element based on the first query result and the second query result. Thus, by identifying whether the file path associated with the element requiring location query contains the target source code path, multi-level usage location queries can be performed on the element when the file path associated with the element contains the target source code path, thereby reducing repetitive manual operations in different code modules and improving query efficiency.

[0171] Accordingly, this application also provides an electronic device, which can be a terminal, such as a smartphone, tablet computer, laptop computer, touch screen, game console, personal computer (PC), personal digital assistant (PDA), or other terminal device. Alternatively, the electronic device can be a server.

[0172] like Figure 6 As shown, Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 300 includes a processor 301 with one or more processing cores, a memory 302 with one or more computer-readable storage media, and a computer program stored in the memory 302 and executable on the processor. The processor 301 and the memory 302 are electrically connected. Those skilled in the art will understand that the electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0173] The processor 301 is the control center of the electronic device 300. It connects various parts of the electronic device 300 via various interfaces and lines. By running or loading software programs and / or units stored in the memory 302, and by calling data stored in the memory 302, it executes various functions and processes data of the electronic device 300, thereby providing overall monitoring of the electronic device 300. The processor 301 can be a central processing unit (CPU), a graphics processing unit (GPU), a network processor (NP), etc., and can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application.

[0174] In this embodiment, the processor 301 in the electronic device 300 loads the instructions corresponding to the processes of one or more applications into the memory 302 according to the following steps, and the processor 301 runs the applications stored in the memory 302 to realize various functions, such as:

[0175] In response to a query operation on the usage location of the target element in the code of the target project, obtain the element information of the target element and the file path information corresponding to the target element;

[0176] When the file path information indicates that the target source code path is included, the first query result, based on the element information, determines the location of the target element from the source code file of the target project, and the second query result determines the location of the target element from the compiled file of the target project;

[0177] Based on the first and second query results, the query results determine the usage location of the target element.

[0178] The electronic device provided in this application can obtain element information and file path information corresponding to a target element in response to a query operation on the usage location of a target element in the code of a target project. If the file path information indicates that it includes a target source code path, based on the element information, a first query result is determined from the source code file of the target project, and a second query result is determined from the compiled file of the target project. Based on the first and second query results, a query result for the usage location of the target element is determined. Thus, by identifying whether the file path associated with the element requiring a location query contains the target source code path, and if the file path associated with the element contains the target source code path, multi-level usage location queries can be performed on the element, thereby reducing repetitive manual operations in different code modules and improving query efficiency.

[0179] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0180] Optional, such as Figure 6 As shown, the electronic device 300 also includes: a touch display screen 303, a radio frequency circuit 304, an audio circuit 305, an input unit 306, and a power supply 307. The processor 301 is electrically connected to the touch display screen 303, the radio frequency circuit 304, the audio circuit 305, the input unit 306, and the power supply 307. Those skilled in the art will understand that... Figure 6 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0181] The touch display screen 303 can be used to display a graphical user interface (GUI) and receive operation commands generated by the user interacting with the GUI. The touch display screen 303 may include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the electronic device. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. Optionally, the display panel can be configured using a liquid crystal display (LCD), organic light-emitting diode (OLED), or other similar technologies. The touch panel can be used to collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel), generate corresponding operation commands, and execute the corresponding program according to the operation commands. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch location and the signal generated by the touch operation, transmitting the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 301. It can also receive and execute commands from the processor 301. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits the information to the processor 301 to determine the type of touch event. Subsequently, the processor 301 provides corresponding visual output on the display panel based on the type of touch event. In this embodiment, the touch panel and the display panel can be integrated into the touch display screen 303 to achieve input and output functions. However, in some embodiments, the touch panel and the touch display screen 303 can be implemented as two independent components to achieve input and output functions. That is, the touch display screen 303 can also be used as part of the input unit 306 to achieve input functions.

[0182] The radio frequency circuit 304 can be used to transmit and receive radio frequency signals to establish wireless communication with network devices or other electronic devices, and to transmit and receive signals with network devices or other electronic devices.

[0183] Audio circuitry 305 can be used to provide an audio interface between a user and an electronic device via a speaker and a microphone. Audio circuitry 305 converts received audio data into electrical signals, transmits them to the speaker, and the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuitry 305, converted back into audio data, and then processed by processor 301 before being transmitted via radio frequency circuitry 304 to, for example, another electronic device, or output to memory 302 for further processing. Audio circuitry 305 may also include an earphone jack to facilitate communication between peripheral headphones and electronic devices.

[0184] The input unit 306 can be used to receive source audio, reference audio, etc.

[0185] Power supply 307 is used to supply power to various components of electronic device 300. Optionally, power supply 307 can be logically connected to processor 301 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. Power supply 307 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.

[0186] although Figure 6 As not shown in the diagram, the electronic device 300 may also include a camera, sensor, wireless fidelity module, Bluetooth module, etc., which will not be described in detail here.

[0187] 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 relevant descriptions in other embodiments.

[0188] 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.

[0189] Therefore, embodiments of this application provide a computer-readable storage medium storing multiple computer programs that can be loaded by a processor to execute any of the query processing methods provided in embodiments of this application. The computer program can execute the steps of the following query processing method:

[0190] In response to a query operation on the usage location of the target element in the code of the target project, obtain the element information of the target element and the file path information corresponding to the target element;

[0191] When the file path information indicates that the target source code path is included, the first query result, based on the element information, determines the location of the target element from the source code file of the target project, and the second query result determines the location of the target element from the compiled file of the target project;

[0192] Based on the first and second query results, the query results determine the usage location of the target element.

[0193] Using the computer-readable storage medium provided in this application embodiment, in response to a query operation on the usage location of a target element in the code of a target project, element information of the target element and the file path information corresponding to the target element can be obtained. If the file path information indicates that it includes the target source code path, based on the element information, a first query result is determined from the source code file of the target project, and a second query result is determined from the compiled file of the target project. Based on the first and second query results, a query result for the usage location of the target element is determined. Thus, by identifying whether the file path associated with the element requiring a location query contains the target source code path, and if the file path associated with the element contains the target source code path, multi-level usage location queries can be performed on the element, thereby reducing repetitive manual operations in different code modules and improving query efficiency.

[0194] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0195] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0196] Since the computer program stored in the computer-readable storage medium can execute any of the query processing methods provided in the embodiments of this application, it can achieve the beneficial effects that any of the query processing methods provided in the embodiments of this application can achieve, as detailed in the preceding embodiments, and will not be repeated here.

[0197] According to one aspect of this application, a computer program product or computer program is also provided, comprising computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the methods provided in the various optional implementations of the above embodiments.

[0198] In the above embodiments of the query processing apparatus, computer-readable storage medium, electronic device, and computer program product, the descriptions of each embodiment have different focuses. Parts not described in detail in a particular embodiment can be referred to in the relevant descriptions of other embodiments. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes and beneficial effects of the query processing apparatus, computer-readable storage medium, computer program product, electronic device, and their corresponding units described above can be referred to the description of the query processing method in the above embodiments, and will not be repeated here.

[0199] The foregoing has provided a detailed description of a query processing method, apparatus, electronic device, computer-readable storage medium, and computer program product 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 methods and core ideas of this application. At the same time, for those skilled in the art, 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.< / psielement> < / psielement>

Claims

1. A method of query processing, the method comprising: The method comprises: in response to a use position query operation of a target element in the code of a target project, obtaining element information of the target element and file path information corresponding to the target element; in a case where the file path information indicates a target source code path, determining a first query result of the use position of the target element from a source code file of the target project based on the element information, and determining a second query result of the use position of the target element from a compiled file of the target project; determining a query result of the use position of the target element based on the first query result and the second query result. 2.The query processing method of claim 1, wherein, The method further comprises: determining a first path of a file where the target element is located from the file path information, and extracting a first path identifier from the first path; in a case where the first path identifier matches a target source code path identifier, determining that the file path information indicates a target source code path. 3.The query processing method of claim 2, wherein, The element information comprises an element name of the target element; and the first query result of the use position of the target element from the source code file of the target project based on the element information comprises: determining at least one use position matching the element name from a file where the target element is located to obtain the first query result; the second query result of the use position of the target element from the compiled file of the target project comprises: determining a file where a first class and / or a first method containing the target element are located from the compiled file of the target project; determining a second query result of the use position of the target element from the file where the first class and / or the first method are located.

4. The query processing method of claim 2, wherein, The method further comprises: determining a second path of a file where a class inherited by the target element is located from the file path information, and extracting a second path identifier from the second path; in a case where the second path identifier matches the target source code path identifier, determining that the file path information indicates a target source code path; and / or determining a third path of a file where an interface corresponding to the target element is located from the file path information, and extracting a third path identifier from the third path; in a case where the third path identifier matches the target source code path identifier, determining that the file path information indicates a target source code path.

5. The query processing method of claim 4, wherein, The method further comprises: obtaining a node hierarchical structure containing a class inherited by the target element in the target project, wherein the node hierarchical structure comprises at least one class node; the second path of the file where the class inherited by the target element is located from the file path information comprises: for each class node, determining a second path of a second class corresponding to the class node from the file path information.

6. The query processing method of claim 4, wherein, The element information comprises an element name of the target element; and in a case where the second path identifier matches the target source code path identifier, the first query result of the use position of the target element from the source code file of the target project based on the element information comprises: determining, from a file in which a class inherited by the target element is located, a use position matching a class name of the class inherited by the target element and containing the element name, to obtain the first query result; The second query result of the use position of the target element from the compiled file of the target project includes: determining, from a file in which a class inherited by the target element is located, a use position matching a class name of the class inherited by the target element and containing the element name, to obtain the first query result; The second query result of the use position of the target element from the compiled file of the target project includes:

7. The query processing method of claim 4, wherein, The element information includes an element name of the target element; in a case where the third path identifier matches the target source code path identifier, the first query result of the use position of the target element from the source code file of the target project based on the element information includes: determining, from a file in which a class inherited by the target element is located, a use position matching a class name of the class inherited by the target element and containing the element name, to obtain the first query result; The second query result of the use position of the target element from the compiled file of the target project includes: determining, from a file in which a class inherited by the target element is located, a use position matching a class name of the class inherited by the target element and containing the element name, to obtain the first query result; The response to the use position query operation of the target element in the code of the target project includes:

8. The query processing method of any one of claims 1 to 7, characterized in that, In response to the use position query operation of the target element in the code of the target project, a query request of the target element is generated, and the query request includes element information of the target element and file path information corresponding to the target element; The query request is intercepted through a preset component, and the element information and the file path information are extracted from the query request. The device includes:

9. A query processing apparatus characterized by comprising: An information acquisition module is configured to, in response to a use position query operation of a target element in code of a target project, acquire element information of the target element and file path information corresponding to the target element. A query module is configured to, in a case where the file path information indicates that a target source code path is included, determine, based on the element information, a first query result of a use position of the target element from a source code file of the target project and determine a second query result of the use position of the target element from a compiled file of the target project. A result determination module is configured to determine a query result of the use position of the target element based on the first query result and the second query result. The computer program is stored in the memory and, when executed by the processor, causes the processor to perform the steps of the query processing method of any one of claims 1-8.

10. An electronic device, comprising: The computer program is stored in the memory and, when executed by the processor, causes the processor to perform the steps of the query processing method of any one of claims 1-8.

11. A computer readable storage medium characterized by: ​