WO2023173821A1 - 一种集成开发环境搜索数据的方法和相关设备 - Google Patents

一种集成开发环境搜索数据的方法和相关设备 Download PDF

Info

Publication number
WO2023173821A1
WO2023173821A1 PCT/CN2022/136812 CN2022136812W WO2023173821A1 WO 2023173821 A1 WO2023173821 A1 WO 2023173821A1 CN 2022136812 W CN2022136812 W CN 2022136812W WO 2023173821 A1 WO2023173821 A1 WO 2023173821A1
Authority
WO
WIPO (PCT)
Prior art keywords
search
distance
keywords
code
item
Prior art date
Application number
PCT/CN2022/136812
Other languages
English (en)
French (fr)
Inventor
王亚伟
丹尼斯杰尼先科
帕维尔彼得罗琴科
Original Assignee
华为云计算技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为云计算技术有限公司 filed Critical 华为云计算技术有限公司
Publication of WO2023173821A1 publication Critical patent/WO2023173821A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled

Definitions

  • Embodiments of the present application relate to the computer field, and mainly relate to a method for searching data in an integrated development environment, a computing device, a computing device, a chip system, and a computer-readable storage medium.
  • IDE Integrated development environment
  • IDE is an application used to provide a program development environment, which can include tools such as code editors, compilers, debuggers, and graphical user interfaces.
  • IDE can provide functions such as code writing function, analysis function, compilation function and debugging function.
  • IDE code search technology means that when a keyword or phrase is determined, the code search engine can obtain all search terms for the keyword or phrase.
  • search types can be divided into symbol search, text search and file search.
  • Symbol search is to obtain search entries in code files (such as classes, methods, etc.) based on strings of keywords or phrases.
  • Text search obtains search terms in plain text files based on keywords or phrases.
  • File search is to obtain search entries in the file system based on keywords or phrases.
  • the current IDE search technology can support symbol search and text search, and the obtained search items can be sorted and displayed according to the type of search items. However, since there are many search terms and they need to be sorted and displayed according to type, it is impossible to quickly locate the expected target search terms with fewer keywords or phrases.
  • Embodiments of the present application provide an integrated development environment data search method, computing device, computing equipment, chip system and computer-readable storage medium, which can quickly locate the target search item through fewer keywords or phrases, thereby Save time manually searching for target search terms and improve search accuracy.
  • a method for searching data in an integrated development environment includes: determining M search items based on the data source and N keywords; determining the order of the M search items, and the mth search item is in The sorting order among the M search items is positively related to the first distance and/or the second distance of the m-th search item; according to the determined sorting order, the M search items are displayed.
  • the first distance of the m-th search term is used to indicate the distance between the reference position and the positions of the N keywords included in the m-th search term
  • the second distance of the m-th search term is used to indicate the m-th search term in the data source. The distance between N keywords included in the search term.
  • the computing device can determine M search terms based on the data source and N keywords, and can also determine the order of each of the M search terms.
  • the computing device can arrange and display the search terms with a smaller first distance and/or a smaller second distance in a sequence with a smaller numerical value, so as to quickly locate the target search term with fewer keywords or phrases. , saving the time of manually searching for target search items and improving the accuracy of the search.
  • N third distances of the m-th search item are determined according to the positions of N keywords included in the m-th search item;
  • the N third distances of the items determine the first distance of the m-th search item; based on the first distances of the M search items, the order of the M search items is determined.
  • the positions of the N keywords included in the m-th search item are respectively the positions of the N keywords in the reference data.
  • the reference data includes the currently opened file, and the reference position is the position of the cursor before N keywords are obtained in the currently opened file, and/or the reference data includes record information, and the reference position is the latest record in the record information.
  • the computing device may determine the first distance of each search item based on the positions of the N keywords included in each search item, thereby determining the order of the M search items.
  • the computing device can arrange the search items with smaller first distances on data bits with smaller values, so that the search items on the data bits with smaller data values have a greater probability of being the target search items, saving manual search for the target search items. time to improve search accuracy.
  • the record information includes: any one or more of code history submission records, file system modification records, search records, or code browsing records.
  • the computing device can determine the position of the N keywords included in each search entry in any one or more of the code history submission records, file system modification records, search records, or code browsing records, The first distance of each search term is determined, thereby determining the order in which the M search terms are arranged.
  • the second search item of the m-th search item is determined based on the code-level distance and/or the file-level distance of the m-th search item. Distance; determine the order of the M search items based on the second distance of the M search items.
  • the code-level distance of the m-th search item includes the code-level distance of each two keywords in the m-th search item in the data source.
  • the file-level distance of the m-th search item includes the file-level distance of each two keywords in the m-th search item in the data source.
  • the computing device may determine the second distance of each search item based on the code-level distance and/or the file-level distance of each search item.
  • the computing device can arrange the search items with smaller second distances on the data bits with smaller values, so that the search items on the data bits with smaller data values have a greater probability of being the target search items, saving manual search for the target search items. time to improve search accuracy.
  • N keywords are respectively searched in the data source to obtain N search result sets; M search items are determined from the N search result sets.
  • the computing device can search for N keywords in the data source respectively, obtain N search result sets, and thereby determine M search items.
  • the computing device can obtain M search terms containing N keywords from the data source, thereby filtering the search terms containing only some of the N keywords, so that the probability that the finally presented search terms are the target search terms Larger to improve search accuracy.
  • the currently opened file includes any one or more of the following: the name of the currently opened file, the content of the currently opened file, or the arrangement order of the currently opened files, Code history submission records include code history submission content and/or code history submission names, file system modification records include file history modification names, search records include historical search content, and code browsing records include browsing code file contents and/or browsing code file names.
  • the computing device may locate one or more types of information included in the currently opened file and/or one or more types of information included in the record information based on the N keywords included in the m-th search item. , determine the first distance of the m-th search item, thereby determining the order of the M search items.
  • the data source includes any one or more of a code index of the project, a code index of a database on which the project depends, or a text index of the resource file of the project.
  • the computing device may determine M search terms including N keywords based on any one or more indexes included in the data source.
  • the computing device may also determine the second distance of the M search terms based on the distance between the N keywords included in the mth search term in any one or more indexes included in the data source.
  • a computer device in a second aspect, includes an acquisition module, a processing module and a display module.
  • the acquisition module is used to acquire N keywords
  • the processing module and the display module are used to implement the first aspect or any possible implementation manner of the first aspect.
  • a computer device comprising a processor coupled to a memory, reading and executing instructions and/or program codes in the memory to perform the first aspect or aspects any possible implementation.
  • a chip system in a fourth aspect, includes a logic circuit that is coupled to an input/output interface and transmits data through the input/output interface to perform the first aspect or any one of the first aspects. possible implementation methods.
  • a computer-readable storage medium stores program code.
  • the computer storage medium When the computer storage medium is run on a computer, it causes the computer to execute the first aspect or any one of the first aspects. possible implementation methods.
  • inventions of the present application provide a computer program product.
  • the computer program product includes: computer program code.
  • the computer program code When the computer program code is run on a computer, it causes the computer to execute the first aspect or any of the first aspects.
  • Figure 1 is a schematic structural block diagram of an IDE search data system according to an embodiment of the present application.
  • Figure 2 is a schematic flow chart of a method for searching data by an IDE according to an embodiment of the present application.
  • Figure 3 is a schematic diagram of determining M search terms according to an embodiment of the present application.
  • Figure 4 is a schematic diagram of the code hierarchy of a data source according to an embodiment of the present application.
  • Figure 5 is a schematic flowchart of a method for searching data by an IDE according to another embodiment of the present application.
  • Figure 6 is a schematic diagram of the code hierarchy of a data source according to another embodiment of the present application.
  • Figure 7 is a schematic flowchart of a method for searching data by an IDE according to another embodiment of the present application.
  • Figure 8 is a schematic rendering of a method for searching data in an IDE according to an embodiment of the present application.
  • Figure 9 is a schematic structural diagram of a computing device according to an embodiment of the present application.
  • Figure 10 is a schematic structural diagram of a computing device according to an embodiment of the present application.
  • FIG. 1 is a schematic structural block diagram of the IDE search data system 100.
  • the IDE search data system shown in FIG. 1 includes a processing component 110 and a display component 120.
  • the processing component 110 may determine M search terms according to the data source and the N keywords, and the m-th search term among the M search terms includes the N keywords.
  • the data source includes any one or more of the code index of the project, the code index of the database on which the project depends, or the text index of the resource file of the project.
  • the processing component 110 can search for N keywords in the data source, obtain N search result sets, and thereby determine M search items.
  • the N search result sets correspond to N keywords one-to-one, and the n-th search result set among the N search result sets includes at least one search result containing the n-th keyword.
  • the processing component may also determine a ranking order of the M search terms, wherein a ranking order of the mth search term among the M search terms is positively related to the first distance and/or the second distance of the mth search term.
  • the first distance of the m-th search term is used to indicate the distance between the reference position and the positions of the N keywords included in the m-th search term
  • the second distance of the m-th search term is used to indicate the m-th search term in the data source.
  • Reference data can include currently open files or record information.
  • the reference position is the position of the cursor before obtaining N keywords in the currently open file; when the reference data includes record information, the reference position is the latest record in the record information.
  • Record information includes: any one or more of code history submission records, file system modification records, search records, or code browsing records.
  • the first distance of the m 1 -th search entry is greater than the first distance of the m 2 -th search entry
  • it can be determined that the value of the sequence bit of the m 1 -th search entry is greater than the value of the sequence bit of the m 2 -th search entry numerical value.
  • the second distance of the m 1 -th search entry is greater than the second distance of the m 2- th search entry
  • it can be determined that the value of the sequence bit of the m 1 -th search entry is greater than the value of the sequence bit of the m 2 -th search entry. numerical value.
  • the fourth distance of the m 1th search entry is greater than the fourth distance of the m 2 search entry
  • the value of the sequence bit of the m 1th search entry is greater than the value of the sequence bit of the m 2 search entry numerical value.
  • the display component 120 may display the M search items according to the determined arrangement order. For example, assuming that the ranking order of the m 1th search item is 2 and the ranking order of the m 2 search item is 1, the display component 120 can display the m 2th search item and the m 1th search sequentially from top to bottom. entry.
  • the IDE search data system 100 shown in Figure 1 can run in a computing device.
  • the IDE search data system shown in Figure 1 can determine M search items based on N keywords, and can also determine the order of each of the M search items. This method can arrange the search items with smaller first distance and/or second distance in a sequence position with a smaller value, even if the search item with a smaller value in the sequence position has a greater probability of being the target search entry. In other words, the system can quickly locate the target search item with fewer keywords or phrases, thereby saving the time of manually finding the target search item and improving the accuracy of the search.
  • Figure 2 is a schematic flow chart of a method for IDE to search data.
  • the method in Figure 2 can be executed by the IDE search data system in Figure 1.
  • the method in Figure 2 includes the following steps.
  • S210 Determine M search terms based on the data source and N keywords.
  • the computing device may search the data source for N keywords, thereby determining M search terms.
  • the data source may include any one or more of the following: the code index of the project, the code index of the database on which the project depends, or the text index of the project's resource files.
  • the computing device can search for N keywords in the data source, obtain N search result sets, and determine M search items from the N search result sets.
  • the n-th search result set among the N search result sets includes search results obtained by searching for the n-th keyword among the N keywords in the data source.
  • the computing device can search for the keyword in the data source and obtain a set of search results for the keyword.
  • the computing device may also treat each search result in the search result set as a search item, thereby obtaining M search items.
  • the computing device can search for the N keywords in the data source respectively, and obtain a search result set for each keyword, that is, obtain N search result sets.
  • the computing device may also determine M search terms from the set of N search results.
  • the specific method of determining M search items from the N search result sets may be as shown in Figure 3 .
  • Figure 3 is a schematic diagram of determining M search terms.
  • the type of search results can include one or more of packages, classes, methods, texts, and files.
  • the types of search results may be the same or different, which is not limited in the embodiments of the present application.
  • the computing device may combine one type of search results for each keyword with other types of search results for other keywords except that type, and the types of the combined search results for each keyword are different, so that Obtain M search items, all of which actually exist in the data source.
  • Other keywords are keywords other than this keyword.
  • the m-th search entry actually exists in the data source.
  • the m-th search entry is any of the path, file name, package name, class name, method name, or text that already exists in the data source, and is not due to a combination. Created paths or names that do not exist in the data source.
  • the class name is a class name that already exists in the data source, rather than a class name that is created due to combination and does not exist in the data source.
  • the mth search entry is a path, then the path is an existing path in the data source, rather than a path created due to combination that does not exist in the data source.
  • the search results obtained by searching for row in the data source shown in Figure 4 are row1, row2, and rowlength
  • the search results obtained by searching for bar in the data source are bar and barMethod.
  • the type of row1 and row2 is class
  • the type of rowlength is text
  • the type of bar is package
  • the type of barMethod is method. Since in the code hierarchy of the data source as shown in Figure 4, package bar is the ancestor node of class row1, so bar.row1 is the name of the existing class in the data source. In the same way, bar.row2 is the class name that already exists in the data source.
  • row2.barMethod is the method name that already exists in the data source.
  • bar.row2.barMethod is an existing method name in the data source, and bar.row2.barMethod and row2.barMethod are actually the same method name, so you can keep only one of bar.row2.barMethod and row2.barMethod.
  • the ancestor node of the text rowlength does not contain any one or more of the methods, classes, or packages of the keyword bar, the text rowlength is obtained by combining any of the search results of the keyword bar.
  • class row1 is not the ancestor node of method barMethod, the class name obtained after combining class row1 and method barMethod is not an existing method name in the data source, so class row1 and method barMethod cannot be combined to obtain search entries.
  • the search item that can be obtained is row2.barMethod.
  • the search items you can get are: bar.row1, bar.row2, row2.barMethod.
  • the symbol that connects each search result after the keyword search results are combined can be predefined, for example, it can be bar.row1, or it can be bar:row1.
  • the symbol ".” and the symbol ":" are symbols that connect different types of search results.
  • the symbols connecting different types of search results in the same data source can be the same or different.
  • the symbols connecting different types of search results in different data sources may be the same or different, and the embodiments of the present application are not limited to this.
  • the specific method of determining M search items from N search result sets may also be: determining M search results containing N keywords from N search sets, and Each search result containing N keywords is treated as a search term.
  • the search results obtained by searching for test in the data source are test1, testfoo1, and testfoo2
  • the search results obtained by searching for foo in the data source are testfoo1, testfoo2
  • the five search results are The types are all classes.
  • two search result sets can be obtained, namely ⁇ test1, testfoo1, testfoo2 ⁇ and ⁇ testfoo1, testfoo2 ⁇ .
  • the class testfoo1 included in the two search result sets is the same class, and the class testfoo2 is also the same class
  • the two search items can be determined from the two search result sets: testfoo1 and testfoo2.
  • the embodiment of the present application does not limit the form of keyword search results.
  • the search results for a keyword may include one or more character strings, and one or more of the character strings may be exactly the same as the keyword.
  • the search result obtained by searching for test in the data source is test, and the type of the search result is class.
  • the search result obtained by searching for test in the data source is packagecom1.test, where packagecom1 is the package containing class test.
  • the search result packagecom1.test contains two strings, namely packagecom1 and test.
  • the search results for keywords may include one or more character strings, where some characters in one or more character strings are exactly the same as the keywords.
  • the search result obtained by searching for test in the data source is testfoo
  • the type of the search result is class.
  • the search result obtained by searching for test in the data source is: packagecom1.testfoo, where packagecom1 is the package containing class testfoo.
  • the search result packagecom1.testfoo contains two strings, namely packagecom1 and testfoo.
  • the search results obtained by searching for test in the data source are: packagecom1.test1, packagecom1.test2 and packagecom2.testfoo. Then it can be determined that the search result set of the keyword test is ⁇ packagecom1.test1, packagecom1 .test2, packagecom2.testfoo ⁇ .
  • the types of 3 search results are all classes.
  • the three search items that can be determined based on the search result set are packagecom1.test1, packagecom1.test2, and packagecom2.testfoo.
  • packagecom1 is the package containing classes test1 and test2
  • packagecom2 is the package containing class testfoo.
  • the search results obtained by searching for test in the data source are packagecom1.test1, packagecom2.testfoo1, and packagecom2.testfoo2.
  • the search results obtained by searching for foo in the data source are packagecom2.testfoo1, packagecom2.testfoo2, and the types of the five search results are all classes. That is to say, according to the keywords test and foo, the two search result sets that can be obtained are ⁇ packagecom1.test1, packagecom2.testfoo1, packagecom2.testfoo2 ⁇ , ⁇ packagecom2.testfoo1, packagecom2.testfoo2 ⁇ . According to the two search result sets, the two search items can be determined to be packagecom2.testfoo1 and packagecom2.testfoo2. Among them, packagecom2 is the package containing classes testfoo1 and testfoo2.
  • the keywords are row and bar
  • the search results obtained by searching for row in the data source are bar.row1, packagecom3.row2, and rowlength
  • the search results obtained by searching for bar in the data source are bar, packagecom3.row2. barMethod.
  • the two search result sets that can be obtained are ⁇ bar.row1, packagecom3.row2, rowlength ⁇ and ⁇ bar, packagecom3.row2.barMethod ⁇ .
  • the type of row1 and row2 is class
  • the type of rowlength is text
  • the type of bar is package
  • the type of barMethod is method.
  • the two search items can be determined to be bar.row1 and packagecom3.row2.barMethod.
  • packagecom3 is the package containing class row2.
  • the search entry may be a path located starting from the package, or may be a path located starting from the file, or may be a path located starting from the class, which is not limited in the embodiment of the present application.
  • the search entry may be a path, or the search entry may be in one or more forms such as file name, package name, class name, method name, etc., which is not limited in the embodiments of the present application.
  • the computing device may obtain the data source before step S210.
  • This embodiment of the present application does not specifically limit the manner in which the computing device obtains the data source.
  • S220 Determine the order of the M search items.
  • the computing device may determine a ranking order of each of the M search terms, wherein the ranking order of the mth search term is positively related to the first distance and/or the second distance of the mth search term.
  • the ranking order of the mth search term is positively related to the first distance and/or the second distance of the mth search term.
  • the sort order of the m 2 search item can be is 1.
  • the fourth distance of the m 1 -th search item is a distance determined based on the first distance and the second distance of the m 1 -th search item.
  • the first distance of the m-th search term is used to indicate the distance between the reference position and the positions of the N keywords included in the m-th search term.
  • the second distance of the m-th search term is used to indicate the distance between N keywords included in the m-th search term in the data source.
  • the positions of the N keywords included in the m-th search item are respectively the positions of the N keywords in the reference data.
  • Reference data can include currently open files or record information. When the reference position includes the currently open file, the reference position is the position of the cursor before acquiring N keywords in the currently open file. Alternatively, in the case where the reference data includes record information, the reference position is the latest record in the record information. Record information includes: any one or more of code history submission records, file system modification records, search records, or code browsing records.
  • the three search terms obtained by searching for test in the data source are packagecom1.test1, packagecom1.test2, and packagecom2.testfoo. If the distance between the position of the keyword test in packagecom1.test1 in the currently opened file and the position of the cursor before obtaining N keywords is a 1 , the position of the keyword test in packagecom1.test2 in the currently opened file The distance from the position of the cursor before obtaining N keywords is b 1 . The distance between the position of the keyword test in packagecom2.testfoo in the currently opened file and the position of the cursor before obtaining N keywords is c 1 .
  • the order of the three search items is: packagecom2.testfoo, packagecom1.test2, packagecom1. test1.
  • the position of the keyword test in packagecom1.test2 in the currently opened file is the same as the position of the latest record in the historical submission record.
  • the distance between the position of the cursor before N keywords is b 2
  • the distance between the position of the keyword test in packagecom2.testfoo in the currently opened file and the position of the cursor before obtaining N keywords is c 2 .
  • the two search terms obtained by searching for test in the data source are packagecom2.testfoo1 and packagecom2.testfoo2. If the distance between the position of the keyword test in packagecom2.testfoo1 in the currently opened file and the position of the cursor before obtaining N keywords is d 1 , since the keyword test and foo in packagecom2.testfoo1 belong to the same string testfoo1 , so the distance between the position of the keyword foo in packagecom2.testfoo1 in the currently opened file and the position of the cursor before obtaining N keywords is also d 1 .
  • the distance between the position of the keyword test in packagecom2.testfoo1 in the currently opened file and the position of the cursor before obtaining N keywords is e 1.
  • the position of the keyword foo in packagecom2.testfoo1 in the currently opened file is e 1.
  • the distance between the position and the position of the cursor before obtaining N keywords is also e 1 .
  • the first distances of the two search items are d 1 +d 1 and e 1 +e 1 respectively, and d 1 +d 1 >e 1 +e 1 , then the order of the two search items is: packagecom2.testfoo2, packagecom2.testfoo1.
  • the keywords are row and bar
  • the two search items obtained by searching for row in the data source are com.bar.test.row1 and packagecom3.row2.barMethod.
  • the distance between the position of the keyword row in com.bar.test.row1 in the currently opened file and the position of the cursor before obtaining N keywords is f 1
  • the keyword bar in com.bar.test.row1 The distance between the position in the currently opened file and the position of the cursor before obtaining N keywords is f 2
  • the distance between the position of the keyword row in packagecom3.row2.barMethod in the currently opened file and the position of the cursor before obtaining N keywords is g 1.
  • the keyword bar in packagecom3.row2.barMethod is in the currently opened file.
  • the distance between the position in and the position of the cursor before obtaining N keywords is g 2 .
  • the order of the two search items can be: packagecom3.row2 .barMethod, com.bar.test.row1.
  • the distance between the keyword row in com.bar.test.row1 and the keyword bar in the data source is f 3
  • the distance between the keyword row in packagecom3.row2.barMethod and the keyword bar in the data source is g3 .
  • the order of the two search items can be packagecom3.row2.barMethod, com.bar.test.row1.
  • the order of the two search items can be packagecom3.row2.barMethod, com.bar.test.row1.
  • the fourth distance of the m-th search item may be the average of the first distance and the second distance, that is, the fourth distance of the m-th search item may be (f 1 +f 2 +f 3 )/2. Or, if f 1 +f 2 ⁇ f 3 , the fourth distance of the m-th search item can be the minimum value of the first distance and the second distance, that is, the fourth distance of the m-th search item can be f 1 +f 2 .
  • the computing device may determine a fourth distance of the m-th search item based on the first distance and the second distance of the m-th search item.
  • the computing device may also determine a weight for the m-th search term based on the fourth distance of the m-th search term. Among them, the weight of the m-th search item is inversely proportional to the fourth distance of the m-th search item.
  • the computing device may also determine a ranking order of the M search terms based on the weight of each of the M search terms. Among them, the weight of the m-th search item is inversely proportional to the order of the m-th search item.
  • the computing device may determine the fourth distance of the m-th search item in a variety of specific ways, and the embodiments of the present application are not limited thereto.
  • the three search terms obtained by searching for test in the data source are packagecom1.test1, packagecom1.test2, and packagecom2.testfoo.
  • the first distances of the three search items are a 1 , b 1 , c 1 respectively, and a 1 ⁇ b 1 ⁇ c 1
  • the distances of the three search items can be determined
  • the weights are y 1 , y 2 , and y 3 respectively, and y 1 >y 2 >y 3 . According to the weights of the three search items, it can be determined that the order of the three search items is: packagecom1.test1, packagecom1.test2, and packagecom2.testfoo.
  • the two search items obtained by searching for row in the data source are com.bar.test.row1 and packagecom3.row2.barMethod.
  • the second distances of the two search items are f 3 and g 3 respectively, and f 3 >g 3 .
  • the weights of the two search items are z 1 , z 1 and g 3 respectively. z 2 , and z 1 ⁇ z 2 .
  • the order of the two search items is: packagecom3.row2.barMethod, com.bar.test.row1.
  • the computing device may determine the first distance and/or the second distance of the m-th search entry.
  • the specific implementation manner of the computing device determining the first distance and/or the second distance of the m-th search item may refer to the description of FIG. 5 .
  • the computing device can determine M search terms based on the N keywords, and can also determine the order of the m-th search term among the M search terms. In addition, the computing device may arrange and display the search items that are closer to the reference position and/or are closer to the keywords in a sequence position with a smaller value, so that the search terms are in a sequence position with a smaller value. The probability that the search entry is the target search entry is greater. In other words, the computing device can quickly locate the target search item using fewer keywords or phrases, thereby saving the time of manually searching for the target search item and improving the accuracy of the search.
  • S320 Determine the first distance of the m-th search item based on the distance between the reference position and the positions of the N keywords included in the m-th search item.
  • the computing device may determine a first distance of an m-th search term among the M search search terms, and the first distance of the m-th search term may be used to indicate that the reference position is in reference to the N keywords included in the m-th search term. The distance of the location in the data.
  • the reference data may include currently open files and/or record information.
  • Record information can include any one or more of the following: code history submission records, file system modification records, search records, or code browsing records.
  • the currently opened file data may include any one or more of the following: the name of the currently opened file, the content of the currently opened file, or the arrangement order of the currently opened files.
  • the code history submission record may include the code history submission content and/or the code history submission name, and the code history submission record may also include the code history submission time.
  • the file system modification record may include the file's historical modification name, and the file system modification record may also include the file's historical modification time.
  • the search history can include historical search content, and the search history can also include historical search time.
  • the code browsing record may include the content of the historical code file and/or the name of the historical code file.
  • the code browsing record may also include the time of the historical code file browsing.
  • the reference position may include the position of the cursor before acquiring N keywords or the latest record in the record information.
  • the reference position when the reference data is a currently opened file, the reference position may be the position of the cursor before acquiring N keywords in the currently opened file.
  • the reference location In the case where the reference data is a code history commit record, the reference location may be the latest code history commit record. In the case where the reference data is a file system modification record, the reference location may be the latest file system modification record. In the case where the reference data is a search record, the reference position may be the latest search record. When the reference data is a code browsing record, the reference position may be the latest code browsing record.
  • the reference position may be predefined, which is not limited in the embodiments of the present application.
  • the distance between the reference position and the position of the n-th keyword of the m-th search entry can be based on The line spacing and/or column spacing between the reference position and the position of the nth keyword are determined.
  • the reference position and the position of the n-th keyword of the m-th search entry are in the same code history submission record, that is, the reference position is the latest code history submission record, and the n-th key of the m-th search entry
  • the position of the word is located in the latest code history commit record, and the distance between the reference position and the position of the n-th keyword of the m-th search entry is 0.
  • the reference position and the n-th keyword position of the m-th search entry are in different code history submission records, that is, the reference position is the latest code history submission record, and the n-th key position of the m-th search entry is The position of the word is located in the code history submission record except the latest code history submission record.
  • the distance between the reference position and the n-th keyword position of the m-th search entry can be based on the distance between the reference position and the n-th keyword position.
  • the number of code history commit records is determined.
  • a specific implementation method for determining the N third distances of the m-th search item may be, for example: based on the n-th keyword in the m-th search item.
  • the distance between the position of the keyword in the currently opened file and the position of the cursor before obtaining N keywords determines the n-th third distance of the m-th search entry.
  • the distance between the word's position in the historical submission record and the latest historical submission record, etc. determines the n-th third distance of the m-th search entry, which is not limited in the embodiment of the present application.
  • a specific method of determining the first distance of the m-th search item based on the N third distances of the m-th search item may be: adding the N third distances to determine the first distance.
  • the specific method of determining the first distance of the mth search item may be: averaging the N third distances, determining the first distance, etc., this application implements The examples are not specifically limited.
  • the currently open files are arranged in the following order: currently open file A, currently open file B, and currently open file E. Among them, there is one currently open file between the currently open file B and the currently open file A, and there are two currently open files between the currently open file E and the currently open file A. If the reference data is the current file, the reference position is the position of the cursor before obtaining N keywords in the currently opened file.
  • the three search terms obtained by searching for test in the data source are packagecom1.test1, packagecom1.test2, and packagecom2.testfoo. If the keyword test in packagecom1.test1 is located at line 39 in the currently opened file A, and the reference position is line 10 in the currently opened file A, then the third distance of the search entry packagecom1.test1 is 29 . The first distance determined based on the third distance is 29. If the position of the keyword test in the search entry packagecom1.test2 in the currently opened file A is line 45, then the third distance of the search entry packagecom1.test1 is 35. The first distance determined based on the third distance is 35.
  • the third distance of the search entry packagecom2.testfoo is 1 ⁇ 1 .
  • ⁇ 1 represents a preset threshold, which can be, for example, 100, 500, 1000, etc.
  • the first distance determined based on the third distance is 1 ⁇ 1 .
  • the two search terms obtained by searching for test and foo in the data source are packagecom2.testfoo1 and packagecom2.testfoo2.
  • the reference position is line 10 at currently opened file A. Since the keyword test and foo in packagecom2.testfoo1 belong to the same string testfoo1, the position of the keyword foo in the search entry packagecom2.testfoo1 in the currently opened file A is also line 50, then the 2 of packagecom2.testfoo1
  • the third distances are 40 and 40 respectively. The first distance determined based on the two third distances is 80.
  • the reference position is the code history submission record C.
  • the third distance of the search entry com.bar.test.row1 is 0. The first distance determined based on the third distance is 0. If the keyword row in the search item packagecom3.row2.barMethod is in the code history submission record F, and the keyword bar in the search item packagecom3.row2.barMethod is in the code history submission record F.
  • the distance between the keyword row in com.bar.test.row1 and the first reference position in the currently opened file A is 15
  • the keyword bar in com.bar.test.row1 is in the currently opened file A.
  • the distance between the center and the first reference position is 5.
  • the first reference position is the position of the cursor before acquiring N keywords in the currently opened file A.
  • the distance between the keyword row in com.bar.test.row1 and the second reference position in the code history submission record C is 0, and the keyword bar in com.bar.test.row1 is in the code history submission record C.
  • the distance from the second reference position is 0, where the second reference position is the code history commit record C.
  • the third distance for the search entry com.bar.test.row1 can be 20.
  • the first distance determined based on the third distance is 20.
  • the computing device may determine a second distance of an m-th search term among the M search terms, the second distance of the m-th search term being used to indicate a distance between N keywords included in the m-th search term in the data source.
  • distance The data source includes any one or more of the code index of the project, the code index of the database on which the project depends, or the text index of the resource file of the project.
  • package 1 is test1
  • class 1 is foo1
  • class 2 is bar
  • method 1 is foo2.
  • search item 1 is test1.foo1
  • search item 2 is test1.bar.foo2. Since package 1 and class 1 have a direct inclusion relationship in the code level of the data source, the distance between the two keywords of search item 1 in the code level of the data source can be 1. Since in the code level of the data source, package 1 and method 1 have an indirect inclusion relationship, and package 1 and method 1 are only separated by one class 2, the distance between the two keywords of search item 2 in the code level of the data source can be 2.
  • the specific implementation method for the computing device to determine the code-level distance of the m-th search item may be: based on the minimum value of the code-level distance between the N keywords in the m-th search item, determine the code-level distance of the m-th search item. Code-level distance of m search terms. Or, determine the code-level distance of the m-th search item based on the sum of distances at the code-level of the data source between the N keywords in the m-th search item. Alternatively, determine the code-level distance of the m-th search item based on the average distance between the N keywords in the m-th search item at the code-level of the data source.
  • the two search terms obtained by searching for test and foo in the data source are packagecom2.testfoo1 and packagecom2.testfoo2, where packagecom2 is a package containing classes testfoo1 and class testfoo2.
  • the two search entries can be represented in the file hierarchy of the data source as C: ⁇ src ⁇ main ⁇ packagecom2 ⁇ testfoo1.java and C: ⁇ src ⁇ main ⁇ packagecom2 ⁇ testfoo2.java.
  • the keywords are row and bar
  • the two search terms obtained by searching for row and bar in the data source are com.bar.test.row1 and packagecom3.row2.barMethod.
  • row1 and row2 are classes
  • barMethod is the method.
  • the two search entries can be represented as C: ⁇ src ⁇ main ⁇ com ⁇ bar ⁇ test ⁇ row1.java and C: ⁇ src ⁇ main ⁇ packagecom3 ⁇ row2.java in the file hierarchy of the data source.
  • the keywords row and bar in com.bar.test.row1 belong to two strings row1 and bar
  • the keywords row and bar in packagecom3.row2.barMethod belong to two strings row2 and barMethod.
  • the keywords are row and bar
  • the two search terms obtained by searching for row and bar in the data source are packagecom3.row2.barMethod1 and packagecom3.row2.barMethod2.
  • barMethod1 and barMethod2 are methods. Since the keywords row and bar in packagecom3.row2.barMethod1 are directly adjacent at the code level, the code level distance of packagecom3.row2.barMethod1 is 1. Assume that the line spacing between the keywords row and bar in packagecom3.row2.barMethod1 is 20, and the line spacing between the keywords row and bar in packagecom3.row2.barMethod2 is 50.
  • the second distance of the search entry is 1.
  • the second distance of the search entry can be determined to be 20 based on the line spacing between the two keywords in packagecom3.row2.barMethod1.
  • the second distance of the search entry can be determined to be 1 based on the minimum value of the code level distance of packagecom3.row2.barMethod1 and the line spacing between the two keywords.
  • the distance between the N keywords of the m-th search item may be in units of 1, 10, or 100, which is not limited in the embodiment of the present application.
  • the code level distance of the search item packagecom3.row2.barMethod2 can be 1, or it can be 10, or it can be 100.
  • the computing device may determine a ranking order of the M search terms based on the first distance and/or the second distance of each of the M search terms.
  • the arrangement order of the m-th search item among the M search items is positively related to the first distance and/or the second distance of the m-th search item.
  • the computing device may determine the arrangement order of the M search terms based on the second distance of each of the M search terms. If the second distance of the m 1 -th search item is greater than the second distance of the m 2 -th search item, then the m 1 -th search item can be arranged in the sequence position with a larger value, and the m 2 -th search item can be arranged in in order of smaller values. For example, the m 1st search term is ranked as 2nd, and the m2th search term is ranked as 1st.
  • the computing device may determine a ranking order of the M search items based on a fourth distance of each of the M search items, where the fourth distance of the m-th search item is based on a fourth distance of the m-th search item.
  • the fourth distance of the m-th search item may be determined based on the sum of the first distance and the second distance of the m-th search item.
  • the fourth distance of the m-th search item may be determined based on the weighted sum of the first distance and the second distance of the m-th search item.
  • the fourth distance of the m-th search item may be determined based on the average of the first distance and the second distance of the m-th search item.
  • the fourth distance of the m-th search item may be determined based on the minimum value of the first distance and the second distance of the m-th search item, etc. This is not limited in the embodiments of the present application.
  • the computing device may determine a fourth distance of the m-th search item based on the first distance and the second distance of the m-th search item.
  • the computing device may also determine the weight of the m-th search item based on the fourth distance of the m-th search item, thereby determining the order of the M search items.
  • the weight of the m-th search term is negatively related to the fourth distance of the m-th search term.
  • the computing device may determine the fourth distance of the m-th search item in a variety of specific ways, and the embodiments of the present application are not limited thereto.
  • the weights of the three search items are determined to be: y 1 , y 2 , y 3 respectively, then the relationship between the weights of the three search items is: y 1 > y 2 > y 3 .
  • the order of the three search items is: packagecom1.test1, packagecom1.test2, and packagecom2.testfoo.
  • Figure 7 is a schematic rendering of the IDE's data search method.
  • Figure 7 includes the search bar, list of search terms, and document preview.
  • the keywords rest and temp can be entered in the search bar.
  • One or more sorted search terms can be displayed in the search term list.
  • Document preview allows you to preview the content or information contained in any search item when you select it.
  • the sorting can be performed according to the size of the second distance of the m 1th search item and the second distance of the m 2th search item.
  • sorting can be performed based on the size of the fourth distance of the m 1th search entry and the fourth distance of the m 2th search entry.
  • sorting can be performed based on the letters of the m 1 -th search entry and the letters of the m 2 -th search entry, etc., and the embodiment of the present application is not limited to this.
  • the order of M search items is determined based on the second distance of each search item, if the second distance of the m 1th search item is the same as the second distance of the m 2th search item, then It can be based on the size of the first distance between the m1th search item and the first distance on the m2th search item, or the size of the fourth distance between the m1th search item and the fourth distance on the m2th search item. , or any one or more of the letters of the m 1st search entry and the letters of the m 2nd search entry are sorted.
  • the computing device may determine the M search terms based on the N keywords, and may also determine the order of the M search terms based on the first distance and/or the second distance of each of the M search terms.
  • the computing device may arrange the search items with a smaller first distance, second distance or fourth distance in a sequence position with a smaller value, so that the search entry with a smaller value in the sequence position has a greater probability of being the target search entry. , saving the time of manually searching for target search items and improving the accuracy of the search.
  • step S410 Determine M search terms based on the data source and N keywords.
  • the specific implementation of step S410 is similar to step S210, and will not be described again here.
  • the computing device may determine whether the value of N is 1, or may determine whether the N keywords contained in the m-th search item among the M search items belong to a string, thereby determining whether it is necessary to determine the m-th search item's Two distance.
  • the N keywords of the m-th search item belong to the same string: for example, the keywords are test and foo, and the search items are packagecom2.testfoo1 and com.test2.foo3, then the keywords test and foo in the search item packagecom2.testfoo1 Belong to the same string testfoo1, but the keywords test and foo in the search entry com.test2.foo3 belong to different strings test2 and foo3.
  • the computing device may determine a first distance of the m-th search term and compare the first distance of the m-th search term with first distances of other search terms, thereby determining an arrangement of the M search terms order.
  • the other search terms are other search terms among the M search terms except the m-th search term.
  • the computing device does not need to determine the m-th search item. the second distance.
  • the computing device can determine a first distance for the mth search entry and compare the first distance for the mth search entry to any of a first distance, a second distance, or a fourth distance for other search entries. , thereby determining the order of M search items.
  • the computing device may determine that the N-th keyword of the m-th search item The first distance and/or the second distance, thereby determining the order of the M search entries.
  • step S440 Determine the first distance of the m-th search item.
  • the specific implementation of step S440 is similar to step S320, and will not be described again here.
  • step S450 Determine the second distance of the m-th search item.
  • the specific implementation of step S450 is similar to step S330, and will not be described again here.
  • step S460 Determine the arrangement order of the m-th search item based on the first distance and/or the second distance of the m-th search item.
  • the specific implementation of step S460 is similar to step S340, and will not be described again here.
  • the computing device may determine M search terms based on the N keywords, and may also determine whether it is necessary to determine a second distance for an m-th search term among the M search terms, thereby determining a first distance for each of the M search terms based on and/or the second distance, determine the order of M search items.
  • the computing device may arrange the search items with a smaller first distance and/or the second distance in a sequence position with a smaller value, so that the search entry with a smaller value in the sequence position has a greater probability of being the target search entry, saving money. Reduce the time required to manually find target search terms and improve search accuracy.
  • FIG. 9 is a schematic structural diagram of a computing device according to an embodiment of the present application.
  • Computing device 500 includes acquisition module 510, processing module 520, and display module 530.
  • the acquisition module 510 is used to acquire N keywords.
  • the processing module 520 is configured to determine M search items according to the data source and N keywords, and the m-th search item among the M search items includes N keywords.
  • the processing module 520 is also configured to determine the arrangement order of the M search items, and the arrangement order of the m-th search item among the M search items is positively correlated with the first distance and/or the second distance of the m-th search item.
  • the processing module 520 may perform some or all of steps S210 and S220 in the method of FIG. 2 , steps S310 to S340 in the method of FIG. 5 , and steps S410 to S460 in the method of FIG. 8 .
  • the display module 530 is used to display M search items according to the determined arrangement order.
  • the display module 530 may perform step S230 in the method of FIG. 2 .
  • FIG. 10 is a structural block diagram of a computing device provided according to an embodiment of the present application.
  • the computing device 600 shown in FIG. 10 includes: a processor 601, a memory 602, and a communication interface 603.
  • the processor 601, the memory 602, and the communication interface 603 communicate through a bus 604.
  • a general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
  • the steps of the method disclosed in conjunction with the embodiments of the present invention can be directly implemented by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor.
  • Software modules may be located in memory 602, which may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory.
  • non-volatile memory can be read-only memory (ROM), programmable ROM (PROM), erasable programmable read-only memory (erasable PROM, EPROM), electrically removable memory. Erase electrically programmable read-only memory (EPROM, EEPROM) or flash memory.
  • Volatile memory can be random access memory (RAM), which is used as an external cache.
  • RAM random access memory
  • DRAM dynamic random access memory
  • SDRAM synchronous dynamic random access memory
  • Double data rate synchronous dynamic random access memory double data date SDRAM, DDR SDRAM
  • enhanced synchronous dynamic random access memory enhanced SDRAM, ESDRAM
  • synchronous link dynamic random access memory serial DRAM, SLDRAM
  • direct rambus RAM, DR RAM direct rambus RAM, DR RAM
  • processor 601 reads the instructions in the memory 602 and completes the steps of the above method in combination with its hardware.
  • the memory 602 may store instructions for performing the methods performed by the computing devices in the above-described embodiments.
  • the processor 601 can execute the instructions stored in the memory 602 and combine with other hardware to complete the steps of the computing device in the above embodiments. The specific working process and beneficial effects can be described in the above embodiments.
  • the memory may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory.
  • non-volatile memory can be read-only memory (ROM), programmable ROM (PROM), erasable programmable read-only memory (erasable PROM, EPROM), electrically removable memory. Erase electrically programmable read-only memory (EPROM, EEPROM) or flash memory.
  • Volatile memory can be random access memory (RAM), which is used as an external cache.
  • RAM static random access memory
  • DRAM dynamic random access memory
  • SDRAM synchronous dynamic random access memory
  • double data rate SDRAM double data rate SDRAM
  • DDR SDRAM double data rate SDRAM
  • ESDRAM enhanced synchronous dynamic random access memory
  • SLDRAM synchronous link dynamic random access memory
  • direct rambus RAM direct rambus RAM
  • bus 604 may also include a power bus, a control bus, a status signal bus, etc.
  • bus 604 may also include a power bus, a control bus, a status signal bus, etc.
  • the various buses are labeled bus 604 in the figure.
  • Embodiments of the present application also provide a computer storage medium.
  • Program instructions are stored in the computer storage medium.
  • the program When executed, it may include part or all of the IDE data search method in the corresponding embodiments shown in Figures 2 to 8. step.
  • Embodiments of the present application also provide a chip system.
  • the chip system includes a logic circuit that is coupled to an input/output interface and transmits data through the input/output interface to perform except step S230 in the above embodiment.
  • the present application also provides a computer program product.
  • the computer program product includes: computer program code.
  • the computer program code When the computer program code is run on a computer, it causes the computer to execute each of the above embodiments. step.
  • the present application also provides a computer-readable medium.
  • the computer-readable medium stores program code.
  • the program code When the program code is run on a computer, it causes the computer to execute each of the above-mentioned embodiments. step.
  • the disclosed systems, devices and methods can be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components may be combined or can be integrated into another system, or some features can be ignored, or not implemented.
  • the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application can be integrated into one processing unit, each unit can exist physically alone, or two or more units can be integrated into one unit.
  • the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium.
  • the technical solution of the present application is essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product.
  • the computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program code. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请实施例提供了一种集成开发环境搜索数据的方法和相关设备。该方法包括:根据数据源与N个关键词,确定M个搜索条目(S210),其中M个搜索条目中的第m个搜索条目包括N个关键词,N、M为大于或等于1的正整数,m=1,......,M;确定M个搜索条目的排列顺序(S220),第m个搜索条目在M个搜索条目中的排列顺序与第m个搜索条目的第一距离和/或第二距离正相关;根据确定的排列顺序,显示M个搜索条目(S230)。该方法可以将第一距离和/或第二距离更小的搜索条目排列在数值更小的顺序位上,从而通过较少的关键词或词组,较为快速的定位到目标搜索条目,节约人工查找目标搜索条目的时间,提高搜索的准确度。

Description

一种集成开发环境搜索数据的方法和相关设备
本申请要求于2022年3月15日提交俄罗斯联邦专利局、申请号为RU2022106755、申请名称为“一种集成开发环境搜索数据的方法和相关设备”的俄罗斯专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请实施例涉及计算机领域,主要涉及一种集成开发环境搜索数据的方法、计算装置、计算设备、芯片系统和计算机可读存储介质。
背景技术
集成开发环境(integrated development environment,IDE)是用于提供程序开发环境的应用程序,可以包括代码编辑器、编译器、调试器和图形用户界面等工具。IDE可以提供代码编写功能、分析功能、编译功能与调试功能等功能。IDE代码搜索技术是指在确定关键词或词组的情况下,代码搜索引擎可以获得该关键词或词组的所有搜索条目。在搜索过程中,搜索类型可以划分为符号搜索、文本搜索与文件搜索。符号搜索为根据关键词或词组的字符串,在代码文件(例如:类、方法等)中获得搜索条目。文本搜索为根据关键词或词组在纯文本文件中获得搜索条目。文件搜索为根据关键词或词组在文件系统中获得搜索条目。目前的IDE搜索技术可以支持符号搜索与文本搜索,获得的搜索条目可以按照搜索条目的类型进行排序显示。但由于搜索条目较多,并且需要根据类型进行排序显示,因此无法通过较少的关键词或词组,较为快速的定位到预期希望获得的目标搜索条目。
因此,如何通过较少的关键词或词组,较为快速的定位到目标搜索条目成为亟待解决的问题。
发明内容
本申请实施例提供一种集成开发环境搜索数据的方法、计算装置、计算设备、芯片系统和计算机可读存储介质,可以通过较少的关键词或词组,较为快速的定位到目标搜索条目,从而节约人工查找目标搜索条目的时间,提高搜索的准确度。
第一方面,提供了一种集成开发环境搜索数据的方法,该方法包括:根据数据源与N个关键词,确定M个搜索条目;确定M个搜索条目的排列顺序,第m个搜索条目在M个搜索条目中的排列顺序与第m个搜索条目的第一距离和/或第二距离正相关;根据确定的排列顺序,显示M个搜索条目。
其中,M个搜索条目中的第m个搜索条目包括N个关键词,N、M为大于或等于1的正整数,m=1,……,M。第m个搜索条目的第一距离用于指示参考位置与第m个搜索条目包括的N个关键词的位置的距离,第m个搜索条目的第二距离用于指示在数据源中第m个搜索条目包括的N个关键词之间的距离。
本申请实施例中,计算设备可以根据数据源与N个关键词确定M个搜索条目,还可 以确定M个搜索条目中每个搜索条目的排列顺序。计算设备可以使第一距离和/或第二距离更小的搜索条目排列在数值更小的顺序位上,并显示出来,从而通过较少的关键词或词组,较为快速的定位到目标搜索条目,节约人工查找目标搜索条目的时间,提高搜索的准确度。
结合第一方面,在第一方面的某些实现方式中,分别根据第m个搜索条目包括的N个关键词的位置,确定第m个搜索条目的N个第三距离;根据第m个搜索条目的N个第三距离,确定第m个搜索条目的第一距离;根据M个搜索条目的第一距离,确定M个搜索条目的排列顺序。
其中,第m个搜索条目的N个第三距离中的第n个第三距离是第m个搜索条目包括的N个关键词中的第n个关键词的位置到参考位置的距离,n=1,……,N。第m个搜索条目包括的N个关键词的位置分别为N个关键词在参考数据中的位置。参考数据包括当前打开的文件,参考位置为当前打开的文件中获取N个关键词前光标所在的位置,和/或,参考数据包括记录信息,参考位置为记录信息中的最新记录。
本申请实施例中,计算设备可以根据每个搜索条目包括的N个关键词的位置,确定每个搜索条目的第一距离,从而确定M个搜索条目的排列顺序。计算设备可以将第一距离较小的搜索条目排列在数值较小的数据位上,从而使数据值较小的数据位上的搜索条目为目标搜索条目的概率较大,节约人工查找目标搜索条目的时间,提高搜索的准确度。
结合第一方面,在第一方面的某些实现方式中,记录信息包括:代码历史提交记录、文件系统修改记录、搜索记录、或代码浏览记录中的任一个或多个。
本申请实施例中,计算设备可以根据每个搜索条目包括的N个关键词在代码历史提交记录、文件系统修改记录、搜索记录、或代码浏览记录中的任一个或多个记录中的位置,确定每个搜索条目的第一距离,从而确定M个搜索条目的排列顺序。
结合第一方面,在第一方面的某些实现方式中,在N≠1的情况下,根据第m个搜索条目的代码层次距离和/或文件层次距离,确定第m个搜索条目的第二距离;根据M个搜索条目的第二距离,确定M个搜索条目的排列顺序。
其中,第m个搜索条目的代码层次距离包括第m个搜索条目中的每两个关键词在数据源的代码层次的距离。第m个搜索条目的文件层次距离包括第m个搜索条目中的每两个关键词在数据源的文件层次的距离。
本申请实施例中,计算设备可以根据每个搜索条目的代码层次距离和/或文件层次距离,确定每个搜索条目的第二距离。计算设备可以将第二距离较小的搜索条目排列在数值较小的数据位上,从而使数据值较小的数据位上的搜索条目为目标搜索条目的概率较大,节约人工查找目标搜索条目的时间,提高搜索的准确度。
结合第一方面,在第一方面的某些实现方式中,在数据源中分别搜索N个关键词,获得N个搜索结果集合;从N个搜索结果集合确定M个搜索条目。
其中,N个搜索结果集合中的第n个搜索结果集合包括的搜索结果是在数据源中对N个关键词中的第n个关键词搜索得到的,第n个搜索结果集合包括至少一个包含第n个关键词的搜索结果,n=1,……,N。
本申请实施例中,计算设备可以在数据源中分别搜索N个关键词,获得N个搜索结果集合,从而确定M个搜索条目。计算设备可以从数据源中获得M个包含N个关键词的搜索条目,从而将仅包含N个关键词中部分关键词的搜索条目进行过滤,使最后呈现出的 搜索条目为目标搜索条目的概率较大,提高搜索的准确度。
结合第一方面,在第一方面的某些实现方式中,当前打开的文件包括以下任一种或多种:当前打开的文件名称、当前打开的文件内容、或当前打开的文件的排列顺序,代码历史提交记录包括代码历史提交内容和/或代码历史提交名称,文件系统修改记录包括文件历史修改名称,搜索记录包括历史搜索内容,代码浏览记录包括浏览代码文件内容和/或浏览代码文件名称。
本申请实施例中,计算设备可以根据第m个搜索条目中包括的N个关键词在当前打开的文件包括的一种或多种信息和/或记录信息包括的一种或多种信息的位置,确定第m个搜索条目的第一距离,从而确定M个搜索条目的排列顺序。
结合第一方面,在第一方面的某些实现方式中,数据源包括项目的代码索引、项目依赖的数据库的代码索引、或项目的资源文件的文本索引中的任一种或多种。
本申请实施例中,计算设备可以根据数据源中包括的任一种或多种索引,确定包括N个关键词的M个搜索条目。计算设备还可以根据在数据源包括的任一种或多种索引中第m个搜索条目中包括的N个关键词之间的距离,确定M个搜索条目的第二距离。
第二方面,提供了一种计算机装置,该计算机装置包括获取模块、处理模块与显示模块。其中,获取模块用于获取N个关键词,处理模块与显示模块用于实现第一方面或第一方面的任一种可能的实现方式。
第三方面,提供了一种计算机设备,该计算机设备包括处理器,该处理器用于与存储器耦合,读取并执行该存储器中的指令和/或程序代码,以执行第一方面或第一方面的任一种可能的实现方式。
第四方面,提供了一种芯片系统,该芯片系统包括逻辑电路,该逻辑电路用于与输入/输出接口耦合,通过该输入/输出接口传输数据,以执行第一方面或第一方面任一种可能的实现方式。
第五方面,提供了一种计算机可读存储介质,该计算机可读存储介质存储有程序代码,当该计算机存储介质在计算机上运行时,使得计算机执行如第一方面或第一方面的任一种可能的实现方式。
第六方面,本申请实施例提供一种计算机程序产品,该计算机程序产品包括:计算机程序代码,当该计算机程序代码在计算机上运行时,使得该计算机执行如第一方面或第一方面的任一种可能的实现方式。
附图说明
图1是根据本申请一个实施例的IDE搜索数据系统的示意性结构框图。
图2是根据本申请一个实施例的IDE搜索数据的方法的示意性流程图。
图3是根据本申请一个实施例的确定M个搜索条目的示意图。
图4是根据本申请一个实施例的数据源的代码层次的示意图。
图5是根据本申请另一实施例的IDE搜索数据的方法的示意性流程图。
图6是根据本申请另一实施例的数据源的代码层次的示意图。
图7是根据本申请另一实施例的IDE搜索数据的方法的示意性流程图。
图8是根据本申请一个实施例的IDE搜索数据的方法的示意性效果图。
图9是根据本申请一个实施例的计算装置的结构示意图。
图10是根据本申请一个实施例的计算设备的结构示意图。
具体实施方式
下面将结合附图,对本申请实施例中的技术方案进行描述。
本申请实施例的技术方案可以应用于各种配置有IDE的计算设备中,例如主机、笔记本电脑、台式电脑、工作站等,本申请实施例对此并不限定。
图1是IDE搜索数据系统100的示意性结构框图。如图1所示的IDE搜索数据系统包括处理组件110和显示组件120。
处理组件110可以根据数据源与N个关键词,确定M个搜索条目,该M个搜索条目中的第m个搜索条目包括该N个关键词。其中,数据源包括项目的代码索引、项目依赖的数据库的代码索引、或项目的资源文件的文本索引中的任一种或多种。N、M为大于或等于1的正整数,m=1,……,M。具体的,处理组件110可以在数据源中搜索N个关键词,获得N个搜索结果集合,从而确定M个搜索条目。该N个搜索结果集合与N个关键词一一对应,N个搜索结果集合中的第n个搜索结果集合包括至少一个包含第n个关键词的搜索结果。
处理组件还可以确定M个搜索条目的排列顺序,其中第m个搜索条目在M个搜索条目中的排列顺序与第m个搜索条目的第一距离和/或第二距离正相关。第m个搜索条目的第一距离用于指示参考位置与第m个搜索条目包括的N个关键词的位置的距离,第m个搜索条目的第二距离用于指示在数据源中第m个搜索条目包括的N个关键词之间的距离。参考数据可以包括当前打开的文件或记录信息。在参考数据包括当前打开的文件的情况下,参考位置为当前打开的文件中获取N个关键词前光标所在的位置;在参考数据包括记录信息的情况下,参考位置为记录信息中的最新记录。记录信息包括:代码历史提交记录、文件系统修改记录、搜索记录、或代码浏览记录中的任一个或多个。
例如,假设第m 1个搜索条目的第一距离大于第m 2个搜索条目的第一距离,则可以确定第m 1个搜索条目的顺序位的数值大于第m 2个搜索条目的顺序位的数值。例如,假设第m 1个搜索条目的第二距离大于第m 2个搜索条目的第二距离,则可以确定第m 1个搜索条目的顺序位的数值大于第m 2个搜索条目的顺序位的数值。例如,假设第m 1个搜索条目的第四距离大于第m 2个搜索条目的第四距离,则可以确定第m 1个搜索条目的顺序位的数值大于第m 2个搜索条目的顺序位的数值。其中,第m 1个搜索条目的第四距离为根据第m 1个搜索条目的第一距离与第二距离确定的距离。m 1≠m 2,m 1、m 2=1,……M。
显示组件120可以根据确定的排列顺序,显示M个搜索条目。例如,假设第m 1个搜索条目的排列顺序为2,第m 2个搜索条目的排列顺序为1,则显示组件120可以从上到下依次显示第m 2个搜索条目与第m 1个搜索条目。
图1所示的IDE搜索数据系统100可以在计算设备中运行。图1所示的IDE搜索数据系统可以根据N个关键词确定M个搜索条目,还可以确定该M个搜索条目中每个搜索条目的排列顺序。该方法可以使第一距离和/或第二距离更小的搜索条目排列在数值更小的顺序位上,即使数值更小的顺序位上的搜索条目为目标搜索条目的概率更大。也就是说,该系统可以通过较少的关键词或词组,较为快速的定位到目标搜索条目,从而节约人工查找目标搜索条目的时间,提高搜索的准确度。
图2是IDE搜索数据的方法的示意性流程图,图2中的方法可以由图1中的IDE搜 索数据系统执行。图2中的方法包括如下步骤。
S210,根据数据源与N个关键词,确定M个搜索条目。
计算设备可以在数据源中搜索N个关键词,从而确定M个搜索条目。该M个搜索条目中的第m个搜索条目中包括该N个关键词,N、M为大于或等于1的正整数,m=1,……,M。该数据源可以包括以下任一种或多种:项目的代码索引、项目依赖的数据库的代码索引、或项目的资源文件的文本索引。
具体的,计算设备可以在数据源中搜索N个关键词,获得N个搜索结果集合,并从N个搜索结果集合中确定M个搜索条目。该N个搜索结果集合中的第n个搜索结果集合包括的搜索结果是在数据源中对N个关键词中的第n个关键词搜索得到的。该第n个搜索结果集合包括至少一个包含第n个关键词的搜索结果,n=1,……,N。
在N为1的情况下,计算设备可以在数据源中搜索该关键词,获得该关键词的搜索结果集合。计算设备还可以将该搜索结果集合中的每个搜索结果作为一个搜索条目,从而获得M个搜索条目。在N不为1的情况下,计算设备可以在数据源中分别搜索该N个关键词,获得每个关键词的搜索结果集合,即获得N个搜索结果集合。计算设备还可以从该N个搜索结果集合中确定M个搜索条目。
可选地,在N不为1时,从N个搜索结果集合中确定M个搜索条目的具体方式可以如图3所示。
图3是确定M个搜索条目的示意图。在数据源中搜索N个关键词时,可以获得每个关键词的相同或不同类型的搜索结果,搜索结果的类型可以包括包、类、方法、文本、文件中的一种或多种。对于不同的数据源,搜索结果的类型可以相同,也可以不同,本申请实施例对此并不限定。
计算设备可以将每个关键词的一种类型的搜索结果与其他关键词的除该类型外的其他类型的搜索结果进行组合,并且组合后每个关键词的搜索结果的类型均不相同,从而获得M个搜索条目,该M个搜索条目均在数据源中真实存在。其他关键词为该除该关键词外的其他关键词。第m个搜索条目在数据源中真实存在为第m个搜索条目为数据源中已有的路径、文件名称、包名称、类名称、方法名称、或文本中的任一种,而不是由于组合而创造的、在数据源中不存在的路径或者名称等。
例如,若第m个搜索条目为类名称,那么该类名称为数据源中已有的类名称,而不是由于组合而创造出的、数据源中不存在的类名称。若第m个搜索条目为路径,那么该路径为数据源中已有的路径,而不是由于组合而创造出的、数据源中不存在的路径。
例如,假设关键词为row与bar,在如图4所示的数据源中搜索row可以获得的搜索结果为row1、row2与rowlength,在数据源中搜索bar可以获得的搜索结果为bar、barMethod。其中,row1与row2的类型为类,rowlength的类型为文本,bar的类型为包,barMethod的类型为方法。由于在如图4所示的数据源的代码层次中,包bar为类row1的祖先节点,因此bar.row1为数据源中已有的类名称。同理,bar.row2为数据源中已有的类名称。由于类row2为方法barMethod的祖先节点,因此row2.barMethod为数据源中已有的方法名称。同理,bar.row2.barMethod为数据源中已有的方法名称,并且bar.row2.barMethod与row2.barMethod实际为同一方法名称,因此可以仅保留bar.row2.barMethod与row2.barMethod中的一个。由于文本rowlength的祖先节点中没有包含关键词bar的方法、类、或包中的任一种或多种,因此文本rowlength与关键词bar的搜索结果中的任一个搜 索结果进行组合后获得的文本不是数据源中已有的文本,即文本rowlength无法与关键词bar的搜索结果中的任一个搜索结果进行组合,从而获得搜索条目。同理,由于类row1不是方法barMethod的祖先节点,因此类row1与方法barMethod组合后获得的类名称不是数据源中已有的方法名称,因此类row1与方法barMethod无法进行组合,从而获得搜索条目。
也就是说,将关键词row的类型为类的搜索结果与关键词bar的除类外的其他类型的搜索结果进行组合,可以获得3个搜索条目为bar.row1、bar.row2、row2.barMethod,其中bar.row1、bar.row2为数据源中已有的类名称,row2.barMethod为数据源中已有的方法名称。将关键词row的类型为文本的搜索结果rowlength与关键词bar的除文本外的其他类型的搜索结果进行组合,无法获得搜索条目。同理,将关键词bar的类型为包的搜索结果与关键词row的除包外的其他类型的搜索结果进行组合,可以获得的搜索条目为bar.row1、bar.row2。将关键词bar的类型为方法的搜索结果与关键词row的除方法外的其他类型的搜索结果进行组合,可以获得的搜索条目为row2.barMethod。也就是说,在数据源中搜索关键词row与bar,可以获得的搜索条目为:bar.row1、bar.row2、row2.barMethod。
可选地,关键词的搜索结果组合后连接每个搜索结果的符号可以预先定义,例如可以是bar.row1,或者可以是bar:row1。其中,符号“.”与符号“:”为连接不同类型的搜索结果的符号。相同的数据源中连接不同类型的搜索结果的符号可以相同,也可以不同。不同的数据源中连接不同类型的搜索结果的符号可以相同,也可以不同,本申请实施例对此并不限定。
可选地,在N不为1时,从N个搜索结果集合中确定M个搜索条目的具体方式还可以是:从N个搜索集合中确定M个包含N个关键词的搜索结果,并将每个包含N个关键词的搜索结果作为一个搜索条目。
例如,假设关键词为test与foo,在数据源中搜索test可以获得的搜索结果为test1、testfoo1与testfoo2,在数据源中搜索foo可以获得的搜索结果为testfoo1、testfoo2,并且该5个搜索结果的类型均为类。也就是说,可以获得两个搜索结果集合,分别为{test1,testfoo1,testfoo2}与{testfoo1,testfoo2}。在两个搜索结果集合中包含的类testfoo1为同一个类,并且类testfoo2也为同一个类的情况下,从该两个搜索结果集合中可以确定2个搜索条目分别为:testfoo1与testfoo2。
可选地,本申请实施例对关键词的搜索结果的形式并不限定。关键词的搜索结果中可以包括一个或多个字符串,其中一个或多个字符串可以与关键词完全相同。例如,假设关键词为test,在数据源中搜索test可以获得的搜索结果为test,并且该搜索结果的类型为类。或者,在数据源中搜索test可以获得的搜索结果为packagecom1.test,其中packagecom1为包含类test的包。搜索结果packagecom1.test中包含两个字符串,分别为packagecom1与test。
或者,关键词的搜索结果可以包括一个或多个字符串,其中一个或多个字符串中的部分字符与关键词完全相同。例如,假设关键词为test,在数据源中搜索test可以获得的搜索结果为testfoo,并且该搜索结果的类型为类。或者,在数据源中搜索test可以获得的搜索结果为:packagecom1.testfoo,其中packagecom1为包含类testfoo的包。搜索结果packagecom1.testfoo中包含两个字符串,分别为packagecom1与testfoo。
例如,假设关键词为test,在数据源中搜索test可以获得的搜索结果为: packagecom1.test1、packagecom1.test2与packagecom2.testfoo,那么可以确定关键词test的搜索结果集合为{packagecom1.test1,packagecom1.test2,packagecom2.testfoo}。其中,3个搜索结果的类型均为类。根据该搜索结果集合可以确定的3个搜索条目分别为packagecom1.test1、packagecom1.test2与packagecom2.testfoo。其中,packagecom1为包含类test1与test2的包,packagecom2为包含类testfoo的包。
例如,假设关键词为test与foo,在数据源中搜索test可以获得的搜索结果为packagecom1.test1、packagecom2.testfoo1与packagecom2.testfoo2,在数据源中搜索foo可以获得的搜索结果为packagecom2.testfoo1、packagecom2.testfoo2,并且该5个搜索结果的类型均为类。也就是说,根据关键词test与foo,可以获得的2个搜索结果集合分别为{packagecom1.test1,packagecom2.testfoo1,packagecom2.testfoo2}、{packagecom2.testfoo1,packagecom2.testfoo2}。根据该2个搜索结果集合,可以确定2个搜索条目为packagecom2.testfoo1与packagecom2.testfoo2。其中,packagecom2为包含类testfoo1与testfoo2的包。
例如,假设关键词为row与bar,在数据源中搜索row可以获得的搜索结果为bar.row1、packagecom3.row2与rowlength,在数据源中搜索bar可以获得的搜索结果为bar、packagecom3.row2.barMethod。也就是说,根据关键词row与bar,可以获得的2个搜索结果集合分别为{bar.row1,packagecom3.row2,rowlength}、{bar,packagecom3.row2.barMethod}。其中,row1与row2的类型为类,rowlength的类型为文本,bar的类型为包,barMethod的类型为方法。根据该2个搜索结果集合,可以确定2个搜索条目为bar.row1、packagecom3.row2.barMethod。其中,packagecom3为包含类row2的包。
可选地,搜索条目可以是从包开始定位的路径,也可以是从文件开始定位的路径,或者可以是从类开始定位的路径,本申请实施例对此并不限定。
可选地,搜索条目可以是路径,或者搜索条目可以是文件名称、包名称、类名称、方法名称等一种或多种形式,本申请实施例对此并不限定。
可选地,计算设备可以在步骤S210前获得数据源,本申请实施例对计算设备获得数据源的方式不做具体限定。
S220,确定M个搜索条目的排列顺序。
计算设备可以确定M个搜索条目中每个搜索条目的排列顺序,其中第m个搜索条目的排列顺序与第m个搜索条目的第一距离和/或第二距离正相关。换句话说,若第m 1个搜索条目的第一距离大于第m 2个搜索条目的第一距离,则当第m 1个搜索条目的排列顺序为2时,第m 2个搜索条目的排列顺序可以为1。或者,若第m 1个搜索条目的第二距离大于第m 2个搜索条目的第二距离,则当第m 1个搜索条目的排列顺序为2时,第m 2个搜索条目的排列顺序可以为1。或者,若第m 1个搜索条目的第四距离大于第m 2个搜索条目的第四距离,则当第m 1个搜索条目的排列顺序为2时,第m 2个搜索条目的排列顺序可以为1。第m 1个搜索条目的第四距离为根据第m 1个搜索条目的第一距离与第二距离确定的距离。
第m个搜索条目的第一距离用于指示参考位置与第m个搜索条目包括的N个关键词的位置的距离。第m个搜索条目的第二距离用于指示在数据源中第m个搜索条目包括的N个关键词之间的距离。第m个搜索条目包括的N个关键词的位置分别为N个关键词在参考数据中的位置。参考数据可以包括当前打开的文件或记录信息。在参考位置包括当前打开的文件的情况下,参考位置为当前打开的文件中获取N个关键词前光标所在的位置。 或者,在参考数据包括记录信息的情况下,参考位置为记录信息中的最新记录。记录信息包括:代码历史提交记录、文件系统修改记录、搜索记录、或代码浏览记录中的任一个或多个。
例如,假设关键词为test,在数据源中搜索test可以获得的3个搜索条目分别为packagecom1.test1、packagecom1.test2与packagecom2.testfoo。若packagecom1.test1中的关键词test在当前打开的文件中的位置与获取N个关键词前光标所在的位置的距离为a 1,packagecom1.test2中的关键词test在当前打开的文件中的位置与获取N个关键词前光标所在的位置的距离为b 1,packagecom2.testfoo中的关键词test在当前打开的文件中的位置与获取N个关键词前光标所在的位置的距离为c 1。假设3个搜索条目的第一距离分别为a 1、b 1、c 1,并且a 1>b 1>c 1,那么3个搜索条目的排列顺序为:packagecom2.testfoo、packagecom1.test2、packagecom1.test1。
若packagecom1.test1中的关键词test在历史提交记录中的位置与历史提交记录中的最新记录的位置的距离为a 2,packagecom1.test2中的关键词test在当前打开的文件中的位置与获取N个关键词前光标所在的位置的距离为b 2,packagecom2.testfoo中的关键词test在当前打开的文件中的位置与获取N个关键词前光标所在的位置的距离为c 2。假设3个搜索条目的第一距离分别为a 1+a 2、b 1+b 2、c 1+c 2,并且a 1+a 2>b 1+b 2>c 1+c 2,那么3个搜索条目的排列顺序为:packagecom2.testfoo、packagecom1.test2、packagecom1.test1。
例如,假设关键词为test与foo,在数据源中搜索test可以获得的2个搜索条目为packagecom2.testfoo1与packagecom2.testfoo2。若packagecom2.testfoo1中的关键词test在当前打开的文件中的位置与获取N个关键词前光标所在的位置的距离为d 1,由于packagecom2.testfoo1中的关键词test与foo属于同一字符串testfoo1,因此packagecom2.testfoo1中的关键词foo在当前打开的文件中的位置与获取N个关键词前光标所在的位置的距离也为d 1。packagecom2.testfoo1中的关键词test在当前打开的文件中的位置与获取N个关键词前光标所在的位置的距离为e 1,同理packagecom2.testfoo1中的关键词foo在当前打开的文件中的位置与获取N个关键词前光标所在的位置的距离也为e 1。假设2个搜索条目的第一距离分别为d 1+d 1、e 1+e 1,并且d 1+d 1>e 1+e 1,那么2个搜索条目的排列顺序为:packagecom2.testfoo2、packagecom2.testfoo1。
例如,假设关键词为row与bar,在数据源中搜索row可以获得的2个搜索条目为com.bar.test.row1、packagecom3.row2.barMethod。若com.bar.test.row1中的关键词row在当前打开的文件中的位置与获取N个关键词前光标所在的位置的距离为f 1,com.bar.test.row1中的关键词bar在当前打开的文件中的位置与获取N个关键词前光标所在的位置的距离为f 2。packagecom3.row2.barMethod中的关键词row在当前打开的文件中的位置与获取N个关键词前光标所在的位置的距离为g 1,packagecom3.row2.barMethod中的关键词bar在当前打开的文件中的位置与获取N个关键词前光标所在的位置的距离为g 2。假设2个搜索条目的第一距离分别为f 1+f 2、g 1+g 2,并且f 1+f 2>g 1+g 2,那么2个搜索条目的排列顺序可以为:packagecom3.row2.barMethod、com.bar.test.row1。
或者,若com.bar.test.row1中的关键词row与关键词bar在数据源中的距离为f 3,packagecom3.row2.barMethod中的关键词row与关键词bar在数据源中的距离为g 3。假设2个搜索条目的第二距离分别为f 3、g 3,并且f 3>g 3,那么2个搜索条目的排列顺序可以为packagecom3.row2.barMethod、com.bar.test.row1。
或者,若搜索条目com.bar.test.row1的第一距离与第二距离之和大于搜索条目packagecom3.row2.barMethod的第一距离与第二距离之和,即f 1+f 2+f 3>g 1+g 2+g 3,那么2个搜索条目的排列顺序可以为packagecom3.row2.barMethod、com.bar.test.row1。
可选地,计算设备可以根据第m个搜索条目的第一距离和第二距离,确定第m个搜索条目的第四距离,从而根据每个搜索条目的第四距离确定M个搜索条目的排列顺序。
可选地,第m个搜索条目的第四距离可以根据第m个搜索条目的第一距离与第二距离的和确定。第m个搜索条目的第四距离可以根据第m个搜索条目的第一距离与第二距离的加权和确定。或者,第m个搜索条目的第四距离可以根据第m个搜索条目的第一距离与第二距离的平均值确定。或者,第m个搜索条目的第四距离可以根据第m个搜索条目的第一距离与第二距离的最小值确定等,本申请实施例对此并不具体限定。
例如,假设第m个搜索条目的第一距离为f 1+f 2,第m个搜索条目的第二距离为f 3,则第m个搜索条目的第四距离可以为第一距离与第二距离之和,即第m个搜索条目的第四距离可以为f 1+f 2+f 3。或者,第m个搜索条目的第四距离可以为第一距离与第二距离的加权和,即第m个搜索条目的第四距离可以为f 1+f 2+2f 3。或者,第m个搜索条目的第四距离可以为第一距离与第二距离的平均值,即第m个搜索条目的第四距离可以为(f 1+f 2+f 3)/2。或者,若f 1+f 2<f 3,则第m个搜索条目的第四距离可以第一距离与第二距离的最小值,即第m个搜索条目的第四距离可以为f 1+f 2
可选地,计算设备可以根据第m个搜索条目的第一距离或第二距离,确定第m个搜索条目的权重。其中,第m个搜索条目的权重与第m个搜索条目的第一距离成反比。或者,第m个搜索条目的权重与第m个搜索条目的第二距离成反比。计算设备还可以根据M个搜索条目中每个搜索条目的权重,确定第m个搜索条目的排列顺序。其中,第m个搜索条目的权重与第m个搜索条目的排列顺序成反比。
可选地,计算设备可以根据第m个搜索条目的第一距离与第二距离,确定第m个搜搜条目的第四距离。计算设备还可以根据第m个搜索条目的第四距离,确定第m个搜索条目的权重。其中,第m个搜索条目的权重与第m个搜索条目的第四距离成反比。计算设备还可以根据M个搜索条目中每个搜索条目的权重,确定M个搜索条目的排列顺序。其中,第m个搜索条目的权重与第m个搜索条目的排列顺序成反比。计算设备确定第m个搜索条目的第四距离的具体方式可以为多种,本申请实施例对此并不限定。
例如,假设关键词为test,在数据源中搜索test可以获得的3个搜索条目分别为packagecom1.test1、packagecom1.test2与packagecom2.testfoo。假设3个搜索条目的第一距离分别为a 1、b 1、c 1,并且a 1<b 1<c 1,那么根据该3个搜索条目的第一距离,可以确定该3个搜索条目的权重分别为y 1、y 2、y 3,并且y 1>y 2>y 3。根据该3个搜索条目的权重,可以确定该3个搜索条目的排列顺序为:packagecom1.test1、packagecom1.test2与packagecom2.testfoo。
例如,假设关键词为row与bar,在数据源中搜索row可以获得的2个搜索条目为com.bar.test.row1、packagecom3.row2.barMethod。假设2个搜索条目的第二距离分别为f 3、g 3,并且f 3>g 3,那么根据该2个搜索条目的第二距离,可以确定该2个搜索条目的权重分别为z 1、z 2,并且z 1<z 2。根据该2个搜索条目的权重,可以确定该2个搜索条目的排列顺序为:packagecom3.row2.barMethod、com.bar.test.row1。
或者,若搜索条目com.bar.test.row1的第一距离与第二距离之和大于搜索条目 packagecom3.row2.barMethod的第一距离与第二距离之和,即f 1+f 2+f 3>g 1+g 2+g 3。其中,f 1+f 2为搜索条目com.bar.test.row1的第一距离,g 1+g 2为packagecom3.row2.barMethod的第一距离。根据该2个搜索条目的第一距离和第二距离之和,可以确定该2个搜索条目的权重分别为w 1、w 2,并且w 1<w 2。根据该2个搜索条目的权重,可以确定该2个搜索条目的排列顺序为:packagecom3.row2.barMethod、com.bar.test.row1。
可选地,在步骤S220前,计算设备可以确定第m个搜索条目的第一距离和/或第二距离。计算设备确定第m个搜索条目的第一距离和/或第二距离的具体实现方式可以参见图5的描述。
S230,根据确定的排列顺序,显示所述M个搜索条目。
计算设备可以根据步骤S220确定的排列顺序,从上往下地依次显示M个搜索条目。例如,假设第m 1个搜索条目的排列顺序为2,第m 2个搜索条目的排列顺序为1,则计算设备可以从上到下依次显示第m 2个搜索条目与第m 1个搜索条目。
计算设备可以根据N个关键词确定M个搜索条目,还可以确定M个搜索条目中第m个搜索条目的排列顺序。并且,计算设备可以将与参考位置的距离更近和/或关键词之间的距离更近的搜索条目排列在数值更小的顺序位上,并进行显示,从而使得数值更小的顺序位上的搜索条目为目标搜索条目的概率更大。也就是说,计算设备可以通过较少的关键词或词组,较为快速的定位到目标搜索条目,从而节约人工查找目标搜索条目的时间,提高搜索的准确度。
图5是IDE搜索数据的方法的示意性流程图,图5中的方法可以由图1中的IDE搜索数据系统执行。图5中的方法包括如下步骤。
S310,在数据源中搜索N个关键词,获得M个搜索条目。步骤S310的具体实现方式与步骤S210类似,此处不再赘述。
S320,根据参考位置与第m个搜索条目包括的N个关键词的位置的距离,确定第m个搜索条目的第一距离。
计算设备可以确定M个搜索搜索条目中第m个搜索条目的第一距离,该第m个搜索条目的第一距离可以用于指示参考位置与第m个搜索条目包括的N个关键词在参考数据中的位置的距离。
可选地,参考数据可以包括当前打开的文件和/或记录信息。记录信息可以包括以下任一种或多种:代码历史提交记录、文件系统修改记录、搜索记录或代码浏览记录。其中,当前打开的文件数据可以包括以下任一种或多种:当前打开的文件名称、当前打开的文件内容、或当前打开的文件的排列顺序。代码历史提交记录可以包括代码历史提交内容和/或代码历史提交名称,代码历史提交记录还可以包括代码历史提交时间。文件系统修改记录可以包括文件历史修改名称,文件系统修改记录还可以包括文件历史修改时间。搜索记录可以包括历史搜索内容,搜索记录还可以包括历史搜索时间。代码浏览记录可以包括历史浏览代码文件内容和/或历史浏览代码文件名称,代码浏览记录还可以包括历史浏览代码文件时间。
可选地,参考位置可以包括获取N个关键词前光标所在的位置或记录信息中的最新记录。例如,在参考数据为当前打开的文件的情况下,参考位置可以是当前打开的文件中获取N个关键词前光标所在的位置。在参考数据为代码历史提交记录的情况下,参考位置可以是最新的代码历史提交记录。在参考数据为文件系统修改记录的情况下,参考位置可以 是最新的文件系统修改记录。在参考数据为搜索记录的情况下,参考位置可以是最新的搜索记录。在参考数据为代码浏览记录的情况下,参考位置可以是最新的代码浏览记录。或者,参考位置可以预先定义,本申请实施例对此并不限定。
可选地,计算设备确定M个搜索条目中第m个搜索条目的第一距离的方法可以为:分别根据第m个搜索条目包括的N个关键词的位置,确定第m个搜索条目的N个第三距离,从而确定第m个搜索条目的第一距离。其中,第m个搜索条目的N个第三距离中的第n个第三距离是第m个搜索条目包括的N个关键词中的第n个关键词的位置到参考位置的距离,第m个搜索条目包括的N个关键词的位置分别为N个关键词在参考数据中的位置。
例如,在参考位置与第m个搜索条目的第n个关键词的位置在同一当前打开的文件中的情况下,参考位置与第m个搜索条目的第n个关键词的位置的距离可以根据参考位置与第n个关键词的位置间隔的行距和/或列距确定。
例如,在参考位置与第m个搜索条目的第n个关键词的位置在不同的当前打开的文件中的情况下,参考位置与第m个搜索条目的第n个关键词的位置的距离可以根据参考位置与第n个关键词的位置间隔的文件数量确定,还可以根据参考位置与第n个关键词的位置间隔的行距和/或列距确定。在参考位置与第m个搜索条目的第n个关键词的位置在不同当前打开的文件的情况下,参考位置与第n个关键词的位置间隔的行距和/或列距可以是将参考位置投影至第n个关键词的位置所在的当前打开的文件后,与第n个关键词的位置间隔的行距和/或列距。例如,若参考位置为A文件中的第10行,第n个关键词的位置为B文件中的第3行,那么参考位置与第n个关键词的位置间隔的行距为7行。
例如,在参考位置与第m个搜索条目的第n个关键词的位置在同一代码历史提交记录的情况下,即参考位置为最新的代码历史提交记录,第m个搜索条目的第n个关键词的位置位于最新的代码历史提交记录中,参考位置与第m个搜索条目的第n个关键词的位置的距离为0。
例如,在参考位置与第m个搜索条目的第n个关键词的位置在不同代码历史提交记录的情况下,即参考位置为最新的代码历史提交记录,第m个搜索条目的第n个关键词的位置位于除最新的代码历史提交记录外的代码历史提交记录中,参考位置与第m个搜索条目的第n个关键词的位置的距离可以根据参考位置与第n个关键词的位置间隔的代码历史提交记录的数量确定。例如,若第m个搜索条目中第n个关键词的位置与最新的代码历史提交记录间隔3个代码历史提交记录,则参考位置与第m个搜索条目中第n个关键词的位置的距离为3,或者为30,或者为300,本申请实施例对此并不限定。
可选地,根据第m个搜索条目包括的N个关键词的位置,确定第m个搜索条目的N个第三距离的具体实现方式例如可以是:根据第m个搜索条目中的第n个关键词在当前打开的文件中的位置与获取N个关键词前光标所在的位置的距离,确定第m个搜索条目的第n个第三距离。或者,可以根据第m个搜索条目中的第n个关键词在当前打开的文件中的位置与获取N个关键词前光标所在的位置的距离、以及第m个搜索条目中的第n个关键词在历史提交记录中的位置与最新的历史提交记录的距离等,确定第m个搜索条目的第n个第三距离,本申请实施例对此并不限定。
可选地,根据第m个搜索条目的N个第三距离,确定第m个搜索条目的第一距离的具体方式可以是:将N个第三距离相加,确定第一距离。或者,根据第m个搜索条目的 N个第三距离,确定第m个搜索条目的第一距离的具体方式可以是:对N个第三距离取平均值,确定第一距离等,本申请实施例不做具体限定。
例如,假设当前打开的文件的排列顺序为:当前打开的文件A、当前打开的文件B、当前打开的文件E。其中,当前打开的文件B与当前打开的文件A之间间隔1个当前打开的文件,当前打开的文件E与当前打开的文件A之间间隔2个当前打开的文件。若参考数据为当前的文件,则参考位置为当前打开的文件中获取N个关键词前光标所在的位置。
例如,假设代码历史提交记录如下表1所示。
表1代码历史提交记录表
序号 记录
1 代码历史提交记录C
2 代码历史提交记录D
3 代码历史提交记录E
4 代码历史提交记录F
其中,序号为1的代码历史提交记录C为最新的代码历史提交记录。序号为2的代码历史提交记录D为在代码历史提交记录C之前提交的代码历史提交记录。序号为3的代码历史提交记录E为在代码历史提交记录D之前提交的代码历史提交记录。序号为4的代码历史提交记录F为在代码历史提交记录E之前提交的代码历史提交记录。并且,代码历史提交记录D与代码历史提交记录C之间间隔1个代码历史提交记录,代码历史提交记录F与代码历史提交记录C之间间隔3个代码历史提交记录。若参考数据为如表1所示的代码历史提交记录表,那么参考位置可以为代码历史提交记录C。
例如,假设关键词为test,在数据源中搜索test可以获得的3个搜索条目分别为packagecom1.test1、packagecom1.test2与packagecom2.testfoo。若packagecom1.test1中的关键词test在当前打开的文件A中的位置为第39行,参考位置为该当前打开的文件A中的第10行,则搜索条目packagecom1.test1的第三距离为29。根据该第三距离确定的第一距离为29。若搜索条目packagecom1.test2中的关键词test在当前打开的文件A中的位置为第45行,则搜索条目packagecom1.test1的第三距离为35。根据该第三距离确定的第一距离为35。若搜索条目packagecom2.testfoo中的关键词test在当前打开的文件B中,并且当前打开的文件B与当前打开的文件A间隔1个当前打开的文件,则搜索条目packagecom2.testfoo的第三距离为1Δ 1。其中,Δ 1表示一个预设阈值,例如可以是100、500、1000等。根据该第三距离确定的第一距离为1Δ 1
若packagecom1.test1中的关键词test在代码历史提交记录C中,则该搜索条目packagecom1.test1的第三距离为0。根据该第三距离确定的第一距离为0。若搜索条目packagecom1.test2中的关键词test在代码历史提交记录C中,则搜索条目packagecom1.test1的第三距离为0,根据该第三距离确定的第一距离为0。若搜索条目packagecom2.testfoo中的关键词test在代码历史提交记录D中,由表1可知,代码历史提交记录D与代码历史提交记录C间隔1个代码历史提交记录,则搜索条目packagecom2.testfoo的第三距离为1Δ 2。其中,Δ 2表示一个预设阈值,例如可以是80、600、1100等。根据该第三距离确定的第一距离为1Δ 2
或者,若packagecom1.test1在当前打开的文件A中与第一参考位置的距离为29,第 一参考位置为该当前打开的文件A中的第10行。若packagecom1.test1在第二参考位置中,第二参考位置为代码历史提交记录C,则该搜索条目packagecom1.test1的第三距离可以为19。根据该第三距离确定的第一距离为19。若packagecom1.test2在当前打开的文件A中与第一参考位置的距离为35,packagecom1.test1在第二参考位置中,则该搜索条目packagecom1.test1的第三距离可以为25。根据该第三距离确定的第一距离为25。若packagecom2.testfoo在当前打开的文件B中与第一参考位置的距离为1Δ 1,packagecom1.test1在代码历史提交记录D中与第二参考位置的距离为1Δ 2,则该搜索条目packagecom1.test1的第三距离可以为1Δ 1+1Δ 2。根据该第三距离确定的第一距离为1Δ 1+1Δ 2
例如,假设关键词为test与foo,在数据源中搜索test与foo可以获得的2个搜索条目为packagecom2.testfoo1与packagecom2.testfoo2。若packagecom2.testfoo1中的关键词test在当前打开的文件A中的位置为第50行,参考位置为该当前打开的文件A中的第10行。由于packagecom2.testfoo1中的关键词test与foo属于同一字符串testfoo1,因此搜索条目packagecom2.testfoo1中的关键词foo在当前打开的文件A中的位置也为第50行,则packagecom2.testfoo1的2个第三距离分别为40与40。根据该2个第三距离确定的第一距离为80。若packagecom2.testfoo2中的关键词test在当前打开的文件A中的位置为第3行,由于搜索条目packagecom2.testfoo2中的关键词test与foo属于同一字符串testfoo2,因此packagecom2.testfoo2中的关键词foo在当前打开的文件A中的位置也为第3行,则搜索条目packagecom2.testfoo2的2个第三距离分别为7与7。根据该2个第三距离确定的第一距离为14。
例如,假设关键词为row与bar,在数据源中搜索row与bar可以获得的2个搜索条目为com.bar.test.row1、packagecom3.row2.barMethod。若com.bar.test.row1中的关键词row在当前打开的文件A中的位置为第25行,com.bar.test.row1中的关键词bar在当前打开的文件A中的位置为第5行,参考位置为该当前打开的文件A中的第10行,则com.bar.test.row1的第三距离为20。根据该第三距离可以确定的第一距离为20。若packagecom3.row2.barMethod中的关键词row在当前打开的文件E中,packagecom3.row2.barMethod中的关键词bar在当前打开的文件E中,并且当前打开的文件E与当前打开的文件A间隔2个当前打开的文件,则packagecom3.row2.barMethod的第三距离为2Δ 1+2Δ 1=4Δ 1。根据该第三距离确定的第一距离为4Δ 1
若com.bar.test.row1中的关键词row在代码历史提交记录C中,com.bar.test.row1中的关键词bar在代码历史提交记录C中,参考位置为该代码历史提交记录C,则该搜索条目com.bar.test.row1的第三距离为0。根据该第三距离确定的第一距离为0。若搜索条目packagecom3.row2.barMethod中的关键词row在代码历史提交记录F中,搜索条目packagecom3.row2.barMethod中的关键词bar在代码历史提交记录F中。由表1可知,代码历史提交记录F与代码历史提交记录C间隔3个代码历史提交记录,则搜索条目packagecom1.test1的第三距离为3Δ 2+3Δ 2=6Δ 2,根据该第三距离确定的第一距离为6Δ 2
或者,若com.bar.test.row1中的关键词row在当前打开的文件A中与第一参考位置的距离为15,com.bar.test.row1中的关键词bar在当前打开的文件A中与第一参考位置的距离为5。其中,第一参考位置为当前打开的文件A中获取N个关键词前光标所在位置。并且,com.bar.test.row1中的关键词row在代码历史提交记录C中与第二参考位置的距离为 0,com.bar.test.row1中的关键词bar在代码历史提交记录C中与第二参考位置的距离为0,其中,第二参考位置为代码历史提交记录C。该搜索条目com.bar.test.row1的第三距离可以为20。根据该第三距离确定的第一距离为20。
若packagecom3.row2.barMethod中的关键词row在当前打开的文件E中与第一参考位置的距离为2Δ 1,packagecom3.row2.barMethod中的关键词bar在当前打开的文件E中与第一参考位置的距离为2Δ 1。并且,packagecom3.row2.barMethod中的关键词row在代码历史提交记录F中与第二参考位置的距离为3Δ 2,packagecom3.row2.barMethod中的关键词row在代码历史提交记录F中与第二参考位置的距离为3Δ 2,则该搜索条目packagecom3.row2.barMethod的第三距离可以为4Δ 1+6Δ 2。根据该第三距离确定的第一距离为4Δ 1+6Δ 2
S330,根据数据源中第m个搜索条目包括的N个关键词之间的距离,确定第m个搜索条目的第二距离。
计算设备可以确定M个搜索条目中第m个搜索条目的第二距离,该第m个搜索条目的第二距离用于指示在数据源中第m个搜索条目包括的N个关键词之间的距离。数据源包括项目的代码索引、项目依赖的数据库的代码索引、或项目的资源文件的文本索引中的任一种或多种。
可选地,在数据源中第m个搜索条目包括的N个关键词之间的距离可以包括第m个搜索条目的N个关键词之间的代码层次距离和/或文件层次距离。其中,N个关键词之间的代码层次距离为N个关键词的每两个关键词之间在数据源的代码层次的距离。N个关键词之间的文件层次距离为N个关键词的每两个关键词之间在数据源的文件层次的距离。
例如,数据源的代码层次如图6所示。图6中包括一个项目,该项目中包括3个包,分别为包1、包2与包3。其中,包1中包括类1、类2与类3,包2中包括类4,包3中包括类5。类1中包括内部类1与内部类2,内部类1中包括方法7,内部类2中包括方法8。类2中包括方法1与方法2。类3中包括方法3。类4中包括方法4与方法5。类5中包括方法6。
假设关键词为test与foo,包1为test1,类1为foo1,类2为bar,方法1为foo2。若搜索条目1为test1.foo1,搜索条目2为test1.bar.foo2。由于在数据源的代码层次中,包1与类1为直接包含关系,因此搜索条目1的2个关键词在数据源的代码层次的距离可以为1。由于在数据源的代码层次中,包1与方法1为间接包含关系,并且包1与方法1仅间隔一个类2,因此搜索条目2的2个关键词在数据源的代码层次的距离可以为2。
例如,假设关键词为test与foo,搜索条目为com.foo.test1与com.foo.bar.test1,并且该两条搜索条目在数据源的文件层次可以表示为C:\src\main\com\foo\test1.java与C:\src\main\com\foo\bar\test2.java。由于搜索条目com.foo.test1中两个关键词在数据源的文件层次中直接相邻,因此com.foo.test1中两个关键词之间在数据源的文件层次的距离可以为1。由于搜索条目com.foo.bar.test1中两个关键词在数据源的文件层次中间接相邻,并且两个关键词中仅间隔一个字符串bar,因此com.foo.bar.test1中两个关键词在数据源的文件层次的距离可以为2。
可选地,计算设备确定M个搜索条目中第m个搜索条目的第二距离的方法可以为:根据第m个搜索条目的代码层次距离和/或文件层次距离,确定所述第m个搜索条目的第二距离。或者,根据第m个搜索条目的以下任一种或多种距离,确定第m个搜索条目的 第二距离:第m个搜索条目的代码层次距离、第m个搜索条目的文件层次距离、第m个搜索条目中N个关键词之间的行距或列距。
可选地,计算设备根据第m个搜索条目的代码层次距离和文件层次距离,确定所述第m个搜索条目的第二距离的具体实现方式可以是:根据第m个搜索条目的代码层次距离和文件层次距离中的最小值,确定第m个搜索条目的第二距离。或者,根据第m个搜索条目的代码层次距离和文件层次距离的和,确定第m个搜索条目的第二距离。或者,根据第m个搜索条目的代码层次距离和文件层次距离的平均值,确定第m个搜索条目的第二距离等,本申请实施例对此并不限定。
可选地,计算设备确定第m个搜索条目的代码层次距离的具体实现方式可以是:根据第m个搜索条目中N个关键词之间在数据源的代码层次的距离的最小值,确定第m个搜索条目的代码层次距离。或者,根据第m个搜索条目中N个关键词之间在数据源的代码层次的距离的和,确定第m个搜索条目的代码层次距离。或者,根据第m个搜索条目中N个关键词之间在数据源的代码层次的距离的平均值,确定第m个搜索条目的代码层次距离。
可选地,计算设备确定第m个搜索条目的文件层次距离的具体实现方式可以是:根据第m个搜索条目中N个关键词之间在数据源的文件层次的距离的最小值,确定第m个搜索条目的文件层次距离。或者,根据第m个搜索条目中N个关键词之间在数据源的文件层次的距离的和,确定第m个搜索条目的文件层次距离。或者,根据第m个搜索条目中N个关键词之间在数据源的文件层次的距离的平均值,确定第m个搜索条目的文件层次距离。
例如,假设关键词为test与foo,在数据源中搜索test与foo可以获得的2个搜索条目为packagecom2.testfoo1与packagecom2.testfoo2,其中packagecom2为包含类testfoo1与类testfoo2的包。该两个搜索条目在数据源的文件层次中可以表示为C:\src\main\packagecom2\testfoo1.java与C:\src\main\packagecom2\testfoo2.java。由于搜索条目packagecom2.testfoo1中关键词test与foo属于同一字符串testfoo1,因此packagecom2.testfoo1中关键词test与foo在数据源的代码层次中不存在直接或间接包含关系,即packagecom2.testfoo1的代码层次距离为0。同时,由于搜索条目packagecom2.testfoo1中关键词test与foo属于同一字符串testfoo1,因此packagecom2.testfoo1中关键词test与foo在数据源的文件层次中不存在直接或间接相邻关系,即packagecom2.testfoo1的文件层次距离为0。同理可知,packagecom2.testfoo2的代码层次距离为0,packagecom2.testfoo2的文件层次距离为0。因此,根据该两条搜索条目的代码层次距离和/或文件层次距离,可以确定该两条搜索条目的第二距离均为0。
例如,假设关键词为row与bar,在数据源中搜索row与bar可以获得的两个搜索条目为com.bar.test.row1与packagecom3.row2.barMethod。其中,row1、row2为类,barMethod为方法。该两个搜索条目在数据源的文件层次中可以表示为C:\src\main\com\bar\test\row1.java与C:\src\main\packagecom3\row2.java。并且,com.bar.test.row1中的关键词row与bar属于两个字符串row1与bar,packagecom3.row2.barMethod中的关键词row与bar属于两个字符串row2与barMethod。由于com.bar.test.row1中的关键词row与bar在代码层次中间隔test相邻,因此com.bar.test.row1的代码层次距离为2。由于com.bar.test.row1中的关键词row与bar在文件层次中间隔test相邻,因此com.bar.test.row1的文件层次距离为2。 根据com.bar.test.row1的代码层次距离可以确定该搜索条目的第二距离为2。或者,根据com.bar.test.row1的文件层次距离可以确定该搜索条目的第二距离为2。或者,根据com.bar.test.row1的代码层次距离与文件层次距离的最小值可以确定该搜索条目的第二距离为2。
由于packagecom3.row2.barMethod中的关键词row与bar在代码层次中直接相邻,因此packagecom3.row2.barMethod的代码层次距离为1。由于packagecom3.row2.barMethod中的关键词row与bar在文件层次中不存在相邻关系,因此packagecom3.row2.barMethod的文件层次距离为0。根据packagecom3.row2.barMethod的代码层次距离可以确定该搜索条目的第二距离为1。或者,根据packagecom3.row2.barMethod的文件层次距离可以确定该搜索条目的第二距离为0。或者,根据packagecom3.row2.barMethod的代码层次距离与文件层次距离的最小值可以确定该搜索条目的第二距离为0。
例如,假设关键词为row与bar,在数据源中搜索row与bar可以获得的2个搜索条目为packagecom3.row2.barMethod1与packagecom3.row2.barMethod2。其中,barMethod1与barMethod2为方法。由于packagecom3.row2.barMethod1中的关键词row与bar在代码层次直接相邻,因此packagecom3.row2.barMethod1的代码层次距离为1。假设packagecom3.row2.barMethod1中的关键词row与bar的行距为20,packagecom3.row2.barMethod2中的关键词row与bar的行距为50。根据packagecom3.row2.barMethod1的代码层次距离可以确定该搜索条目的第二距离为1。或者,根据packagecom3.row2.barMethod1中两个关键词之间的行距可以确定该搜索条目的第二距离为20。或者,根据packagecom3.row2.barMethod1的代码层次距离与两个关键词之间的行距的最小值可以确定该搜索条目的第二距离为1。
同理,根据packagecom3.row2.barMethod2的代码层次距离可以确定该搜索条目的第二距离为1。或者,根据packagecom3.row2.barMethod2中两个关键词之间的行距可以确定该搜索条目的第二距离为50。或者,根据packagecom3.row2.barMethod2的代码层次距离与两个关键词之间的行距的最小值可以确定该搜索条目的第二距离为1。
可选地,第m个搜索条目的N个关键词之间的距离可以以1为单位,也可以10为单位,或者以100为单位,本申请实施例对此并不限定。例如,假设关键词为row与bar,则搜索条目packagecom3.row2.barMethod2的代码层次距离可以为1,或者可以为10,或者可以为100。
S340,根据每个搜索条目的第一距离和/或第二距离,确定M个搜索条目的排列顺序。
计算设备可以根据M个搜索条目中每个搜索条目的第一距离和/或第二距离,确定M个搜索条目的排列顺序。该M个搜索条目中第m个搜索条目的排列顺序与第m个搜索条目的第一距离和/或第二距离正相关。
可选地,计算设备可以根据M个搜索条目中每个搜索条目的第一距离,确定M个搜索条目的排列顺序。若第m 1个搜索条目的第一距离大于第m 2个搜索条目的第一距离,则第m 1个搜索条目可以排列在数值较大的顺序位上,第m 2个搜索条目可以排列在数值较小的顺序位上。例如,第m 1个搜索条目排列为第2位,第m 2个搜索条目排列为第1位。
可选地,计算设备可以根据M个搜索条目中每个搜索条目的第二距离,确定M个搜索条目的排列顺序。若第m 1个搜索条目的第二距离大于第m 2个搜索条目的第二距离,则第m 1个搜索条目可以排列在数值较大的顺序位上,第m 2个搜索条目可以排列在数值较小 的顺序位上。例如,第m 1个搜索条目排列为第2位,第m 2个搜索条目排列为第1位。
可选地,计算设备可以根据M个搜索条目中每个搜索条目的第四距离,确定M个搜索条目的排列顺序,该第m个搜索条目的第四距离为根据第m个搜索条目的第一距离和第二距离确定的距离。若第m 1个搜索条目的第四距离大于第m 2个搜索条目的第四距离,则第m 1个搜索条目可以排列在数值较大的顺序位上,第m 2个搜索条目可以排列在数据较小的顺序位上。例如,第m 1个搜索条目排列为第2位,第m 2个搜索条目排列为第1位。
可选地,第m个搜索条目的第四距离可以根据第m个搜索条目的第一距离与第二距离的和确定。或者,第m个搜索条目的第四距离可以根据第m个搜索条目的第一距离与第二距离的加权和确定。或者,第m个搜索条目的第四距离可以根据第m个搜索条目的第一距离与第二距离的平均值确定。或者,第m个搜索条目的第四距离可以根据第m个搜索条目的第一距离与第二距离的最小值确定等,本申请实施例对此并不限定。
可选地,计算设备可以根据第m个搜索条目的第一距离或第二距离,确定第m个搜索条目的权重,从而确定M个搜索条目的排列顺序。其中,第m个搜索条目的权重与第m个搜索条目的第一距离或第二距离负相关。
可选地,计算设备可以根据第m个搜索条目的第一距离和第二距离,确定第m个搜搜条目的第四距离。计算设备还可以根据第m个搜索条目的第四距离,确定第m个搜索条目的权重,从而确定M个搜索条目的排列顺序。第m个搜索条目的权重与第m个搜索条目的第四距离负相关。计算设备确定第m个搜索条目的第四距离的具体方式可以为多种,本申请实施例对此并不限定。
例如,假设关键词为test,在数据源中搜索test可以获得的3个搜索条目分别为packagecom1.test1、packagecom1.test2与packagecom2.testfoo。其中,根据步骤S320确定的第一距离分别为:29、35、1Δ 1。根据该3个搜索条目的第一距离,可以确定该3个搜索条目的排列顺序为:packagecom1.test1、packagecom1.test2、packagecom2.testfoo。
或者,假设根据该3个搜索条目的第一距离,确定该3个搜索条目的权重分别为:y 1、y 2、y 3,则该3个搜索条目的权重的大小关系为:y 1>y 2>y 3。根据该3个搜索条目的权重,可以确定该3个搜索条目的排列顺序为:packagecom1.test1、packagecom1.test2与packagecom2.testfoo。
例如,假设关键词为test与foo,在数据源中搜索test与foo可以获得的2个搜索条目为packagecom2.testfoo1与packagecom2.testfoo2。其中,根据步骤S320确定的第一距离分别为:80、14,根据步骤S330确定的第二距离分别为0、0。根据该2个搜索条目的第一距离,可以确定该2个搜索条目的排列顺序为:packagecom2.testfoo2、packagecom2.testfoo1。根据该2个搜索条目的第一距离与第二距离之和,可以确定该2个搜索条目的排列顺序为:packagecom2.testfoo2、packagecom2.testfoo1。
或者,假设根据该3个搜索条目的第一距离,确定该2个搜索条目的权重分别为:z 1、z 2,则该2个搜索条目的权重的大小关系为:z 1<z 2。根据该2个搜索条目的权重,可以确定该2个搜索条目的排列顺序为:packagecom2.testfoo2、packagecom2.testfoo1。
例如,假设关键词为row与bar,在数据源中搜索row与bar可以获得的2个搜索条目为com.bar.test.row1、packagecom3.row2.barMethod。其中,根据步骤S320确定的第一距离分别为:20、4Δ 1,根据步骤S330确定的第二距离分别为:2、0。根据该2个搜索条目的第一距离,可以确定该2个搜索条目的排列顺序为:com.bar.test.row1、 packagecom3.row2.barMethod。根据该2个搜索条目的第二距离,可以确定该2个搜索条目的排列顺序为:com.bar.test.row1、packagecom3.row2.barMethod。根据该2个搜索条目的第一距离与第二距离之和,可以确定该2个搜索条目的排列顺序为:com.bar.test.row1、packagecom3.row2.barMethod。
或者,假设根据该3个搜索条目的第一距离和第二距离,确定该2个搜索条目的权重分别为:w 1、w 2,则该2个搜索条目的权重的大小关系为:w 1>w 2。根据该2个搜索条目的权重,可以确定该2个搜索条目的排列顺序为:com.bar.test.row1、packagecom3.row2.barMethod。
例如,在数据源中搜索关键词rest与temp,可以获得的效果图如图7所示。图7为IDE搜索数据方法的示意性效果图。图7中包括搜索栏、搜索条目列表和文档预览。其中,搜索栏可以输入关键词rest与temp。搜索条目列表中可以显示排序后的一条或多条搜索条目。文档预览可以在选中任意一条搜索条目时,预览该条搜索条目包含的内容或信息等。
假设图7为根据每个搜索条目的第四距离确定搜索条目的排列顺序所获得的效果图,则图7中从上至下排序分别为1、2、3、4、5的搜索条目中,排序为1的搜索条目的第四距离小于等于排序为2、3、4、5中的任一条搜索条目的第四距离。并且,该5个搜索条目的第四距离的大小关系为:排序为1的搜索条目的第四距离≤排序为2的搜索条目的第四距离≤排序为3的搜索条目的第四距离≤排序为4的搜索条目的第四距离≤排序为5的搜索条目的第四距离。其中,第m个搜索条目的第四距离为根据第m个搜索条目的第一距离和第二距离确定的距离。
可选地,在根据每个搜索条目的第一距离确定M个搜索条目的排列顺序的情况下,若第m 1个搜索条目的第一距离与第m 2个搜索条目的第一距离相同,则可以根据第m 1个搜索条目的第二距离与第m 2个搜索条目的第二距离的大小进行排序。或者,可以根据第m 1个搜索条目的第四距离与第m 2个搜索条目的第四距离的大小进行排序。或者,可以根据第m 1个搜索条目的字母与第m 2个搜索条目的字母进行排序等,本申请实施例对此并不限定。
同理,在根据每个搜索条目的第二距离确定M个搜索条目的排列顺序的情况下,若第m 1个搜索条目的第二距离与第m 2个搜索条目的第二距离相同,则可以根据第m 1个搜索条目的第一距离与第m 2个搜索条目的第一距离的大小、或第m 1个搜索条目的第四距离与第m 2个搜索条目的第四距离的大小、或第m 1个搜索条目的字母与第m 2个搜索条目的字母中的任一种或多种进行排序。
同理,在根据每个搜索条目的第四距离确定M个搜索条目的排列顺序的情况下,若第m 1个搜索条目的第四距离与第m 2个搜索条目的第四距离相同,则可以根据第m 1个搜索条目的第一距离与第m 2个搜索条目的第一距离的大小、或第m 1个搜索条目的第二距离与第m 2个搜索条目的第二距离的大小、或第m 1个搜索条目的字母与第m 2个搜索条目的字母中的任一种或多种进行排序。
计算设备可以根据N个关键词确定M个搜索条目,还可以根据M个搜索条目中每个搜索条目的第一距离和/或第二距离,确定M个搜索条目的排列顺序。计算设备可以使第一距离、第二距离或第四距离更小的搜索条目排列在数值更小的顺序位上,从而使数值更小的顺序位上的搜索条目为目标搜索条目的概率更大,节约人工查找目标搜索条目的时间,提高搜索的准确度。
图8是IDE搜索数据的方法的示意性流程图,图8中的方法可以由图1中的IDE搜索数据系统执行。图8中的方法包括如下步骤。
S410,根据数据源与N个关键词,确定M个搜索条目。步骤S410的具体实现方式与步骤S210类似,此处不再赘述。
S420,确定N=1或第m个搜索条目的N个关键词是否属于同一字符串。
计算设备可以确定N的取值是否为1,或者可以确定M个搜索条目中的第m个搜索条目包含的N个关键词是否属于一个字符串,从而确定是否需要确定第m个搜索条目的第二距离。该第m个搜索条目的N个关键词属于同一字符串为:例如关键词为test与foo,搜索条目为packagecom2.testfoo1与com.test2.foo3,则搜索条目packagecom2.testfoo1中关键词test与foo属于同一字符串testfoo1,而搜索条目com.test2.foo3中关键词test与foo属于不同字符串test2与foo3。
在N的取值为1的情况下,第m个搜索条目中仅包含一个关键词,无法确定关键词之间的距离,因此计算设备不需要确定该第m个搜索条目的第二距离。在此情况下,计算设备可以确定第m个搜索条目的第一距离,并将该第m个搜索条目的第一距离与其他搜索条目的第一距离进行比较,从而确定M个搜索条目的排列顺序。该其他搜索条目为M个搜索条目中除该第m个搜索条目外的其他搜索条目。
在第m个搜索条目包含的N个关键词属于同一字符串的情况下,根据步骤S330可知,该第m个搜索条目的第二距离为0,因此计算设备不需要确定该第m个搜索条目的第二距离。计算设备可以确定第m个搜索条目的第一距离,并将该第m个搜索条目的第一距离与其他搜索条目的第一距离、第二距离或第四距离中的任一种距离进行比较,从而确定M个搜索条目的排列顺序。
在除上述两种情况外的情况下,即N的取值不为1并且第m个搜索条目的N个关键词不属于同一字符串的情况下,计算设备可以确定第m个搜索条目的第一距离和/或第二距离,从而确定M个搜索条目的排列顺序。
换句话说,在N的取值为1或第m个搜索条目包含的N个关键词属于同一字符串的情况下,计算设备可以执行步骤S430。在N的取值不为1并且第m个搜索条目的N个关键词不属于同一字符串的情况下,计算设备可以执行步骤S440。
S430,确定第m个搜索条目的第一距离。步骤S430的具体实现方式与步骤S320类似,此处不再赘述。
S440,确定第m个搜索条目的第一距离。步骤S440的具体实现方式与步骤S320类似,此处不再赘述。
S450,确定第m个搜索条目的第二距离。步骤S450的具体实现方式与步骤S330类似,此处不再赘述。
S460,根据第m个搜索条目的第一距离和/或第二距离,确定第m个搜索条目的排列顺序。步骤S460的具体实现方式与步骤S340类似,此处不再赘述。
计算设备可以根据N个关键词确定M个搜索条目,还可以判断是否需要确定M个搜索条目中第m个搜索条目的第二距离,从而根据M个搜索条目中每个搜索条目的第一距离和/或第二距离,确定M个搜索条目的排列顺序。计算设备可以将第一距离和/或第二距更小的搜索条目排列在数值更小的顺序位上,从而使数值更小的顺序位上的搜索条目为目标搜索条目的概率更大,节约人工查找目标搜索条目的时间,提高搜索的准确度。
以上描述了根据本申请实施例的IDE搜索数据的方法,下面结合图9与图10描述根据本申请实施例的计算装置和计算设备。
图9是根据本申请一个实施例的计算装置的结构示意图。计算装置500包括获取模块510、处理模块520和显示模块530。
获取模块510用于获取N个关键词。
处理模块520用于根据数据源与N个关键词,确定M个搜索条目,该M个搜索条目中的第m个搜索条目包括N个关键词。处理模块520还用于确定M个搜索条目的排列顺序,该第m个搜索条目在M个搜索条目中的排列顺序与第m个搜索条目的第一距离和/或第二距离正相关。处理模块520可以执行图2的方法中的步骤S210、S220、图5的方法中的步骤S310至S340、图8的方法中的步骤S410至S460中的部分或全部步骤。
显示模块530用于根据确定的排列顺序,显示M个搜索条目。显示模块530可以执行图2的方法中的步骤S230。
图10是根据本申请实施例提供的计算设备的结构框图。图10所示的计算设备600包括:处理器601、存储器602和通信接口603,处理器601、存储器602和通信接口603通过总线604相通信。
上述本发明实施例揭示的方法可以应用于处理器601中,或者由处理器601实现。处理器601可以是中央处理器(central processing unit,CPU),还可以是其他通用处理器、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者是任何常规的处理器等。在实现过程中,上述方法的各步骤可以通过处理器601中的硬件的集成逻辑电路或者软件形式的指令完成。可以实现或者执行本发明实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本发明实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于存储器602中,该存储器602可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data date SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(direct rambus RAM,DR RAM)处理器601读取存储器602中的指令,结合其硬件完成上述方法的步骤。
存储器602可以存储用于执行上述实施例中计算设备执行的方法的指令。处理器601可以执行存储器602中存储的指令结合其他硬件完成上述实施例中计算设备的步骤,具体工作过程和有益效果可以上述实施例中的描述。
存储器可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(dynamic RAM,DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(direct rambus RAM,DR RAM)。应注意,本文描述的系统和方法的存储器旨在包括但不限于这些和任意其它适合类型的存储器。
总线604除包括数据总线之外,还可以包括电源总线、控制总线和状态信号总线等。但是为了清楚说明起见,在图中将各种总线都标为总线604。
本申请实施例还提供了一种计算机存储介质,该计算机存储介质中存储有程序指令,所述程序执行时可包括如图2至图8对应实施例中的IDE搜索数据的方法的部分或全部步骤。
本申请实施例还提供了一种芯片系统,该芯片系统包括逻辑电路,该逻辑电路用于与输入/输出接口耦合,通过该输入/输出接口传输数据,以执行上述实施例中除步骤S230外图2至图8中包括的各个步骤。
根据本申请实施例提供的方法,本申请还提供一种计算机程序产品,该计算机程序产品包括:计算机程序代码,当该计算机程序代码在计算机上运行时,使得该计算机执行上述实施例中的各个步骤。
根据本申请实施例提供的方法,本申请还提供一种计算机可读介质,该计算机可读介质存储有程序代码,当该程序代码在计算机上运行时,使得该计算机执行上述实施例中的各个步骤。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的 部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (17)

  1. 一种集成开发环境搜索数据的方法,其特征在于,包括:
    根据数据源与N个关键词,确定M个搜索条目,所述M个搜索条目中的第m个搜索条目包括所述N个关键词,N、M为大于或等于1的正整数,m=1,……,M;
    确定所述M个搜索条目的排列顺序,所述第m个搜索条目在所述M个搜索条目中的排列顺序与所述第m个搜索条目的第一距离和/或第二距离正相关,所述第m个搜索条目的第一距离用于指示参考位置与所述第m个搜索条目包括的N个关键词的位置的距离,所述第m个搜索条目的第二距离用于指示在所述数据源中所述第m个搜索条目包括的N个关键词之间的距离;
    根据确定的排列顺序,显示所述M个搜索条目。
  2. 根据权利要求1所述的方法,其特征在于,所述确定所述M个搜索条目的排列顺序,包括:
    分别根据所述第m个搜索条目包括的N个关键词的位置,确定所述第m个搜索条目的N个第三距离,所述第m个搜索条目的N个第三距离中的第n个第三距离是所述第m个搜索条目包括的N个关键词中的第n个关键词的位置到所述参考位置的距离,所述第m个搜索条目包括的N个关键词的位置分别为所述N个关键词在参考数据中的位置,所述参考数据包括当前打开的文件,所述参考位置为当前打开的文件中获取所述N个关键词前光标所在的位置,和/或,所述参考数据包括记录信息,所述参考位置为所述记录信息中的最新记录,n=1,……,N;
    根据所述第m个搜索条目的N个第三距离,确定所述第m个搜索条目的第一距离;
    根据所述M个搜索条目的第一距离,确定所述M个搜索条目的排列顺序。
  3. 根据权利要求2所述的方法,其特征在于,所述记录信息包括:代码历史提交记录、文件系统修改记录、搜索记录、或代码浏览记录中的任一个或多个。
  4. 根据权利要求1至3中任一项所述的方法,其特征在于,在N≠1的情况下,所述确定所述M个搜索条目的排列顺序,包括:
    根据所述第m个搜索条目的代码层次距离和/或文件层次距离,确定所述第m个搜索条目的第二距离,所述第m个搜索条目的代码层次距离包括所述第m个搜索条目包括的每两个关键词在所述数据源的代码层次的距离,所述第m个搜索条目的文件层次距离包括所述第m个搜索条目包括的每两个关键词在所述数据源的文件层次的距离;
    根据所述M个搜索条目的第二距离,确定所述M个搜索条目的排列顺序。
  5. 根据权利要求1至4中任一项所述的方法,其特征在于,所述根据数据源与N个关键词,确定M个搜索条目,包括:
    在所述数据源中分别搜索所述N个关键词,获得N个搜索结果集合,所述N个搜索结果集合中的第n个搜索结果集合包括的搜索结果是在所述数据源中对所述N个关键词中的第n个关键词搜索得到的,所述第n个搜索结果集合包括至少一个包含所述第n个关键词的搜索结果,n=1,……,N;
    从所述N个搜索结果集合确定所述M个搜索条目。
  6. 根据权利要求2至5中任一项所述的方法,其特征在于,所述当前打开的文件包 括以下任一种或多种:当前打开的文件名称、当前打开的文件内容、或当前打开的文件的排列顺序,代码历史提交记录包括代码历史提交内容和/或代码历史提交名称,文件系统修改记录包括文件历史修改名称,搜索记录包括历史搜索内容,代码浏览记录包括浏览代码文件内容和/或浏览代码文件名称。
  7. 根据权利要求1至6中任一项所述的方法,其特征在于,所述数据源包括项目的代码索引、项目依赖的数据库的代码索引、或项目的资源文件的文本索引中的任一种或多种。
  8. 一种计算装置,其特征在于,包括:
    获取模块,用于获取N个关键词;
    处理模块,用于根据数据源与所述N个关键词,确定M个搜索条目,所述M个搜索条目中的第m个搜索条目包括所述N个关键词,N、M为大于或等于1的正整数,m=1,……,M;
    所述处理模块,还用于确定所述M个搜索条目的排列顺序,所述第m个搜索条目在所述M个搜索条目中的排列顺序与所述第m个搜索条目的第一距离和/或第二距离正相关,所述第m个搜索条目的第一距离用于指示参考位置与所述第m个搜索条目包括的N个关键词的位置的距离,所述第m个搜索条目的第二距离用于指示在所述数据源中所述第m个搜索条目包括的N个关键词之间的距离;
    显示模块,用于根据确定的排列顺序,显示所述M个搜索条目。
  9. 根据权利要求8所述的装置,其特征在于,所述处理模块,具体用于分别根据所述第m个搜索条目包括的N个关键词的位置,确定所述第m个搜索条目的N个第三距离,所述第m个搜索条目的N个第三距离中的第n个第三距离是所述第m个搜索条目包括的N个关键词中的第n个关键词的位置到所述参考位置的距离,所述第m个搜索条目包括的N个关键词的位置分别为所述N个关键词在参考数据中的位置,所述参考数据包括当前打开的文件,所述参考位置为当前打开的文件中获取所述N个关键词前光标所在的位置,和/或,所述参考数据包括记录信息,所述参考位置为所述记录信息中的最新记录,n=1,……,N;
    所述处理模块,还用于根据所述第m个搜索条目的N个第三距离,确定所述第m个搜索条目的第一距离;
    所述处理模块,还用于根据所述M个搜索条目的第一距离,确定所述M个搜索条目的排列顺序。
  10. 根据权利要求9所述的装置,其特征在于,所述记录信息包括:代码历史提交记录、文件系统修改记录、搜索记录、或代码浏览记录中的任一个或多个。
  11. 根据权利要求8至10中任一项所述的装置,其特征在于,在N≠1的情况下,所述处理模块,具体用于根据所述第m个搜索条目的代码层次距离和/或文件层次距离,确定所述第m个搜索条目的第二距离,所述第m个搜索条目的代码层次距离包括所述第m个搜索条目包括的每两个关键词在所述数据源的代码层次的距离,所述第m个搜索条目的文件层次距离包括所述第m个搜索条目包括的每两个关键词在所述数据源的文件层次的距离;
    所述处理模块,还用于根据所述M个搜索条目的第二距离,确定所述M个搜索条目的排列顺序。
  12. 根据权利要求8至11中任一项所述的装置,其特征在于,所述处理模块,具体用于在所述数据源中分别搜索所述N个关键词,获得N个搜索结果集合,所述N个搜索结果集合中的第n个搜索结果集合包括的搜索结果是在所述数据源中对所述N个关键词中的第n个关键词搜索得到的,所述第n个搜索结果集合包括至少一个包含所述第n个关键词的搜索结果,n=1,……,N;
    所述处理模块,还用于从所述N个搜索结果集合确定所述M个搜索条目。
  13. 根据权利要求9至12中任一项所述的装置,其特征在于,所述当前打开的文件包括以下任一种或多种:当前打开的文件名称、当前打开的文件内容、或当前打开的文件的排列顺序,代码历史提交记录包括代码历史提交内容和/或代码历史提交名称,文件系统修改记录包括文件历史修改名称,搜索记录包括历史搜索内容,代码浏览记录包括浏览代码文件内容和/或浏览代码文件名称。
  14. 根据权利要求8至13中任一项所述的装置,其特征在于,所述数据源包括项目的代码索引、项目依赖的数据库的代码索引、或项目的资源文件的文本索引中的任一种或多种。
  15. 一种计算机设备,其特征在于,包括:处理器,所述处理器用于与存储器耦合,读取并执行所述存储器中的指令和/或程序代码,以执行如权利要求1-7中任一项所述的方法。
  16. 一种芯片系统,其特征在于,包括:逻辑电路,所述逻辑电路用于与输入/输出接口耦合,通过所述输入/输出接口传输数据,以执行如权利要求1-7中任一项所述的方法。
  17. 一种计算机可读介质,其特征在于,所述计算机可读介质存储有程序代码,当所述计算机程序代码在计算机上运行时,使得计算机执行如权利要求1-7中任一项所述的方法。
PCT/CN2022/136812 2022-03-15 2022-12-06 一种集成开发环境搜索数据的方法和相关设备 WO2023173821A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
RU2022106755 2022-03-15
RU2022106755 2022-03-15

Publications (1)

Publication Number Publication Date
WO2023173821A1 true WO2023173821A1 (zh) 2023-09-21

Family

ID=88022134

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/136812 WO2023173821A1 (zh) 2022-03-15 2022-12-06 一种集成开发环境搜索数据的方法和相关设备

Country Status (1)

Country Link
WO (1) WO2023173821A1 (zh)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080109434A1 (en) * 2006-11-07 2008-05-08 Bellsouth Intellectual Property Corporation Determining Sort Order by Distance
CN101425068A (zh) * 2007-10-30 2009-05-06 国际商业机器公司 对搜索结果进行排序的方法及排序装置
US7613693B1 (en) * 2006-11-30 2009-11-03 Google Inc. Preferential ranking of code search results
US20130339365A1 (en) * 2012-06-13 2013-12-19 International Business Machines Corporation Integrated development environment-based repository searching in a networked computing environment
CN110472158A (zh) * 2018-05-11 2019-11-19 北京搜狗科技发展有限公司 一种搜索条目的排序方法和装置
CN111949697A (zh) * 2020-07-09 2020-11-17 厦门美柚股份有限公司 基于搜索引擎的数据处理方法、装置、终端及介质

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080109434A1 (en) * 2006-11-07 2008-05-08 Bellsouth Intellectual Property Corporation Determining Sort Order by Distance
US7613693B1 (en) * 2006-11-30 2009-11-03 Google Inc. Preferential ranking of code search results
CN101425068A (zh) * 2007-10-30 2009-05-06 国际商业机器公司 对搜索结果进行排序的方法及排序装置
US20130339365A1 (en) * 2012-06-13 2013-12-19 International Business Machines Corporation Integrated development environment-based repository searching in a networked computing environment
CN110472158A (zh) * 2018-05-11 2019-11-19 北京搜狗科技发展有限公司 一种搜索条目的排序方法和装置
CN111949697A (zh) * 2020-07-09 2020-11-17 厦门美柚股份有限公司 基于搜索引擎的数据处理方法、装置、终端及介质

Similar Documents

Publication Publication Date Title
US9619468B2 (en) Generation of synthetic context frameworks for dimensionally constrained hierarchical synthetic context-based objects
US7711737B2 (en) Multi-document keyphrase extraction using partial mutual information
US8214361B1 (en) Organizing search results in a topic hierarchy
US9690875B2 (en) Providing search results for mobile computing devices
US10606556B2 (en) Rule-based system and method to associate attributes to text strings
US7630963B2 (en) Fast ranked full-text searching
US8719204B2 (en) Displaying resources based on shared contexts
US20180004838A1 (en) System and method for language sensitive contextual searching
US20070061294A1 (en) Source code file search
WO2007047464A2 (en) Method and apparatus for identifying documents relevant to a search query
JP2012533819A (ja) 文書インデックス化およびデータクエリングのための方法およびシステム
US20190102413A1 (en) Techniques for indexing and querying a set of documents at a computing device
JP6533876B2 (ja) 商品情報表示システム、商品情報表示方法、及びプログラム
WO2023173821A1 (zh) 一种集成开发环境搜索数据的方法和相关设备
US20190205297A1 (en) Index generating apparatus, index generating method, and computer-readable recording medium
US10409861B2 (en) Method for fast retrieval of phonetically similar words and search engine system therefor
US7991756B2 (en) Adding low-latency updateable metadata to a text index
CN115080684A (zh) 网盘文档索引方法、装置、网盘及存储介质
US20080162433A1 (en) Browsable search system
JP4195780B2 (ja) プログラム、データ処理システム及び記憶媒体
US20080154849A1 (en) Method, graphical user interface, and computer program product for grouping search results
CN117520633A (zh) 一种搜索方法及计算系统
Shogin et al. The implementation of a dictionary as an inverse structure for the information retrieval system in the VINITI RAN DBn

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22931832

Country of ref document: EP

Kind code of ref document: A1