Data retrieval method, terminal and storage medium
By storing the index table locally in the terminal and prioritizing local matching queries, the problem of the aggregation platform query operation occupying server resources and slow feedback is solved, achieving more efficient retrieval and improving user experience.
Patent Information
- Application Number
- CN202411950496.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-05-09
AI Technical Summary
When existing aggregation platforms use user query operations, they need to send the search keywords to the backend server, resulting in large server resources and slow query feedback, which affects the user experience.
A index table is stored locally in the terminal, which contains information about some of the search objects in the historical search record of the background server. The terminal prefers to perform matching queries locally based on the search keywords. If the match is successful, the result will be directly feedback without forwarding to the background server.
By reducing resource requests to the backend server, the retrieval efficiency and user experience are improved, and server resources are saved.
Smart Images

Figure CN119961430A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and in particular to a data retrieval method, terminal and storage medium. Background Art
[0002] With the rapid development of Internet technology, various online software platforms have become a trend. Different developers can deploy their own software applications by deploying small programs on the platform, so that end users can install a platform program and use multiple different applications. This platform that can be compatible with and install multiple different software applications is also called an aggregation platform. Common ones include online software service (English full name: Software-as-a-service, English abbreviation: SAAS) platform.
[0003] However, since this aggregation platform is compatible with many different applications and the data processing capabilities of general terminals are limited, most of the data processing functions need to be completed in the background server, such as the query function of the basic information of the object. In the prior art, when a user needs to perform a query operation, the terminal sends the keywords to the background server, and then the background server completes the query and feeds back the query results. This query method not only occupies server resources, but also has slow query feedback, affecting the user experience. Summary of the invention
[0004] In order to solve the above technical problems, the present application provides a data retrieval method, terminal and storage medium for improving retrieval efficiency and improving user experience.
[0005] The first aspect of the present application provides a data retrieval method, which is applied to a terminal device and includes:
[0006] Get search keywords;
[0007] Matching search objects from an index table according to the search keyword, the index table containing a mapping relationship between multiple search objects and index files of the search objects, the multiple search objects being part of all search objects in the historical search records of the backend server, and the index table being stored locally in the terminal;
[0008] When the search keyword is successfully matched in the index table, the search result is fed back according to the index file of the successfully matched target search object.
[0009] Optionally, when the index table contains basic information of the search object, feeding back the search result according to the index file of the successfully matched target search object includes:
[0010] The basic information of the target search object is obtained from the local terminal according to the index file of the successfully matched target search object, and the basic information is fed back.
[0011] Optionally, when the index table does not contain basic information of the search object, feeding back the search result according to the index file of the successfully matched target search object includes:
[0012] The basic information of the target search object is obtained from the background server according to the index file of the successfully matched target search object, and the basic information is fed back.
[0013] Optionally, the index file is a query statement for basic information of the target retrieval object.
[0014] Optionally, the index file is a pointer to the basic information of the target retrieval object located on the backend server.
[0015] Optionally, the method further includes:
[0016] When the search keyword fails to match in the index table, the search keyword is sent to the backend server for retrieval;
[0017] Receive the search result fed back by the backend server.
[0018] Optionally, the index table is generated by the backend server according to historical retrieval records, and the method further includes:
[0019] An updated index table sent by the backend server is received, wherein the updated index table is an index table adjusted by the backend server according to the updated historical search record, wherein the historical search record includes the number of times the search object is queried.
[0020] A second aspect of the present application provides a data retrieval terminal, the terminal comprising:
[0021] An acquisition unit, used for acquiring search keywords;
[0022] A matching unit, used for matching a search object from an index table according to the search keyword, wherein the index table contains a mapping relationship between multiple search objects and index files of the search objects, wherein the multiple search objects are some of all search objects in the historical search records of the backend server, and the index table is stored locally in the terminal;
[0023] The feedback unit is used to feedback the search result according to the index file of the successfully matched target search object when the search keyword is successfully matched in the index table.
[0024] A third aspect of the present application provides a terminal for school data retrieval, the terminal comprising:
[0025] Processor, memory, input-output unit, and bus;
[0026] The processor is connected to the memory, the input and output unit, and the bus;
[0027] The memory stores a program, and the processor calls the program to execute the first aspect and any optional method in the first aspect.
[0028] A fourth aspect of the present application provides a computer-readable storage medium, on which a program is stored. When the program is executed on a computer, the program executes the first aspect and any optional method in the first aspect.
[0029] It can be seen from the above technical solutions that this application has the following advantages:
[0030] After obtaining the search keyword, the terminal does not immediately send the search keyword to the backend server for query, but first performs a matching query from the local index table of the terminal. Because the local index table of the terminal stores the information of some search objects, these partial search objects are the search objects of some records in the historical search records of the backend server. Therefore, the information of these partial search objects is the object information that the user has queried. The terminal preferentially performs query matching locally based on the search keyword. If the match is successful, the query result is directly fed back from the local terminal without forwarding the search keyword to the backend server, which saves the resources of the backend server, and the search feedback is fast, which improves the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solution in the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0032] Figure 1 A schematic diagram of an embodiment of a data retrieval method provided by the present application;
[0033] Figure 2 A flowchart of an embodiment of an index table including basic information of an object in a data retrieval method provided by the present application;
[0034] Figure 3 A flowchart of an embodiment in which the index table does not contain basic information of an object in the data retrieval method provided by the present application;
[0035] Figure 4 A schematic diagram of the structure of an embodiment of a data retrieval terminal provided by the present application;
[0036] Figure 5 A schematic diagram of the structure of another embodiment of a terminal for data retrieval provided in the present application. DETAILED DESCRIPTION
[0037] It should be noted that the data retrieval method provided in this application is applied to a terminal, for example, the terminal can be a smart phone or computer, tablet computer, smart TV, smart watch, POS machine, portable computer terminal or a fixed terminal such as a desktop computer. For the convenience of explanation, this application uses the terminal as the execution subject for example.
[0038] See also Figure 1 , Figure 1 An embodiment of the data retrieval method provided by the present application includes:
[0039] S101, obtaining search keywords;
[0040] When a user uses a terminal to perform a query operation, he or she will generally enter a keyword directly or select a commonly used keyword. Once the user performs the above operation, the terminal obtains the search keyword. The terminal needs to output the query results that the user wants based on the keyword entered by the user. It should be noted that the search keyword can be a specific phrase, a single word, or a word, or it can be the ID of an object. For example, in the scenario of product query, the terminal displays some pictures of commonly used products. When the user clicks on a picture, the corresponding product link in the picture can be triggered. The link will contain the ID of the product. In this scenario, the search keyword is the ID of the product.
[0041] S102, matching search objects from an index table according to search keywords, the index table including mapping relationships between multiple search objects and index files of the search objects, the multiple search objects being part of all search objects in the historical search records of the backend server, and the index table being stored locally in the terminal;
[0042] After the terminal obtains the search keyword, it will not be sent directly to the background server for query and wait for the query result feedback, but will give priority to local query. Because the present application scheme proposes a new search system, in the present application scheme, the background server will maintain an index table, which is a table of index files of several search objects (objects) screened out by the background server according to the historical search records of the terminal. Taking the search object as a commodity as an example, in the historical search record, there are 1000 search records, among which the background server will map the IDs of the top 50 commodities with the most searches and their corresponding index files one by one, obtain an index table, and send the index table to the terminal so that the terminal performs local storage. It should be noted that the index table can be the objects and their index relationships obtained by screening from high to low according to the number of searches of the object, or it can be customized by the user. For example, if a merchant advertises certain commodities within a certain period of time, it can be expected that the promoted commodities will be queried many times in the near future.
[0043] S103: When the search keyword is successfully matched in the index table, the search result is fed back according to the index file of the successfully matched target search object.
[0044] Because the terminal stores some information about the search object locally, after obtaining the search keyword, the terminal will first match it from the locally stored index table. When the match is successful, the target search object index file is directly obtained, thereby obtaining the basic information of the target object. The specific implementation method of the match depends on the specific situation of the mapping relationship in the index table. When the mapping relationship in the index table is the name of the object and the corresponding index file, the search keyword and the name of the object are accurately matched or fuzzily matched. When the mapping relationship in the index table is the ID of the object and the corresponding index file, the search keyword is first converted to the ID of the object, and then an accurate match is performed.
[0045] In an embodiment of the present application, after obtaining the search keyword, the terminal does not immediately send the search keyword to the backend server for query, but first performs a matching query from the local index table of the terminal. Because the local index table of the terminal stores information about some search objects, these partial search objects are search objects of some records in the historical search records of the backend server, and therefore, the information about these partial search objects is object information that the user has queried. The terminal preferentially performs query matching locally based on the search keyword. If the match is successful, the query result is directly fed back from the local terminal without forwarding the search keyword to the backend server, which saves the resources of the backend server, and the search feedback is fast, which improves the user experience.
[0046] exist Figure 1In the embodiment, if the index table stored locally in the terminal contains the basic information of the search object, then under the premise of successful matching, the terminal does not need to access the backend server, and can directly extract the basic information of the target search object locally for feedback. Figure 2 As shown, Figure 2 This is an embodiment of the situation where the search table contains basic information of the search object, and the embodiment includes:
[0047] S201, when the index table contains basic information of the search object, the basic information of the target search object is obtained from the local terminal according to the index file of the successfully matched target search object, and the basic information is fed back;
[0048] Users or developers can customize whether the local index table of the terminal contains the basic information of the search object based on improving the search efficiency, or the load balancing of both ends (terminal and backend server), or the network transmission situation. When the premise is to improve the search efficiency, when the backend server maintains the index table, it will retrieve all the basic information of the search object that has been screened or selected into the index table, and send it to the terminal for local storage. In this way, when the terminal matches according to the search keywords, after the match is successful in the local search table, it directly retrieves the basic information of the search object from the local for output and display, without sending a search request to the backend server and waiting for the search data of the backend server, thereby improving the search efficiency. For example, when the search object is a commodity, the basic information of the commodity generally includes: name, price, picture, video, and inventory quantity. The backend server retrieves all this basic information and stores it in the index table, and sends it to the terminal for local storage. In this way, although there are certain requirements for the storage capacity of the terminal, the search efficiency is improved.
[0049] S202, when the search keyword fails to match in the index table, the search keyword is sent to the backend server for retrieval;
[0050] After obtaining the search keyword, the terminal will first match it in the local index table. If the match is successful, the index file of the target object will be extracted from the local index table. If the index file is the basic information of the search object, it will be directly retrieved and output for display. If the match fails, it means that the search keyword is not a frequently searched keyword, or it is not a user-defined keyword during the promotion period. Therefore, the index table does not contain the keyword. At this time, the terminal needs to send the search keyword to the background server for retrieval.
[0051] S203: Receive the search result fed back by the backend server.
[0052] After receiving the search keywords sent by the terminal, the background server searches and matches the data based on the search keywords. If relevant information can be retrieved, the information is sent to the terminal. If no relevant information is retrieved, empty information is fed back, or basic information of objects similar to the search keywords is selected for feedback based on the intelligent matching rules.
[0053] It should be noted that S202 and S203 in this embodiment are not only applicable to Figure 1 and Figure 2 Embodiment, also applies to the following Figure 3 Example.
[0054] exist Figure 1 In the embodiment, if the index table stored locally in the terminal does not contain the basic information of the search object, the terminal will send the corresponding index file to the backend server if the match is successful, so that the backend server can directly retrieve the basic information of the target search object according to the index file. Figure 3 As shown, Figure 3 This is an embodiment of the situation where the search table does not contain basic information of the search object, and the embodiment includes:
[0055] S301, when the index table does not contain the basic information of the search object, obtain the basic information of the target search object from the backend server according to the index file of the successfully matched target search object, and feed back the basic information;
[0056] When the terminal's storage or processing capabilities are weak, or the user / developer does not want the terminal to store the basic information of the object, the index table maintained by the backend server only contains the object and its corresponding index file (this index file does not contain the basic information of the object). Therefore, the index table file stored locally in the terminal is small and does not occupy too much storage space. After the terminal successfully matches the search keyword in the index table, it still cannot directly retrieve the basic information of the target search object from the local computer. It still needs to send the corresponding index file to the backend server, which retrieves and provides feedback based on the index file.
[0057] Optionally, the index file is a query statement for basic information of the target retrieval object;
[0058] In this optional embodiment, the index file is a query statement for the basic information of the retrieval object, such as an SQL query statement. In the prior art, when the backend server performs data retrieval, it will generate a corresponding SQL query statement based on keywords before it can query from the database. In order to save the time of generating the query statement, in this embodiment, the backend server pre-generates the relevant query statements for commonly used or customized objects, and maintains them as index tables for storage. When the terminal sends the corresponding index file to the backend server, that is, the terminal directly sends the query statement of the target retrieval object to the backend server, the backend server no longer needs to generate a query statement based on the retrieval keyword, but directly executes the query statement, so that data can be quickly retrieved from the database, thereby improving the retrieval efficiency.
[0059] Optionally, the index file is a pointer to the basic information of the target retrieval object located on the backend server;
[0060] In this optional embodiment, the index file is a pointer to the database of the basic information of the retrieval object in the backend server. In the above optional embodiment, the backend server executes a query statement to perform the retrieval. When the number of objects in the database of the backend server is too large, the retrieval process still requires a certain amount of time. Therefore, in the present embodiment, the backend server pre-retrieves the relevant basic information of the commonly used or customized objects, and then generates a pointer for the extraction path of the basic information, and maintains it in the index table to form an index file. In this way, when the terminal sends the corresponding index file to the backend server, that is, the terminal directly sends the pointer of the basic information extraction path of the target retrieval object in the backend server to the backend server, so that the backend server does not need to perform a database retrieval process, and can directly extract the basic information of the target object according to the path pointed to by the pointer, thereby improving the retrieval efficiency.
[0061] S302: Receive an updated index table sent by the background server, where the updated index table is an index table adjusted by the background server according to the updated historical search record, where the historical search record includes the number of times the search object has been queried.
[0062] Because the historical search records are constantly updated, the commonly used objects may be replaced. Therefore, the background server can update the index table in real time or regularly. For example, within a week, 500 new search records are added. The background server re-determines the objects with the top 50 search times based on the previous historical records and the new search records within this week, and updates the index table. The background server sends the updated index table to the terminal, so that the terminal replaces the original index table after receiving the updated index table. It should be noted that the update condition of the index table is not only updated according to the historical search records, but also can be customized by the user or developer according to the needs. For example, the developer decides to advertise some objects in the next 5 days, and it can be expected that users will make a large number of queries on these promoted objects in the next 5 days. Therefore, the background server can actively generate an index table and send it to the terminal. For this scenario, the terminal can choose to replace the original index table with the index table received by the terminal, or store both index tables locally.
[0063] It should be noted that S302 in this embodiment is not only applicable to Figure 3 Embodiment, also applicable to Figure 1 and Figure 2 Embodiment and any optional embodiment therein.
[0064] The following is a detailed description of the data retrieval terminal provided by this application. Figure 4 , Figure 4 An embodiment of a terminal for data retrieval provided by the present application, the terminal comprises:
[0065] An acquisition unit 401 is used to acquire search keywords;
[0066] A matching unit 402, used to match search objects from an index table according to search keywords, the index table including a mapping relationship between multiple search objects and index files of the search objects, the multiple search objects being part of all search objects in the historical search records of the backend server, and the index table being stored locally in the terminal;
[0067] The feedback unit 403 is used to feedback the search result according to the index file of the successfully matched target search object when the search keyword is successfully matched in the index table.
[0068] Optionally, when the index table contains basic information of the search object, the feedback unit 403 is specifically configured to:
[0069] The basic information of the target search object is obtained from the terminal locally according to the index file of the successfully matched target search object, and the basic information is fed back.
[0070] Optionally, when the index table does not contain basic information of the search object, the feedback unit 403 is specifically configured to:
[0071] The basic information of the target search object is obtained from the background server according to the index file of the successfully matched target search object, and the basic information is fed back.
[0072] Optionally, the index file is a query statement for basic information of the target retrieval object.
[0073] Optionally, the index file is a pointer to basic information of the target retrieval object located on the backend server.
[0074] Optionally, the terminal further includes:
[0075] A sending unit 404, configured to send the search keyword to a backend server for retrieval when the search keyword fails to match in the index table;
[0076] The receiving unit 405 is used to receive the search result fed back by the backend server.
[0077] Optionally, the index table is generated by the background server according to the historical search records, and the receiving unit 405 is further used to:
[0078] An updated index table sent by a background server is received, where the updated index table is an index table adjusted by the background server according to the updated historical search record, where the historical search record includes the number of times the search object has been queried.
[0079] In the terminal of this embodiment, the functions of each unit are the same as those described above. Figures 1 to 3 The steps in the method embodiment shown correspond to each other and will not be repeated here.
[0080] See also Figure 5 , Figure 5 Another embodiment of the terminal for data retrieval provided by the present application, the terminal includes:
[0081] Processor 501, memory 502, input and output unit 503, bus 504;
[0082] The processor 501 is connected to the memory 502, the input and output unit 503 and the bus 504;
[0083] The memory 502 stores a program, and the processor 501 calls the program to execute any of the above data retrieval methods.
[0084] The present application also relates to a computer-readable storage medium on which a program is stored, wherein when the program is run on a computer, the computer is caused to execute any of the above data retrieval methods.
[0085] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0086] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0087] 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 distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0088] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0089] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk, etc. Various media that can store program codes.
Claims
1. A data retrieval method, applied to a terminal device, characterized in that: The method comprises: Get search keywords; Matching search objects from an index table according to the search keyword, the index table containing a mapping relationship between multiple search objects and index files of the search objects, the multiple search objects being part of all search objects in the historical search records of the backend server, and the index table being stored locally in the terminal; When the search keyword is successfully matched in the index table, the search result is fed back according to the index file of the successfully matched target search object.
2. The method according to claim 1, characterized in that When the index table contains basic information of the search object, the feedback of the search result based on the index file of the successfully matched target search object includes: The basic information of the target search object is obtained from the local terminal according to the index file of the successfully matched target search object, and the basic information is fed back.
3. The method according to claim 1, characterized in that: When the index table does not contain basic information of the search object, the search result feedback based on the index file of the successfully matched target search object includes: The basic information of the target search object is obtained from the background server according to the index file of the successfully matched target search object, and the basic information is fed back.
4. The method according to claim 3, characterized in that The index file is a query statement for the basic information of the target retrieval object.
5. The method according to claim 3, characterized in that: The index file is a pointer to the basic information of the target search object located on the backend server.
6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: When the search keyword fails to match in the index table, the search keyword is sent to the backend server for retrieval; Receive the search result fed back by the backend server.
7. The method according to claim 6, characterized in that The index table is generated by the backend server according to historical search records, and the method further includes: An updated index table sent by the backend server is received, wherein the updated index table is an index table adjusted by the backend server according to the updated historical search record, wherein the historical search record includes the number of times the search object is queried.
8. A data retrieval terminal, characterized in that: The terminal comprises: An acquisition unit, used for acquiring search keywords; A matching unit, used for matching a search object from an index table according to the search keyword, wherein the index table contains a mapping relationship between multiple search objects and index files of the search objects, wherein the multiple search objects are some search objects in all search objects in the historical search records of the backend server, and the index table is stored locally in the terminal; The feedback unit is used to feedback the search result according to the index file of the successfully matched target search object when the search keyword is successfully matched in the index table.
9. A data retrieval terminal, characterized in that: The terminal comprises: Processor, memory, input-output unit, and bus; The processor is connected to the memory, the input and output unit, and the bus; The memory stores a program, and the processor calls the program to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a program stored thereon, wherein the program, when executed on a computer, performs the method according to any one of claims 1 to 7.