Retrieval method, device and equipment based on relational database and storage medium
By receiving and converting the keywords input by users in a relational database and matching them based on different search patterns, the problem of inaccurate search results in the prior art is solved, and more efficient and accurate search results and better user experience are achieved.
Patent Information
- Application Number
- CN202411671775.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-03-14
AI Technical Summary
The existing fuzzy search method based on relational databases is limited by the string type when users enter Chinese keywords, which cannot fully represent the user's intentions, resulting in inaccurate search results and poor user experience.
By receiving the target keywords input by the user, based on the mapping relationship between the input box and the preset string, it is converted into a second target string with the same data type as the target keyword, and matching them based on different search modes (such as Chinese, English, word segmentation, and first letter search modes) to obtain accurate search results.
It is realized that users can generate corresponding search results by entering keywords of various data types, improving the accuracy and user experience of search results, and users can express their intentions more comprehensively and accurately.
Smart Images

Figure CN119621801A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a retrieval method, device, equipment and storage medium based on a relational database. Background Art
[0002] In order to facilitate users to quickly, accurately and efficiently retrieve the resource information they need, large computer systems usually use relational databases to store resource information and set up fuzzy search functions accordingly. Based on the fuzzy search function and the keywords of the resource information that the user inputs, the user retrieves the resource information matching the keywords from the relational database.
[0003] Usually, the above-mentioned fuzzy search method is based on the query of the like statement, and the user needs to set the input keyword as a Chinese character string to realize the fuzzy search function. Therefore, the above-mentioned fuzzy search method, the expression form of the resource information stored in the relational database, limits the expression form of the user input keyword, so that the keyword input by the user cannot fully represent the key information that the user wants to express, so that the obtained search results cannot meet the user's needs, reducing the accuracy of the search results and user experience. For example, when the user enters a keyword, he only knows the Chinese pronunciation of a certain field, but cannot spell out the Chinese text. Due to the limitation that the keyword can only be in the form of Chinese characters, the user will omit the key information, resulting in a large difference between the search results and the information required by the user and inaccuracy. Summary of the invention
[0004] The present invention provides a retrieval method, device, equipment and storage medium based on a relational database to at least solve the problems of low accuracy of retrieval results and poor user experience. The technical solution of the present invention is as follows:
[0005] According to a first aspect of an embodiment of the present invention, a retrieval method based on a relational database is provided, wherein the relational database includes a plurality of preset character strings, and the method includes: receiving a target keyword input by a user in a target input box; based on a mapping relationship between the input box and the preset character string, determining the preset character string corresponding to the target input box in the relational database as a first target character string; converting the first target character string into a second target character string of the same data type as the target keyword; and taking a character string in the second target character string that matches the target keyword as a retrieval result.
[0006] In a possible implementation, the target keyword includes Chinese characters; converting the first target character string into a second target character string of the same data type as the target keyword includes: converting English characters in the first target character string into Chinese characters, and retaining the Chinese characters in the first target character string to obtain the second target character string; the English characters include alphabetic pinyin and / or the first letters of alphabetic pinyin.
[0007] In another possible implementation, the target keyword includes English characters; converting the first target character string into a second target character string of the same data type as the target keyword includes: converting Chinese characters in the first target character string into English characters, and retaining the English characters in the first target character string to obtain the second target character string; the English characters include alphabetic pinyin and / or the first letters of alphabetic pinyin.
[0008] In another possible implementation, converting the Chinese characters in the first target character string into English characters includes: determining the pinyin of the Chinese characters in the first target character string and / or the first letters of the pinyin as the converted English characters.
[0009] In another possible implementation, the character string in the second target character string that matches the target keyword is used as the search result, including: determining the target search mode associated with the target input box; the target search mode includes one or more of the following search modes: Chinese search mode, English search mode, word segmentation search mode and initial letter search mode; based on the target search mode, the target keyword is matched with the second target character string to obtain the search result.
[0010] In another possible implementation, determining a target retrieval mode associated with a target input box includes: sending a display instruction to a target terminal device that displays the target input box, the display instruction being used to instruct the target terminal to display multiple retrieval modes so that a user can select a retrieval mode from the multiple retrieval modes; and determining the retrieval mode selected by the user and returned by the target terminal device as the target retrieval mode.
[0011] In another possible implementation, determining the target search mode associated with the target input box includes: determining the target search mode according to the data type of characters included in the target keyword.
[0012] In another possible implementation, the target search mode includes a word segmentation search mode; based on the target search mode, the target keyword is matched with the second target character string to obtain a search result, including: calling the word segmentation function associated with the word segmentation search mode to split the second target character string to obtain multiple target word segments; each key character of the target keyword is matched with the multiple target word segments to obtain multiple sub-search results; the sub-search result is a character string in the second target character string that is associated with the target word that is the same as any key character in the target keyword; and the multiple sub-search results are connected according to the position order of each key character in the target keyword to obtain a search result.
[0013] In another possible implementation, the target keyword includes a target English character string composed of multiple consecutive target initials, and the target retrieval mode includes an initial retrieval mode; based on the target retrieval mode, the target keyword is matched with the second target character string to obtain a retrieval result, including: matching the target English character string with the English character string in the second target character string to obtain a retrieval result.
[0014] According to a second aspect of an embodiment of the present invention, a retrieval device based on a relational database is provided, wherein the relational database includes multiple preset character strings, and the device includes: a receiving unit, used to receive a target keyword input by a user in a target input box; a determining unit, used to determine the preset character string corresponding to the target input box in the relational database as a first target character string based on a mapping relationship between the input box and the preset character string; a conversion unit, used to convert the first target character string into a second target character string of the same data type as the target keyword; and a retrieval unit, used to take a character string in the second target character string that matches the target keyword as a retrieval result.
[0015] In a possible implementation, the target keyword includes Chinese characters; the conversion unit is specifically used to: convert English characters in the first target string into Chinese characters, and retain the Chinese characters in the first target string to obtain a second target string; the English characters include alphabetic pinyin and / or the first letters of alphabetic pinyin.
[0016] In another possible implementation, the target keyword includes English characters; the conversion unit is specifically used to: convert Chinese characters in the first target string into English characters, and retain the English characters in the first target string to obtain a second target string; the English characters include alphabetic pinyin and / or the first letters of alphabetic pinyin.
[0017] In another possible implementation manner, the conversion unit is specifically configured to: determine the pinyin of the Chinese character and / or the first letter of the pinyin in the first target character string as the converted English character.
[0018] In another possible implementation, the retrieval unit is specifically used to: determine a target retrieval mode associated with a target input box; the target retrieval mode includes one or more of the following retrieval modes: Chinese retrieval mode, English retrieval mode, word segmentation retrieval mode, and initial letter retrieval mode; based on the target retrieval mode, match the target keyword with the second target character string to obtain a retrieval result.
[0019] In another possible implementation, the retrieval unit is specifically used to: send a display instruction to a target terminal device that displays a target input box, the display instruction is used to instruct the target terminal to display multiple retrieval modes so that the user can select a retrieval mode from the multiple retrieval modes; and determine the retrieval mode selected by the user returned by the target terminal device as the target retrieval mode.
[0020] In another possible implementation, the retrieval unit is specifically configured to determine a target retrieval mode according to a data type of characters included in the target keyword.
[0021] In another possible implementation, the target search mode includes a word segmentation search mode; the search unit is specifically used to: call the word segmentation function associated with the word segmentation search mode, segment the second target character string, and obtain multiple target word segments; match each key character of the target keyword with the multiple target word segments respectively to obtain multiple sub-search results; the sub-search result is a character string in the second target character string that is associated with the target word that is the same as any key character in the target keyword; and connect the multiple sub-search results according to the position order of each key character in the target keyword to obtain a search result.
[0022] In another possible implementation, the target keyword includes a target English string consisting of multiple consecutive target initials, and the target search mode includes an initial search mode; the search unit is specifically used to match the target English string with the English string in the second target string to obtain a search result.
[0023] According to a third aspect of an embodiment of the present invention, a computer device is provided, comprising: a processor and a memory for storing processor executable instructions; wherein the processor is configured to execute executable instructions to implement a retrieval method based on a relational database as in the first aspect and any possible implementation thereof.
[0024] According to a fourth aspect of an embodiment of the present invention, a computer-readable storage medium is provided, on which instructions are stored. When the instructions in the computer-readable storage medium are executed by a processor of a computer device, the computer device is enabled to execute a retrieval method based on a relational database such as the first aspect and any possible implementation thereof.
[0025] According to a fifth aspect of an embodiment of the present application, a computer program product is provided, which includes computer instructions. When the computer instructions are executed on a computer device, the computer device executes the retrieval method based on a relational database of the above-mentioned first aspect and any possible implementation thereof.
[0026] The technical solution provided by the embodiment of the present invention brings at least the following beneficial effects: according to the data type of the target keyword, the first target string associated with the target input box in the relational database is converted into a second target string, so that the second target string is the same as the data type of the target keyword, so that the target keyword and the second target string can be matched, and a search result consistent with the target keyword is obtained. In the above search method, according to the data type of the target keyword, the corresponding preset string in the relational database is converted so that the string type inconsistent with the data type of the input target keyword in the relational database is converted to be consistent, that is, the data type of the target keyword is not restricted by the string type in the relational database. Then, the target keyword is matched based on the converted preset string to generate accurate search results, so that in the search process, the target keywords of various different data types input by the user can generate corresponding search results. In this way, through the above search method, the user can input the keywords of the key information that the user understands based on the various expression forms that the user is good at, and can obtain accurate search results, so that the keywords entered by the user can more comprehensively and accurately represent the key information that the user wants to express, and then make the obtained search results more in line with user needs, and improve the accuracy of the search results and user experience.
[0027] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the specification are used to explain the principles of the present application, and do not constitute an improper limitation on the present application.
[0029] Figure 1 is a schematic diagram of a retrieval system based on a relational database according to an exemplary embodiment;
[0030] Figure 2 The following is a flowchart of a retrieval method based on a relational database according to an exemplary embodiment. Figure 1 ;
[0031] Figure 3 is a schematic diagram showing a search result according to an exemplary embodiment;
[0032] Figure 4 The following is a flowchart of a retrieval method based on a relational database according to an exemplary embodiment. Figure 2 ;
[0033] Figure 5 is a block diagram of a retrieval device based on a relational database according to an exemplary embodiment;
[0034] Figure 6 The diagram is a schematic diagram of a computer device according to an exemplary embodiment. DETAILED DESCRIPTION
[0035] In order to enable ordinary persons in the art to better understand the technical solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0036] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.
[0037] In addition, the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0038] Before introducing in detail the retrieval method based on a relational database provided in the embodiment of the present application, a brief introduction is first given to the application scenarios and implementation environment involved in the embodiment of the present application.
[0039] First, a brief introduction to the application scenarios involved in this application is given.
[0040] In order to facilitate users to quickly, accurately and efficiently retrieve the resource information they need, large computer systems usually use relational databases to store resource information and set up fuzzy search functions accordingly. Based on the fuzzy search function and the keywords of the resource information that the user inputs, the user retrieves the resource information matching the keywords from the relational database.
[0041] Usually, the above-mentioned fuzzy search method is based on the query of the like statement, and the user needs to set the input keyword as a Chinese character string to realize the fuzzy search function. Therefore, the above-mentioned fuzzy search method, the expression form of the resource information stored in the relational database, limits the expression form of the user input keyword, so that the keyword input by the user cannot fully represent the key information that the user wants to express, so that the obtained search results cannot meet the user's needs, reducing the accuracy of the search results and user experience. For example, when the user enters a keyword, he only knows the Chinese pronunciation of a certain field, but cannot spell the Chinese character. The user will omit the key information, resulting in a large difference between the search results and the information required by the user and inaccuracy.
[0042] In response to the above problems, the present application provides a retrieval method based on a relational database, which converts the first target string associated with the target input box in the relational database into a second target string according to the data type of the target keyword, so that the second target string is the same as the data type of the target keyword, so that the target keyword can be matched with the second target string to obtain a retrieval result that matches the target keyword. In the above retrieval method, the corresponding preset string in the relational database is converted according to the data type of the target keyword, so that the string type in the relational database that is inconsistent with the data type of the input target keyword is converted to be consistent, that is, the data type of the target keyword is not restricted by the string type in the relational database. Then, the target keyword is matched based on the converted preset string to generate accurate retrieval results, so that in the retrieval process, corresponding retrieval results can be generated based on the target keywords of various data types input by the user.
[0043] Through the above-mentioned search method, users can input keywords of key information they understand based on various expression forms that they are good at, and they can obtain accurate search results. As a result, the keywords input by users can more comprehensively and accurately represent the key information that users want to express, thereby making the obtained search results more in line with user needs, thereby improving the accuracy of search results and user experience.
[0044] Secondly, the implementation architecture involved in this application is briefly introduced below.
[0045] Figure 1 Schematic diagram of a retrieval system based on a relational database provided by this application. Figure 1 As shown, the retrieval system based on the relational database includes a terminal device 101 and a server 102. The terminal device 101 and the server 102 may be connected via a wired network or a wireless network.
[0046] Specifically, the user enters a target keyword in the target input box of the terminal device 101. The server 102 obtains the target input box and the target keyword triggered by the user through the terminal device 101. The target input box is associated with a preset string to be displayed in the target input box. The preset string associated with the target input box (i.e., the first target string) is converted into a second target string so that the data type of the second target string is consistent with the input target keyword, thereby matching the target keyword with the second target string to obtain a search result.
[0047] In some embodiments, the server 102 includes a relational database or is connected to a relational database, and the preset character strings corresponding to the different input boxes are stored in the relational database. The terminal device 101 can obtain the corresponding preset character strings by accessing the relational database.
[0048] In some other embodiments, the server 102 may be a single server, or may be a server cluster composed of multiple servers. In some implementations, the server cluster may also be a distributed cluster. The present application does not limit the specific implementation of the server 102.
[0049] The terminal device 101 may be a mobile phone, tablet computer, desktop, laptop, handheld computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, cellular phone, personal digital assistant (PDA), augmented reality (AR)\virtual reality (VR) device, etc., which can install and use content community applications (such as Kuaishou). This application does not impose any special restrictions on the specific form of the terminal device 101. It can interact with the user through one or more methods such as keyboard, touchpad, touch screen, remote control, voice interaction or handwriting device.
[0050] Optionally, the above Figure 1 In the retrieval system based on a relational database shown, the server 102 can be connected to at least one terminal device 101. The present application does not limit the number and type of terminal devices.
[0051] The retrieval method based on relational database provided in the embodiment of the present application can be applied to the aforementioned Figure 1 For ease of understanding, the following specifically introduces the retrieval method based on a relational database provided by the present application in conjunction with the accompanying drawings.
[0052] Figure 2is a flowchart of a retrieval method based on a relational database according to an exemplary embodiment. Figure 2 As shown, the retrieval method based on the relational database includes the following steps.
[0053] S21, receiving a target keyword input by a user in a target input box.
[0054] The above-mentioned target input box is used for retrieval, that is, it has a retrieval function and can be called a target retrieval box.
[0055] In some embodiments, a plurality of input boxes are displayed on the terminal device, and in response to a user selecting an input box, the selected input box is used as a target input box. The terminal device then obtains a target keyword input by the user from the target input box based on the user's input operation in the target input box, and sends the target keyword and the target identifier of the target input box to the server, so that the server receives the target keyword and the target identifier.
[0056] The target keyword may include multiple consecutive characters, ie, multiple character strings; or may include multiple discontinuous characters, ie, spaced characters.
[0057] S22: Based on the mapping relationship between the input box and the preset character string, determine the preset character string corresponding to the target input box in the relational database as the first target character string.
[0058] The server is provided with a mapping relationship between the input box and the preset character string, and the mapping relationship is used to indicate the association relationship between the input box and the preset character string displayed in the input box.
[0059] In some embodiments, it is determined whether the application attribute of the input box is consistent with the application attribute of the preset string, and the input box with the consistent application attribute is correspondingly associated with the preset string to form a mapping relationship between the two.
[0060] For example, Figure 3 As shown, the application attribute of the input box of "Select Page" is "Page"; the application attribute of the preset strings "Page B", "page Tianyan plus page" and "Personal Center Page" is also "Page". In this way, the following preset strings "Page B", "page Tianyan plus page" and "Personal Center Page" are associated with the input box of "Select Page" to obtain the mapping relationship between the input box of "Select Page" and the above preset strings.
[0061] S23, converting the first target character string into a second target character string having the same data type as the target keyword.
[0062] Convert the first target string associated with the target input box in the relational database into a second target string so that the data type of the second target string is the same as that of the target keyword, facilitating the matching of the target keyword with the second target string.
[0063] S24. Use the string in the second target string that matches the target keyword as the retrieval result.
[0064] The above first target string, second target string, and retrieval result may include Chinese character strings, may include English character strings, or may include Chinese characters or English characters. Exemplarily, the Chinese character string is "page", and the corresponding English character strings are "ye mian" or "YM".
[0065] Through the above implementation, according to the data type of the target keyword, convert the corresponding preset string in the relational database so that the string types in the relational database that are inconsistent with the data type of the input target keyword are converted to be consistent, that is, the data type of the target keyword is not restricted by the string types in the relational database. Then, based on the converted preset string, match the target keyword to generate an accurate retrieval result, so that during the retrieval process, for various target keywords with different data types input by the user, corresponding retrieval results can be generated.
[0066] In this way, the user can input the keywords of the key information they know based on various expression forms they are good at, and can obtain accurate retrieval results, so that the keywords input by the user can more comprehensively and accurately represent the key information the user wants to express, and further make the obtained retrieval results more in line with the user's needs, improving the accuracy of the retrieval results and the user experience.
[0067] As a refinement and extension of the specific implementation of the above embodiment, in order to fully illustrate the specific implementation process of this embodiment, the embodiments of the present application provide some other retrieval methods based on the relational database.
[0068] In one implementation, the target keyword includes Chinese characters.
[0069] The above target keyword includes Chinese characters, which can be understood as that the target keyword can all be Chinese characters, that is, the target keyword only includes Chinese characters; the target keyword can also not all be Chinese characters, that is, the target keyword includes both Chinese characters and English characters.
[0070] Based on this implementation, combined with Figure 2 , as Figure 4 shown, the above S23 can be specifically implemented through the following steps.
[0071] S231. Convert the English characters in the first target string to Chinese characters and retain the Chinese characters in the first target string to obtain the second target string.
[0072] Among them, the English characters include letter pinyin and / or the first letter of the letter pinyin. Exemplarily, the Chinese character is "page", and the corresponding English character is "ye" or "Y"; the Chinese character is "surface", and the corresponding English character is "mian" or "M".
[0073] It can be understood that while converting the English characters included in the above first target string to Chinese characters, the original Chinese character string in the first target string is retained. If the first target string does not include a Chinese character string, directly convert the English characters included in the first target string to Chinese characters.
[0074] In some embodiments, for any input box, a corresponding conversion relationship between English characters and Chinese characters is set. Based on this corresponding conversion relationship for the mutual conversion of English characters and Chinese characters, the English characters in the first target string are converted to Chinese characters.
[0075] As an implementation manner, this corresponding conversion relationship is also specifically used for the mutual conversion of English character strings and Chinese character strings, and the English character string in the first target string is converted to a Chinese character string.
[0076] In this implementation manner, through the conversion method of converting English characters to Chinese characters, it is realized that based on the corresponding English character string in the relational database, the target keyword including Chinese characters can be retrieved.
[0077] For the scenario where the target keyword includes Chinese characters, based on the Chinese retrieval mode, the Chinese character string that matches the Chinese character string included in the target keyword and the Chinese character string of the second target string is used as the retrieval result.
[0078] In another implementation manner, the target keyword includes English characters.
[0079] The above target keyword includes English characters, which can be understood as that the target keyword can all be English characters, that is, the target keyword only includes English characters; the target keyword can also not all be English characters, that is, the target keyword includes both English characters and Chinese characters.
[0080] Based on this implementation manner, combined with Figure 2 , such as Figure 4 shown, the above S23 can also be specifically implemented through the following steps.
[0081] S23A, converting Chinese characters in the first target character string into English characters, and retaining the English characters in the first target character string to obtain a second target character string.
[0082] As an implementation manner, based on the corresponding conversion relationship for mutual conversion between English characters and Chinese characters, the Chinese characters in the first target character string are converted into English characters.
[0083] Specifically, the corresponding conversion relationship is also specifically used for mutual conversion between English character strings and Chinese character strings, and converting the Chinese character string in the first target character string into an English character string.
[0084] As another implementation, the pinyin of the Chinese character in the first target character string and / or the first letter of the pinyin is determined as the converted English character.
[0085] In this embodiment, by converting English characters into Chinese characters, it is possible to search for target keywords including English characters based on corresponding Chinese character strings in a relational database.
[0086] For the scenario where the target keyword includes both English characters and Chinese characters, the English characters in the first target string are converted into Chinese characters, and the Chinese characters in the first target string are retained to obtain a first sub-target string; and the Chinese characters in the first target string are converted into English characters, and the English characters in the first target string are retained to obtain a second sub-target string. The first sub-target string and the second sub-target string are used as the second target string.
[0087] Correspondingly, S24 is specifically implemented in the following manner: the character string that matches the Chinese characters of the target keyword in the first sub-target character string of the second target character string is used as the first search result. And the character string that matches the English characters of the target keyword in the second sub-target character string of the second target character string is used as the second search result. According to the first search result and the second search result, a search result is obtained.
[0088] Furthermore, in order to make the provided search mode more compatible with the search mode required by the user, a corresponding search mode is set on each input box.
[0089] In one method of determining a search mode, in order to improve the adaptability of the search mode to the user's search habits, the server determines the target search mode associated with the target input box according to the historical search mode corresponding to the target input box and / or the historical keywords input in the target input box. In this way, the target search mode can indicate the data type or input form of the target keyword input by the user, that is, the user's search habits.
[0090] For example, when the user habitually inputs Chinese characters in the target input box for searching, the target search mode is the Chinese search mode. When the user habitually inputs pinyin in the target input box for searching, the target search mode is the English search mode.
[0091] In another method of determining the search mode, in order to ensure the flexibility of the search mode, the server sends a display instruction to the target terminal device that displays the target input box, and the display instruction is used to instruct the target terminal to display multiple search modes so that the user can select a search mode from the multiple search modes. The search mode selected by the user returned by the target terminal device is determined as the target search mode. Based on this, the user can select a search mode that is more suitable for the target keyword according to the content and data type of the target keyword entered by the user, and match the target keyword with the second target string.
[0092] In order to improve the adaptability of the search method to the user's search needs, based on the above target search mode, the target keyword is matched with the second target character string to obtain the search result.
[0093] In another method for determining a search mode, a target search mode is determined based on the data type of the characters included in the target keyword. Specifically, when the target keyword includes a Chinese character string, the target search mode is determined to include a Chinese search mode. When the target keyword includes an English character string, the target search mode is determined to include an English search mode. When the target keyword includes an English character string composed of letters and pinyin, the target search mode is determined to include an English search mode. When the target keyword includes an English character string composed of the first letters of letters and pinyin, the target search mode is determined to include an initial letter search mode. The target search mode is determined to include a word segmentation search mode by searching for spaced English characters and / or spaced Chinese characters in the target keyword.
[0094] Among them, the target search mode includes one or more of the following: Chinese search mode, English search mode, word segmentation search mode and initial letter search mode.
[0095] The Chinese search mode is used to indicate that the Chinese character string in the target keyword is searched based on the Chinese character string in the second target character string, that is, the target Chinese character string in the target keyword is matched with the Chinese character string in the target keyword. Exemplarily, fuzzy search based on a like statement belongs to the Chinese search mode.
[0096] The English search mode is used to indicate that the English string consisting of letters and pinyin in the target keyword is searched based on the English string consisting of letters and pinyin in the second target string, that is, the English string consisting of letters and pinyin in the target keyword is searched with the English string consisting of letters and pinyin in the second target string. This English search mode is also called the full pinyin search mode.
[0097] The first letter search mode is used to indicate that the English string consisting of the first letters of the pinyin of the target keyword is searched based on the English string consisting of the first letters of the pinyin in the second target string, that is, the English string consisting of the first letters of the pinyin of the target keyword is matched with the English string consisting of the first letters of the pinyin in the second target string.
[0098] The word segmentation search mode is used to indicate that based on the English character string and / or Chinese character string in the second target character string, the separated (not forming a phrase) English characters and / or separated (not forming a phrase) Chinese characters in the target keyword are searched.
[0099] It should be noted that the above-mentioned search modes are all implemented based on the fuzzy search method.
[0100] The following introduces various application scenarios in the word segmentation retrieval mode.
[0101] When it is determined that the continuity of each keyword in the target keyword is less than the continuity threshold or each keyword in the target keyword includes intervals (such as separators), it means that each keyword in the target keyword is not continuous, and it is determined that the target search mode includes a word segmentation search mode.
[0102] When the target search mode includes a word segmentation search mode, the server first calls the word segmentation function associated with the word segmentation search mode to segment the second target string to obtain multiple target word segments. For example, the word segmentation function can separate the Chinese string into individual Chinese characters, for example, segmenting "I am Chinese" into five characters "I, is, China, country, people".
[0103] Furthermore, each key character of the target keyword is matched with multiple target word segments to obtain multiple sub-search results, wherein a sub-search result is a character string in the second target character string associated with a target word having the same key character as any key character in the target keyword.
[0104] Finally, according to the position sequence of each key character in the target keyword, multiple sub-search results are connected to obtain the search result.
[0105] Exemplarily, when the user inputs one or more continuous or discontinuous arbitrary key characters in "I am Chinese" included in the second target character string, "I am Chinese" can be fuzzily retrieved.
[0106] Based on the above word segmentation search mode, users can enter one or more continuous or discontinuous keyword characters to obtain corresponding search results through fuzzy search.
[0107] In one embodiment, if the target keyword includes a target English string composed of multiple consecutive target initials, it is determined that the target search mode includes an initial search mode. Based on the initial search mode, the target keyword is matched with the second target string to obtain a search result, which specifically includes: matching the target English string with the English string in the second target string to obtain a search result. It should be noted that in actual applications, the type of data type included in the second target string can be determined based on different combinations of different data types included in the target keyword.
[0108] In order to realize the above functions, the retrieval device based on the relational database includes hardware structures and / or software modules corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that, in combination with the algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.
[0109] The present application also provides a method Figure 5 The retrieval device based on a relational database shown in the figure includes a plurality of preset character strings. The device includes: a receiving unit 501 , a determining unit 502 , a converting unit 503 and a retrieval unit 504 .
[0110] The receiving unit 501 is used to receive a target keyword input by a user in a target input box. The determining unit 502 is used to determine a preset string corresponding to the target input box in a relational database as a first target string based on a mapping relationship between the input box and the preset string. The converting unit 503 is used to convert the first target string into a second target string of the same data type as the target keyword. The retrieving unit 504 is used to take a string in the second target string that matches the target keyword as a retrieval result.
[0111] In a possible implementation, the target keyword includes Chinese characters; the conversion unit 503 is specifically used to: convert the English characters in the first target string into Chinese characters, and retain the Chinese characters in the first target string to obtain a second target string; the English characters include alphabetic pinyin and / or the first letters of alphabetic pinyin.
[0112] In another possible implementation, the target keyword includes English characters; the conversion unit 503 is specifically used to: convert the Chinese characters in the first target string into English characters, and retain the English characters in the first target string to obtain a second target string; the English characters include alphabetic pinyin and / or the first letters of alphabetic pinyin.
[0113] In another possible implementation, the conversion unit 503 is specifically configured to: determine the pinyin of the Chinese characters and / or the first letters of the pinyin of the Chinese characters in the first target character string as the converted English characters.
[0114] In another possible implementation, the retrieval unit 504 is specifically used to: determine a target retrieval mode associated with a target input box; the target retrieval mode includes one or more of the following retrieval modes: Chinese retrieval mode, English retrieval mode, word segmentation retrieval mode, and initial letter retrieval mode; based on the target retrieval mode, match the target keyword with the second target character string to obtain a retrieval result.
[0115] In another possible implementation, the retrieval unit is specifically used to: send a display instruction to a target terminal device that displays a target input box, the display instruction is used to instruct the target terminal to display multiple retrieval modes so that the user can select a retrieval mode from the multiple retrieval modes; and determine the retrieval mode selected by the user returned by the target terminal device as the target retrieval mode.
[0116] In another possible implementation, the retrieval unit 504 is specifically configured to determine a target retrieval mode according to a data type of characters included in the target keyword.
[0117] In another possible implementation, the target search mode includes a word segmentation search mode; the search unit 504 is specifically used to: call the word segmentation function associated with the word segmentation search mode, segment the second target character string, and obtain multiple target word segments; match each key character of the target keyword with the multiple target word segments respectively to obtain multiple sub-search results; the sub-search result is a character string in the second target character string that is associated with the target word that is the same as any key character in the target keyword; and connect the multiple sub-search results according to the position order of each key character in the target keyword to obtain a search result.
[0118] In another possible implementation, the target keyword includes a target English string consisting of multiple consecutive target initials, and the target search mode includes an initial search mode; the search unit 504 is specifically used to match the target English string with the English string in the second target string to obtain a search result.
[0119] Regarding the device in the above embodiment, the specific manner in which each unit module performs the operation has been described in detail in the embodiment of the method, and will not be elaborated here.
[0120] Figure 6 Schematic diagram of a computer device provided by this application. Figure 6 The computer device 60 may include at least one processor 601 and a memory 603 for storing processor executable instructions. The processor 601 is configured to execute instructions in the memory 603 to implement the retrieval method based on a relational database in the following embodiment.
[0121] In addition, the computer device 60 may also include a communication bus 602 , at least one communication interface 604 , an input device 606 , and an output device 605 .
[0122] The processor 601 may be a central processing unit (CPU), a microprocessing unit, an ASIC, or one or more integrated circuits for controlling the execution of the program of the present application.
[0123] Communication bus 602 may include a pathway for transmitting information between the above-mentioned components.
[0124] The communication interface 604 uses any transceiver or other device for communicating with other devices or communication networks, such as Ethernet, radio access network (RAN), wireless local area networks (WLAN), etc.
[0125] The input device 606 is used to receive input signals and the output device 605 is used to output signals.
[0126] The memory 603 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processing unit through a bus. The memory may also be integrated with the processing unit.
[0127] The memory 603 is used to store instructions for executing the solution of the present application, and the execution is controlled by the processor 601. The processor 601 is used to execute the instructions stored in the memory 603, so as to realize the functions in the method of the present application.
[0128] In a specific implementation, as an embodiment, the processor 601 may include one or more CPUs, such as Figure 6 CPU0 and CPU1 in.
[0129] In a specific implementation, as an embodiment, the computer device 60 may include multiple processors, such as Figure 6 601 and processor 607 in FIG. Each of these processors may be a single-CPU processor or a multi-CPU processor. A processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0130] The computer equipment Figure 6 The system shown includes: a processor 601 and a memory 603 for storing executable instructions of the processor 601; wherein the processor 601 is configured to execute the executable instructions to implement a retrieval method based on a relational database as in any possible implementation method described above. The same technical effect can be achieved, and to avoid repetition, it will not be described here.
[0131] The embodiment of the present application also provides a computer-readable storage medium, when the instructions in the computer-readable storage medium are executed by a processor of a retrieval device or computer device based on a relational database, the retrieval device or computer device based on a relational database can execute a retrieval method based on a relational database in any of the above possible implementations. And the same technical effect can be achieved, so it will not be repeated here to avoid repetition.
[0132] The embodiment of the present application also provides a computer program product, including a computer program or an instruction, which is executed by a processor as a retrieval method based on a relational database in any of the above possible implementations. And the same technical effect can be achieved, so it will not be repeated here to avoid repetition.
[0133] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0134] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A retrieval method based on a relational database, characterized in that: The relational database includes a plurality of preset character strings, and the method includes: Receive the target keyword entered by the user in the target input box; Based on the mapping relationship between the input box and the preset character string, determining the preset character string corresponding to the target input box in the relational database as the first target character string; Converting the first target character string into a second target character string of the same data type as the target keyword; The character string in the second target character string that matches the target keyword is used as a search result.
2. The method according to claim 1, characterized in that The target keyword includes Chinese characters; and converting the first target character string into a second target character string having the same data type as the target keyword includes: The English characters in the first target character string are converted into Chinese characters, and the Chinese characters in the first target character string are retained to obtain the second target character string; the English characters include alphabetic pinyin and / or the first letters of alphabetic pinyin.
3. The method according to claim 1, characterized in that The target keyword includes English characters; the English characters include alphabetic phonetic symbols and / or the first letters of alphabetic phonetic symbols; The converting the first target character string into a second target character string having the same data type as the target keyword comprises: The Chinese characters in the first target character string are converted into English characters, and the English characters in the first target character string are retained to obtain the second target character string.
4. The method according to claim 3, characterized in that The converting the Chinese characters in the first target character string into English characters comprises: The pinyin of the Chinese character in the first target character string and / or the first letter of the pinyin is determined as the converted English character.
5. The method according to any one of claims 1 to 4, characterized in that The step of taking the character string in the second target character string that matches the target keyword as the search result includes: Determine a target search mode associated with the target input box; the target search mode includes one or more of the following search modes: Chinese search mode, English search mode, word segmentation search mode and initial search mode; Based on the target search pattern, the target keyword is matched with the second target character string to obtain the search result.
6. The method according to claim 5, characterized in that The determining of the target retrieval mode associated with the target input box includes: Sending a display instruction to a target terminal device displaying the target input box, wherein the display instruction is used to instruct the target terminal to display multiple retrieval modes so that a user can select a retrieval mode from the multiple retrieval modes; The retrieval mode selected by the user and returned by the target terminal device is determined as the target retrieval mode.
7. The method according to claim 5, characterized in that The determining of the target retrieval mode associated with the target input box includes: The target search mode is determined according to the data type of the characters included in the target keyword.
8. The method according to any one of claims 5 to 7, characterized in that The target search mode includes the word segmentation search mode; the target keyword is matched with the second target character string based on the target search mode to obtain the search result, including: Calling the word segmentation function associated with the word segmentation search mode to segment the second target character string to obtain a plurality of target word segments; Matching each key character of the target keyword with the multiple target participles respectively to obtain multiple sub-search results; the sub-search results are character strings associated with the target participles in the second target character string that are identical to any key character in the target keyword; According to the position sequence of each key character distributed in the target keyword, the multiple sub-search results are connected to obtain the search result.
9. The method according to any one of claims 5 to 7, characterized in that The target keyword includes a target English character string composed of a plurality of consecutive target initials, and the target search mode includes the initial search mode; the target keyword is matched with the second target character string based on the target search mode to obtain the search result, including: The target English character string is matched with the English character string in the second target character string to obtain the search result.
10. A retrieval device based on a relational database, characterized in that: The relational database includes a plurality of preset character strings, and the device includes: A receiving unit, used to receive a target keyword input by a user in a target input box; a determining unit, configured to determine the preset string corresponding to the target input box in the relational database as a first target string based on a mapping relationship between the input box and the preset string; a conversion unit, configured to convert the first target character string into a second target character string of the same data type as the target keyword; The retrieval unit is used to take the character string in the second target character string that matches the target keyword as a retrieval result.
11. A computer device, characterized in that: include: A processor and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the executable instructions to implement the retrieval method based on a relational database as described in any one of claims 1-9.
12. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of a computer device, the computer device is enabled to execute the relational database-based retrieval method according to any one of claims 1 to 9.