Log retrieval method and device, electronic equipment, storage medium and program product

By performing text recognition and keyword extraction on screenshots of the front-end interface, and combining this with a scoring model to evaluate back-end logs, the problem of low log retrieval efficiency caused by the disconnect between front-end and back-end information was solved, achieving efficient and accurate log retrieval.

CN122489790APending Publication Date: 2026-07-31SHANGHAI SHIZHUANG INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANGHAI SHIZHUANG INFORMATION TECHNOLOGY CO LTD
Filing Date
2026-05-08
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

In existing technologies, when the front-end interface is abnormal, after the user reports the screenshot to the troubleshooting personnel, the information displayed on the front end is disconnected from the back-end logs, resulting in low log retrieval efficiency and requiring multiple guessing and trial-and-error cycles.

Method used

By recognizing and extracting text information from images, a keyword set is generated. A scoring model is then used to evaluate the backend log retrieval results from multiple dimensions, including keyword hit rate, ES relevance, dynamic product title matching, word frequency density, and timeliness decay, to filter out the target retrieval results.

Benefits of technology

It improves the efficiency and accuracy of retrieving structured logs from unstructured screenshots, realizes automated association mapping between images and background logs, and reduces the possibility of missed detections.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122489790A_ABST
    Figure CN122489790A_ABST
Patent Text Reader

Abstract

This application provides a log retrieval method, apparatus, electronic device, storage medium, and program product. The method includes: recognizing an image to obtain text information contained within it; wherein the image is obtained by taking a screenshot of a front-end page; extracting a set of keywords from the text information; retrieving multiple initial search results from background logs based on the keyword set; evaluating each initial search result using a scoring model to obtain a corresponding evaluation result; the scoring model comprehensively scores each search result from dimensions including keyword hit rate, ES relevance, dynamic product title matching, dynamic penalty for word frequency density, and dynamic timeliness decay; and determining the target search result corresponding to the image from the initial search results based on the evaluation result. This application improves the efficiency and accuracy of retrieval from unstructured screenshots to structured logs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of log retrieval technology, and more specifically, to a log retrieval method, apparatus, electronic device, storage medium, and program product. Background Technology

[0002] A business system typically consists of a front-end and a back-end. The front-end interface displays interactive information, operation results, or error messages to the user. The back-end is responsible for handling business logic, data storage and retrieval, API responses, and logging of critical nodes.

[0003] When a front-end interface malfunctions, users typically take screenshots and report them to investigators. However, the content displayed on the front-end is often disconnected from the logical logs recorded by candidate systems. Specifically, the front-end displays rendered or filtered information, lacking a unique identifier for the back-end request; even the same user action might be described differently on the front-end and back-end. Currently, investigators extract key information from screenshots and then try different keyword combinations to search the log platform. Due to the limited information in screenshots and the inability to automatically correlate them with back-end logs, the investigation process often requires multiple cycles of guessing, searching, and eliminating possibilities, resulting in low log retrieval efficiency. Summary of the Invention

[0004] The purpose of this application is to provide a log retrieval method, apparatus, electronic device, storage medium, and program product to improve the efficiency of log retrieval.

[0005] In a first aspect, embodiments of this application provide a log retrieval method, including: The image is identified to obtain the text information contained within it; the image is a screenshot or photo of the front-end page. Extract a set of keywords from text information; Based on the keyword set, multiple initial search results were obtained by searching the background logs. Each initial search result is evaluated using a scoring model to obtain the corresponding evaluation result. The scoring model comprehensively scores each search result from the dimensions of keyword hit rate, ES relevance, dynamic product title matching, dynamic penalty for word frequency density, and dynamic timeliness decay. Based on the evaluation results, the target retrieval result corresponding to the image is determined from the initial retrieval results.

[0006] In this embodiment, after retrieving multiple initial search results from the background log using keywords, a scoring model is used to evaluate each initial search result. Finally, the target search result is determined based on the evaluation results. Since the scoring model considers keyword hit rate range, ES relevance dimension, dynamic product title matching dimension, word frequency density dynamic penalty dimension, and dynamic timeliness decay dimension in the scoring process of the initial search results, it improves the efficiency and accuracy of unstructured screenshot to structured log retrieval.

[0007] In one possible implementation of the first aspect, the textual information includes a timestamp; a scoring model is used to evaluate each initial search result to obtain a corresponding evaluation result, including: For each initial search result, a keyword hit rate score is calculated based on the number of keywords hit in the log corresponding to the initial search result and the total number of keywords in the keyword set. The ES relevance score is calculated based on the original ES score corresponding to the initial search results, the maximum score and the minimum score among all initial search results; A dynamic product title matching score is calculated based on the keyword set and the product titles in the initial search results. The word frequency density score is calculated based on the total frequency of keyword occurrences. A timeliness score is calculated based on the timestamp and the timestamp generated from the log. The evaluation result is obtained by weighting and summing the keyword hit rate score, ES relevance score, dynamic product title matching score, word frequency density score, and timeliness score.

[0008] This application embodiment comprehensively evaluates the initial search results from multiple dimensions by calculating keyword hit rate score, ES relevance score, dynamic product title matching score, word frequency density score, and timeliness score, thereby obtaining more objective and accurate scores.

[0009] In one possible implementation of the first aspect, a dynamic product title matching score is calculated based on the keyword set and the product titles in the initial search results, including: Calculate the similarity between the keyword set and the logs corresponding to the initial search results for each product title, as well as the frequency of each product title appearing in the logs; A dynamic product title matching score is calculated based on similarity and frequency.

[0010] This application's embodiments introduce the concept of inverse document frequency to suppress high-frequency noise, improve long-tail accuracy, and enhance the accuracy of initial search results.

[0011] In one possible implementation of the first aspect, a timeliness score is calculated based on the timestamp and the log generation timestamp, including: The time stamp and log generation timestamp are input into a continuous decay model based on Gaussian radial basis functions to obtain a timeliness score.

[0012] The embodiments of this application use Gaussian radial basis functions to calculate the aging score, so that the aging score decreases smoothly as the time offset increases, eliminating edge abrupt changes.

[0013] In one possible implementation of the first aspect, a weighted sum is obtained by summing the keyword hit rate score, ES relevance score, dynamic product title matching score, word frequency density score, and timeliness score, including: The basic weight vector corresponding to the image is generated based on keyword quality; keyword quality is used to characterize the amount of information contained in the keywords extracted from the image. The weight coefficients for each scoring dimension are determined based on the pre-obtained dynamic adjustment matrix and basic weight vector. The scores are calculated based on keyword hit rate score, ES relevance score, dynamic product title matching score, word frequency density score, timeliness score, and corresponding weighting coefficients.

[0014] This application embodiment generates a basic weight vector by analyzing the quality of keywords in the image (such as quantity, scarcity, and time precision), and adaptively adjusts the weight of each dimension to ensure optimal accuracy in different investigation scenarios.

[0015] In one possible implementation of the first aspect, the underlying weight vector corresponding to the image is generated based on keyword quality, including: The basic weight vector is determined based on the timestamp, the number of keywords in the keyword set, and the number of long-tail products that the keywords in the keyword set hit.

[0016] In this application embodiment, the basic weight vector is determined by timestamp, number of keywords, and number of long-tail products hit by keywords, so as to achieve adaptive adjustment of the weight of each dimension and ensure optimal accuracy in different screening scenarios.

[0017] In one possible implementation of the first aspect, a search is performed on the background logs based on a set of keywords and a timestamp to obtain multiple search results, including: Full-text search is performed based on the background logs to obtain candidate original logs containing keywords from the keyword set; Based on keywords retrieved from the exposed product field in the backend logs, a specific product recommendation link can be obtained. Search based on timestamp to obtain log fragments within a preset range before and after the timestamp; Multiple initial search results are obtained based on candidate raw logs, specific product recommendation links, and log shards.

[0018] This application's embodiments integrate full-text search, product field search, and time search, resulting in a more comprehensive search and reducing the possibility of missed detections.

[0019] In one possible implementation of the first aspect, the set of keywords extracted from the text information includes: Extract initial keywords from text information; If the number of initial keywords is greater than the preset number, the initial keywords are sorted according to their part-of-speech weights, and a preset number of keywords are extracted from the keyword sequence to obtain a keyword set.

[0020] This application embodiment extracts initial keywords from text information and, when an image contains too many keywords, truncates them according to their parts of speech. This reduces the computational load of subsequent keyword matching and preserves valuable keywords as much as possible, thereby improving the accuracy of subsequent retrieval and analysis.

[0021] Secondly, embodiments of this application provide a log retrieval device, comprising: The image recognition module is used to recognize images and obtain the text information contained in the images; where the images are screenshots or photos of the front-end page; The keyword extraction module is used to extract a set of keywords from text information; The retrieval module is used to retrieve multiple initial search results from the background logs based on a set of keywords and timestamps. The scoring module is used to evaluate each initial search result using a scoring model to obtain the corresponding evaluation result. The scoring model comprehensively scores each search result from the dimensions of keyword hit rate, ES relevance, dynamic product title matching, dynamic penalty for word frequency density, and dynamic timeliness decay. The target retrieval result determination module is used to determine the target retrieval result corresponding to the image from the initial retrieval results based on the evaluation results.

[0022] Thirdly, embodiments of this application provide an electronic device, including: a processor, a memory, and a bus, wherein: The processor and memory communicate with each other via a bus; The memory stores program instructions that can be executed by the processor, and the processor can execute the method of the first aspect by calling the program instructions.

[0023] Fourthly, embodiments of this application provide a non-transitory computer-readable storage medium, comprising: A non-transitory computer-readable storage medium stores computer instructions that cause the computer to perform the methods in the various possible implementations of the first aspect.

[0024] Fifthly, embodiments of this application provide a computer program product, including computer program instructions, which, when read and executed by a processor, perform the methods in various possible implementations of the first aspect.

[0025] Other features and advantages of this application will be set forth in the following description and will be apparent in part from the description or may be learned by practicing embodiments of this application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the written description and the accompanying drawings. Attached Figure Description

[0026] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0027] Figure 1 This is a schematic flowchart of a log retrieval method provided in an embodiment of this application; Figure 2 A schematic diagram of a scoring process provided in an embodiment of this application; Figure 3 This is a schematic diagram of another log retrieval method provided in an embodiment of this application; Figure 4 This is a schematic diagram of a log retrieval device provided in an embodiment of this application; Figure 5 This is a schematic diagram of the physical structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0028] The embodiments of the technical solution of this application will now be described in detail with reference to the accompanying drawings. These embodiments are only used to more clearly illustrate the technical solution of this application and are therefore merely examples, and should not be used to limit the scope of protection of this application.

[0029] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms “comprising” and “having”, and any variations thereof, in the specification and the foregoing description of the drawings are intended to cover non-exclusive inclusion.

[0030] In the description of the embodiments of this application, technical terms such as "first" and "second" are used only to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly specifying the number, specific order, or primary and secondary relationship of the indicated technical features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly defined.

[0031] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0032] In the description of the embodiments in this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.

[0033] In the description of the embodiments of this application, the term "multiple" refers to two or more (including two), similarly, "multiple sets" refers to two or more (including two sets), and "multiple pieces" refers to two or more (including two pieces).

[0034] In the description of the embodiments of this application, unless otherwise expressly specified and limited, technical terms such as "installation," "connection," "joining," and "fixing" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. For those skilled in the art, the specific meaning of the above terms in the embodiments of this application can be understood according to the specific circumstances.

[0035] With the increasing complexity of internet businesses, modern recommender systems have evolved into highly complex distributed architectures. A typical recommendation request usually involves a recall layer, a coarse-ranking layer, a fine-ranking layer, and a re-ranking layer. The recall layer is used to coarsely select thousands of candidates from a database of tens of millions of items. The coarse-ranking layer uses a simple model to initially score the candidate set. The fine-ranking layer uses deep learning models (such as Wide&Deep, DeepFM) to accurately predict the products. The re-ranking layer combines business diversity, hashing strategies, and marketing rules to perform the final reordering.

[0036] During the above process, the system generates massive amounts of distributed logs every second. When users report inaccurate product information, expected products not appearing, or page errors, troubleshooters face a needle-in-a-haystack situation. Because recommendation results are highly time-sensitive (results differ at different times) and personalized (different user feature mappings), any logical deviation or feature anomaly in any microservice will lead to unexpected final results.

[0037] When faced with screenshots of the front-end interface provided by users, investigators need to manually extract the product title and timestamp from the screenshots, while simultaneously querying for the user's unique identifier (User ID), and then repeatedly try to combine queries in massive amounts of logs. Because there is a lack of automated correlation between screenshots (unstructured data) and logs (structured / semi-structured data), the process of locating the specific log path from the observed phenomenon consumes a significant amount of time.

[0038] To address the aforementioned technical issues, this application provides a log retrieval method. In this method, after receiving an image obtained by taking a screenshot of a front-end page, a set of keywords is extracted from the image. Based on this keyword set, the method retrieves multiple initial search results from the background logs. Then, a scoring model is used to comprehensively evaluate each initial search result based on keyword hit rate, ES relevance, dynamic product title matching, dynamic penalty for keyword frequency density, and dynamic timeliness decay. Finally, the target search result is selected from the multiple initial search results. This method achieves a mapping between unstructured images and structured logs, improving the efficiency of background log retrieval.

[0039] It should be noted that the log retrieval method provided in this application is applicable to various business systems, such as: product recommendation systems, product search systems, advertising systems, product transaction team guide systems, marketing systems, etc. For ease of understanding, this application uses a product recommendation system as an example for description.

[0040] Figure 1 A schematic flowchart of a log retrieval method provided in this application embodiment includes: Step 101: Recognize the image to obtain the text information contained in the image; The image is obtained by taking a screenshot or photograph of the front-end page. In some embodiments, this could be done by a user browsing the front-end page through a mobile app, taking a screenshot, and then sending it to the system; or by a user browsing the front-end page through a webpage, taking a screenshot, and then sending it to the system. In practical applications, a user might input the product they want to search for on the front-end page, but the product recommendation system returns product information that doesn't match the user's request. In this case, the user can send a screenshot of the front-end page to the product recommendation system, allowing the system to query the corresponding logs based on the screenshot and optimize the system accordingly. After receiving the image, the system recognizes the image to obtain the text information and timestamp contained within it. The text information in the image reflects the key content of the image. Optical Character Recognition (OCR) technology can be used to detect the text region from the image containing text and recognize the image shape as editable computer characters.

[0041] Step 102: Extract the set of keywords from the text information.

[0042] After obtaining the text information contained in the image, keywords can be extracted from the text information, and the extracted keywords can be used to form a keyword set. When extracting keywords, a combination of NLP techniques and rule / dictionary methods can be used. For example, part-of-speech filtering, stop word removal, TF-IDF extraction, regular expressions, and dictionary-based matching can be performed on the text information. Therefore, the keyword set must contain at least one keyword.

[0043] Step 103: Search the background logs based on the keyword set to obtain multiple initial search results.

[0044] The backend logs can be from an Elasticsearch (ES) log cluster. After obtaining the keyword set, the backend logs are searched using these keywords. The extracted keywords are combined by field, with the message field in the backend logs being the primary search target. During the search process, different query methods can be used for different types of keywords. For example, if the keyword is a Uid, an exact match can be used; if the keyword is a timestamp, a time range query can be used; if the keyword is a product title, a similarity threshold query can be used, etc. Therefore, multiple initial search results can be obtained from the ES log cluster. Each initial search result includes one candidate log entry.

[0045] Step 104: Use the scoring model to evaluate each initial search result and obtain the corresponding evaluation result; the scoring model comprehensively scores each search result from the dimensions of keyword hit rate, ES relevance, dynamic product title matching, dynamic penalty for word frequency density, and dynamic timeliness decay.

[0046] Since not all initial search results are logs related to the image, a multi-dimensional evaluation can be performed on each initial search result to select those that are associated with the image. The scoring model provided in this application's embodiments can evaluate each initial search result from dimensions such as keyword hit rate, ES relevance, dynamic product title matching, dynamic penalty for word frequency density, and dynamic timeliness decay. Specifically: Keyword hit dimension is used to characterize the number of keywords hit in the initial search results. Generally speaking, the more keywords hit, the more likely the initial search results are to be associated with the image.

[0047] The ES relevance dimension is used to characterize the relevance between the keyword set and the initial search results.

[0048] The dynamic product title matching dimension represents the degree of matching between keywords and product titles.

[0049] The word frequency density dynamic penalty dimension is used to characterize whether the frequency of keywords appearing in the candidate log is within a reasonable range, thereby distinguishing between normal and valid matches and abnormally repeated noise.

[0050] The dynamic time decay dimension is used to characterize the time difference between the time corresponding to the image and the candidate log. The larger the time difference, the lower the correlation between the candidate log and the image.

[0051] Step 105: Determine the target retrieval result corresponding to the image from the initial retrieval results based on the evaluation results.

[0052] After obtaining the evaluation result corresponding to each initial search result, this evaluation result can be the score corresponding to each initial search result. The higher the score, the higher the relevance to the image. Therefore, starting from the highest score, a preset number of initial search results can be selected as target search results. For example, only the initial search result with the highest score can be selected as the target search result, or three initial search results with the highest scores can be selected. Investigators can further filter the final search results from the three initial search results.

[0053] In this embodiment, after retrieving multiple initial search results from the background log using keywords, a scoring model is used to evaluate each initial search result. Finally, the target search result is determined based on the evaluation results. Since the scoring model considers keyword hit rate range, ES relevance dimension, dynamic product title matching dimension, word frequency density dynamic penalty dimension, and dynamic timeliness decay dimension in the scoring process of the initial search results, it improves the efficiency and accuracy of unstructured screenshot to structured log retrieval.

[0054] Before step 101, after the system receives the image of the front-end interface uploaded by the user, in order to improve the recognition rate of the text in the image, the image can be preprocessed, for example, the image can be grayscaled, denoised and contrast enhanced.

[0055] Regarding grayscale conversion: User-uploaded screenshots are often color images, using RGB three-channel identification. Each pixel stores three components: red, green, and blue. Grayscale conversion is the process of converting an RGB image into a single-channel grayscale image, where each pixel value typically ranges from 0 to 255. Conversion methods include the average method, the weighted method, and the maximum value method.

[0056] For noise reduction: Noise, such as Gaussian noise and salt-and-pepper noise, is introduced into images during acquisition or transmission. The goal of noise reduction is to smooth out the noise while preserving edges and details as much as possible. Noise reduction methods can include mean filtering, Gaussian filtering, median filtering, and bilateral filtering.

[0057] For contrast enhancement: Due to insufficient lighting, limited camera dynamic range, etc., the gray levels of an image may be concentrated in a narrow range (overall too dark or too bright), resulting in unclear details. Contrast enhancement expands the distribution range of gray levels, making dark areas darker and bright areas brighter, thereby highlighting details. Contrast enhancement can employ methods such as histogram equalization and adaptive histogram equalization.

[0058] In image preprocessing, since denoising and enhancement require less computation on a single channel and avoid artifacts caused by inconsistencies between color channels, the image can be converted to grayscale first, followed by denoising, and finally contrast enhancement. If contrast enhancement is performed first and then denoising, noise will be amplified during contrast enhancement, making denoising more difficult and prone to losing true edges.

[0059] It should be noted that image preprocessing operations may also include binarization, tilt correction, scaling, etc.

[0060] In step 101, an OCR engine can be used to perform full-text scanning on the image (or the pre-processed image). Full-text scanning refers to the OCR engine automatically detecting all regions in the image that may contain text, recognizing characters region by region, and finally outputting the complete text content. The recognition process includes: reading the image; locating the position of all text instances in the image and outputting the bounding box of each text region; converting the image block within each detected text box into a string; and outputting the recognition result for each text box.

[0061] In step 102, the set of keywords in the text information is extracted, including: Extract initial keywords from text information; If the number of initial keywords is greater than the preset number, then sort the initial keywords according to the词性 weight, and intercept the preset number of keywords from the keyword sequence to obtain a keyword set.

[0062] In specific implementation processes, in order to obtain a keyword set, the embodiments of this application introduce a set of multi-level cleaning operators for the recommendation scenario to eliminate the interference of marketing noises in the interface on log retrieval. Specifically as follows: (1)Promotion / marketing atmosphere word filtering: Establish a marketing word library exclusive to the recommendation system, and use the word library matching mechanism to automatically剔除 non-core business words in the screenshot. Examples: "blockbuster", "hot sale", "free shipping", "get coupon", "满减", "place order immediately".

[0063] (2)E-commerce stop word elimination: Introduce a general stop word list in the e-commerce industry to remove function words and conjunctions lacking retrieval value. Examples: "的", "了", "在", "和", "个", "件".

[0064] (3)Regularization and structured cleaning:剔除 special symbols (such as: ¥, &, #, ★), and normalize numbers and units.

[0065] After completing (1), (2), and (3), the initial keywords can be obtained.

[0066] (4)Dynamic cardinality control (Cardinality Control): If the number of keywords in the identified initial keywords exceeds the preset number, then sort the initial keywords according to the词性 weight (for example: noun > verb > adjective), and intercept the preset number of keywords from the keyword sequence obtained after sorting to obtain a keyword set. If the identified number is too small, then start adjacent area association enhancement. Adjacent area association enhancement can adopt the semantic association diffusion method, take out the currently only small number of words, and search for their nearest neighbor feature words in the word vector database. For example: If the initial keywords include "Moutai", the system will automatically associate and enhance features such as "sauce fragrance", "white wine", "53 degrees", etc. Although these words are not in the screenshot, they will probably appear in pairs in the metadata of the log, thereby improving the recall rate.

[0067] The embodiments of this application extract initial keywords from text information, and in the case of too many keywords in the image, intercept them according to the词性, on the one hand, reducing the subsequent keyword matching calculation amount, and on the other hand,尽可能 retaining valuable keywords and improving the accuracy of subsequent retrieval analysis.

[0068] It should be noted that there are some Chinese words in the original text that may not be accurately translated without more context. For example, "满减" is a specific e-commerce term that may not have a very accurate equivalent in English. Here, a literal translation is provided as a reference. You may need to adjust it according to the actual situation. Also, "词性" should be translated as "lexical category" or "word class" more precisely, but in this context, the original Chinese term is used for simplicity in the translation.In step 103, during the retrieval process from the background logs based on the keyword set, the extracted keyword set and timestamp can be used as query input to initiate a multi-path retrieval to the Elasticsearch (ES) log cluster. The screenshot timestamp is obtained from image text recognition; most user-submitted images contain time information, which can be extracted using OCR technology and used as the timestamp. The multi-path retrieval includes: Full-text search approach: A full-text search engine (e.g., Elasticsearch, Lucene) is used to build an inverted index on the message field of the backend logs. Then, keyword-based Boolean queries are executed to quickly filter out candidate original logs containing the keywords. During index building, the message field of the logs is tokenized (e.g., by spaces, punctuation, or a custom tokenizer), generating a mapping table from terms to document IDs. Simultaneously, term frequency and position information are recorded to support phrase queries. For keywords in the keyword set, the system translates them into Boolean expressions. The search engine first obtains the inverted list of each term, and then uses intersection, union, and difference operations to obtain the final original log.

[0069] Business Feature Path: Structured field matching is performed on the predefined business field "exposure" (exposed products) in the backend logs. Each log contains a trace_id, which is the system's weighted link flow ID. After obtaining the keyword set, each keyword is used to search in the backend logs. Each keyword will hit a batch of logs. These logs are scattered in different product recommendation link traces. By collecting the trace_ids corresponding to the hit logs, the complete recommendation link of a specific product can be obtained.

[0070] Time window approach: Before retrieval, a narrow time interval (e.g., 10 minutes before and after a specified timestamp) is defined based on the expected time of the event. Then, data scanning is performed only within this time slice to obtain log slices, thereby significantly reducing the amount of data that needs to be processed. Limiting the retrieval scope to a preset time period centered on the timestamp reduces the computational load of retrieval through time slicing.

[0071] Based on the three retrieval paths mentioned above, the retrieved candidate original logs, the recommendation links for specific products, and the log fragments are combined to obtain multiple initial retrieval results.

[0072] This application's embodiments integrate full-text search, product field search, and time search, resulting in a more comprehensive search and reducing the possibility of missed detections.

[0073] In step 104, when evaluating each initial search result using a scoring model, the following method can be used, see [link to relevant documentation]. Figure 2 : Step 201: For each initial search result, calculate the keyword hit rate score based on the number of keywords matched in the log corresponding to the initial search result and the total number of keywords in the keyword set. The calculation formula is as follows: ,in, This is the number of times a log contains a keyword. A keyword hit means that the log contains the keyword, or that the similarity between a word in the log and the keyword is greater than a preset similarity threshold. This represents the total number of keywords.

[0074] Step 202: Calculate the ES relevance score based on the original ES score corresponding to the initial search results, the maximum score among all initial search results, and the minimum score; where the original ES score is a score automatically generated by the ES engine after retrieving the initial search results. The formula for calculating the ES relevance score is: ,in, This is the original score for ES. The maximum score among the initial search results is selected, meaning the maximum original ES score is chosen from all initial search results. The minimum score among the initial search results, i.e., the minimum original ES score is selected from all initial search results. As a smoothing factor to prevent the denominator from being 0, its value can be... Or other values.

[0075] Step 203: Calculate the dynamic product title matching score based on the keyword set and product titles in the initial search results. The core purpose of this step is to improve the accuracy and discriminative power of the recommendation link verification. It introduces the inverse document frequency (IF) concept of TF-IDF, dynamically adjusting the sharing of product titles based on their frequency of appearance in the logs of the initial search results, making the matching score more accurately reflect the uniqueness and credibility of the link. The calculation formula is as follows: ,in, This refers to the total number of products that were requested to be exposed in this log. To represent keywords in user queries With the The title of the exposed product Whether it matches or not can be a value of 0 (no match) or 1 (match), or it can be a continuous value (such as similarity score). This represents the total number of times all products appear (or the total number of exposures) in the global log. This refers to the frequency of the product's appearance in the global log (using the inverse document frequency concept). As the normalization factor, it makes The score is between [0,1]. The overall logic is to iterate through all products exposed in this request, and for each product matching the keyword, accumulate the product's uniqueness index (IDF). The larger the accumulated result, the more rare products matching the user's keywords are included in the exposed list, thus proving that the initial search result is more relevant to the user's intent and has higher uniqueness. Finally, divide by Z to normalize the score for easier interpretation and use.

[0076] Step 204: Calculate the word frequency density score based on the total frequency of keyword occurrences. If the number of keyword occurrences is within a certain range, it indicates a normal situation, and the score should be increased. However, if it exceeds the threshold, it may indicate an infinite loop in the system log, which is an abnormal situation, triggering a negative penalty. The calculation formula is as follows: ,in, Total keyword frequency. and The coefficient is dynamically adjusted to ensure that the score increases positively within the normal range, and to apply dynamic penalties within the abnormally redundant range. This is the threshold for abnormal frequency.

[0077] Step 205: Calculate the timeliness score based on the timestamp and the log generation timestamp. It should be understood that the larger the difference between the timestamp corresponding to the log and the timestamp corresponding to the image in the initial search results, the lower the probability that the log and image are related. Conversely, the closer the timestamps of the log and the images in the initial search results, the higher the probability that the log and image are related. Therefore, this embodiment introduces a continuous decay model based on the Gaussian radial basis function. The timestamp corresponding to the image and the log generation timestamp are input into the continuous decay model, and the corresponding timeliness score is output. The internal calculation formula of this model is: ,in, Generate timestamps for the logs. The timestamp corresponding to the image. The dynamic bandwidth factor determines the tolerance of the score to time errors.

[0078] Step 206: Weight the keyword hit rate score, ES relevance score, dynamic product title matching score, word frequency density score, and timeliness score to obtain the evaluation result.

[0079] The keyword hit rate score, ES relevance score, dynamic product title matching score, word frequency density score, and timeliness score each have corresponding weights. These weights are not static but dynamically adjusted based on the keyword quality in the image to achieve optimal accuracy in different screening scenarios. Keyword quality characterizes the amount of information contained in the keywords extracted from the image and can be evaluated from dimensions such as keyword quantity, scarcity, and time precision. Based on the keyword quality, a basic weight vector corresponding to the image can be generated, which can be represented as: ,in, This is the timestamp indicating whether an image was detected. If detected, its value is 1; otherwise, it is 0. This represents the number of keywords contained in the keyword set. If the number of keywords is greater than the preset number, the value is 1; otherwise, the value is 0. This indicates whether a long-tail / rare keyword was hit. If it was hit, the value is 1; otherwise, the value is 0.

[0080] Based on the weight vector and a pre-generated dynamic adjustment matrix, the weights for each rating dimension are determined, where the dynamic adjustment matrix is: It should be noted that the dynamic adjustment matrix consists of relatively suitable parameter values ​​obtained through extensive testing.

[0081] The weighting formulas for each rating dimension are as follows: .

[0082] The weighting calculation logic is as follows: if the status bar time is detected, i.e., a timestamp is extracted from the image, the weight of the timeliness score is automatically increased. If the number of hit keywords is small, the weight of the ES relevance score is increased.

[0083] The weight corresponding to the keyword hit rate score is affected by... The negative impact is the greatest. When there are very few keywords, the literal hit is unreliable, and the weight is greatly reduced. The weights corresponding to the ES relevance scores are influenced by... Positive compensation is the system's safety net logic; when there are few words, it automatically switches to vector space semantic matching. The weight corresponding to the dynamic product title matching score is affected by... A strong positive drive is employed, with a higher weight applied to long-tail products. Specifically, a real-time product list is dynamically extracted from the `exposure` field of the logs. If the image contains keywords of product names from the list, the credibility of this dimension increases. Simultaneously, information entropy-weighted matching can be introduced, no longer assuming equal matching value for all product titles. If the image contains a product name from the list that is a popular product, its matching score weight should decrease. If a long-tail product is matched, the value of proving the uniqueness of the link is higher, and the weight of this scoring dimension should increase. Long-tail products refer to products with low sales volume, dispersed demand, low exposure frequency, but numerous categories. For example, "retro mechanical keyboard keycaps," "pet lizard heating pads," and "left-handed scissors" on an e-commerce platform. Because long-tail products appear infrequently in the global logs, if a user matches such products in a screenshot or query, it strongly proves the relevance of the initial search result to the image. Additionally, a list of popular products can be pre-built to determine if popular products are matched. The weights corresponding to the word frequency density scores are used as an auxiliary dimension and are slightly suppressed by time features to ensure that the focus of the investigation is not disturbed by abnormal and redundant logs. The weight corresponding to the timeliness score is affected by... With strong positive drive, when a timestamp is detected, the system tends to trust the time window.

[0084] After determining the weights of each scoring dimension, the scores corresponding to the initial search results can be calculated using the following formula: ,in, The score corresponding to the initial search results. Let be the normalized score for the i-th rating dimension. Let be the weight of the i-th rating dimension.

[0085] It should be noted that steps 201-205 can be executed in parallel or sequentially. In sequential execution, the execution order can be adjusted as needed. The above-mentioned scoring dimensions are for a product recommendation system scenario; in different scenarios, the scoring dimensions can be adaptively adjusted.

[0086] This application embodiment comprehensively evaluates the initial search results from multiple dimensions by calculating keyword hit rate score, ES relevance score, dynamic product title matching score, word frequency density score, and timeliness score, thereby obtaining more objective and accurate scores.

[0087] Figure 3 A schematic flowchart of another log retrieval method provided in this application embodiment includes: Step 301: Image preprocessing; perform grayscale conversion, noise reduction, contrast enhancement, etc. on the image.

[0088] Step 302: OCR character recognition; use OCR technology to perform text recognition on the preprocessed image to obtain text information and UI interface layout. Among them, some interference information can be removed by using the obtained UI interface layout, such as: the shading words in the search box, etc.

[0089] Step 303: Multi-symbol splitting; split the text information based on methods such as regular expressions to obtain a preliminary Token set.

[0090] Step 304: Regularization cleaning; remove leading and trailing spaces and special symbols.

[0091] Step 305: Whether there are e-commerce stop words; if yes, execute Step 306, otherwise execute Step 307.

[0092] Step 306: Discard common words; such as: "of", "already", "in", "a", etc.

[0093] Step 307: Whether there are marketing atmosphere words; if yes, execute Step 308, otherwise execute Step 309.

[0094] Step 308: Discard marketing words; such as: "free shipping", "seckill", "get coupon", "immediate discount", etc.

[0095] Step 309: Length verification; whether the word length exceeds the preset length. If it exceeds, execute Step 311, otherwise execute Step 310.

[0096] Step 310: Discard single characters and invalid characters.

[0097] Step 311: Generate a noise-reduced candidate keyword set.

[0098] Step 312: Whether the number of candidate keywords exceeds the threshold; if it exceeds, execute Step 313, otherwise execute Step 315.

[0099] Step 313: Sort in descending order according to the keyword length. It can be understood that it can also be sorted according to the word nature, or the two can be combined. For example: first sort according to the keyword length, if there are keywords of the same length, then sort the keywords of the same length according to the word nature. It can also be sorted according to the word nature first, and then the keywords of the same nature are sorted according to the length.

[0100] Step 314: Truncate the TOP-N core keywords.

[0101] Step 315: Generate the final keyword set.

[0102] Step 316: Perform a search based on the keyword set to obtain multiple initial search results.

[0103] Step 317: Input the comprehensive scoring model; the scoring method is the same as described in the above embodiment, and will not be repeated here.

[0104] Step 318: Output the top 10 scores as the initial search results and use them as the target search results.

[0105] Figure 4 This is a schematic diagram of a log retrieval device provided in an embodiment of this application. The device can be a module, program segment, or code on an electronic device. It should be understood that this device is similar to the one described above. Figure 1 The method implementation corresponds to this and can be executed. Figure 1 The specific functions of the device involved in each step of the method embodiment can be found in the description above; to avoid repetition, detailed descriptions are omitted here. The device includes: an image recognition module 401, a keyword extraction module 402, a retrieval module 403, a scoring module 404, and a target retrieval result determination module 405, wherein: The image recognition module 401 is used to recognize images and obtain the text information contained in the images; wherein, the image is a screenshot or photo of the front-end page; Keyword extraction module 402 is used to extract a set of keywords from text information; The retrieval module 403 is used to perform retrieval from the background logs based on the keyword set and timestamp to obtain multiple initial retrieval results; The scoring module 404 is used to evaluate each initial search result using a scoring model to obtain the corresponding evaluation result. The scoring model comprehensively scores each search result from the dimensions of keyword hit rate, ES relevance, dynamic product title matching, dynamic penalty for word frequency density, and dynamic timeliness decay. The target retrieval result determination module 405 is used to determine the target retrieval result corresponding to the image from the initial retrieval results based on the evaluation results.

[0106] Based on the above embodiments, the text information includes a timestamp; the scoring module 404 is specifically used for: For each initial search result, a keyword hit rate score is calculated based on the number of keywords hit in the log corresponding to the initial search result and the total number of keywords in the keyword set. The ES relevance score is calculated based on the original ES score corresponding to the initial search result, the maximum score and the minimum score among all initial search results; A dynamic product title matching score is calculated based on the keyword set and the product titles in the initial search results. The word frequency density score is calculated based on the total frequency of keyword occurrences. A timeliness score is calculated based on the timestamp and the log generation timestamp. The evaluation result is obtained by weighting and summing the keyword hit rate score, ES relevance score, dynamic product title matching score, word frequency density score, and timeliness score.

[0107] Based on the above embodiments, the scoring module 404 is specifically used for: Calculate the similarity between the keyword set and the logs corresponding to the initial search results, as well as the frequency of each product title appearing in the logs; The dynamic product title matching score is calculated based on the similarity and the frequency.

[0108] Based on the above embodiments, the scoring module 404 is specifically used for: The time stamp and the log generation time stamp are input into a continuous decay model based on Gaussian radial basis functions to obtain the timeliness score.

[0109] Based on the above embodiments, the scoring module 404 is specifically used for: The image is generated based on keyword quality; the keyword quality is used to characterize the amount of information contained in the keywords extracted from the image. The weight coefficients for each scoring dimension are determined based on the pre-acquired dynamic adjustment matrix and the basic weight vector. The evaluation results are obtained by calculating the keyword hit rate score, ES relevance score, dynamic product title matching score, word frequency density score, timeliness score, and corresponding weight coefficients.

[0110] Based on the above embodiments, the scoring module 404 is specifically used for: The basic weight vector is determined based on the timestamp, the number of keywords in the keyword set, and the number of long-tail products that the keywords in the keyword set hit.

[0111] Based on the above embodiments, the text information includes a timestamp; the retrieval module 403 is specifically used for: Full-text search is performed based on the background logs to obtain candidate original logs containing keywords from the keyword set; Based on the exposed product field in the background log, the keyword is retrieved to obtain a specific product recommendation link; Based on the timestamp, a retrieval is performed to obtain log fragments within a preset range before and after the timestamp; The multiple initial search results are obtained based on the candidate raw logs, the specific product recommendation links, and the log shards.

[0112] Based on the above embodiments, the keyword extraction module 402 is specifically used for: Extract initial keywords from the text information; If the number of initial keywords is greater than the preset number, the initial keywords are sorted according to their part-of-speech weights, and the preset number of keywords are extracted from the keyword sequence to obtain the keyword set.

[0113] Figure 5 This is a schematic diagram of the physical structure of the electronic device provided in the embodiments of this application, such as... Figure 5 As shown, the electronic device includes: a processor 501, a memory 502, and a bus 503; wherein: The processor 501 and the memory 502 communicate with each other through the bus 503; The processor 501 is used to call program instructions in the memory 502 to execute the methods provided in the above-described method embodiments, including, for example,: recognizing an image to obtain text information contained in the image; wherein the image is a screenshot or photo of a front-end page; extracting a set of keywords from the text information; retrieving multiple initial search results from background logs based on the set of keywords and the timestamp; evaluating each initial search result using a scoring model to obtain a corresponding evaluation result; the scoring model comprehensively scoring each search result from the dimensions of keyword hit rate, ES relevance, dynamic product title matching, dynamic penalty for word frequency density, and dynamic timeliness decay; and determining the target search result corresponding to the image from the initial search results based on the evaluation result.

[0114] Processor 501 can be an integrated circuit chip with signal processing capabilities. The processor 501 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor.

[0115] The memory 502 may include, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc.

[0116] This embodiment discloses a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions, and when the program instructions are executed by a computer, the computer can perform the methods provided in the above-described method embodiments, such as: recognizing an image to obtain text information contained in the image; wherein the image is a screenshot or photo of a front-end page; extracting a set of keywords from the text information; retrieving multiple initial search results from background logs based on the set of keywords and the timestamp; evaluating each initial search result using a scoring model to obtain a corresponding evaluation result; the scoring model comprehensively scores each search result from the dimensions of keyword hit rate, ES relevance, dynamic product title matching, dynamic penalty for word frequency density, and dynamic timeliness decay; and determining the target search result corresponding to the image from the initial search results based on the evaluation result.

[0117] This embodiment provides a non-transitory computer-readable storage medium storing computer instructions that cause the computer to execute the methods provided in the above-described method embodiments. These instructions include, for example: recognizing an image to obtain text information contained in the image; wherein the image is a screenshot or photograph of a front-end page; extracting a set of keywords from the text information; retrieving multiple initial search results from background logs based on the keyword set and the timestamp; evaluating each initial search result using a scoring model to obtain a corresponding evaluation result; the scoring model comprehensively scoring each search result from dimensions of keyword hit rate, ES relevance, dynamic product title matching, dynamic penalty for word frequency density, and dynamic timeliness decay; and determining the target search result corresponding to the image from the initial search results based on the evaluation result.

[0118] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0119] Furthermore, the units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0120] Furthermore, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0121] In this document, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, without necessarily requiring or implying any such actual relationship or order between these entities or operations.

[0122] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A log retrieval method, characterized in that, include: The image is identified to obtain the text information contained in the image; wherein the image is a screenshot or photo of a front-end page; Extract the set of keywords from the text information; Based on the keyword set, a search is performed on the background logs to obtain multiple initial search results; Each initial search result is evaluated using a scoring model to obtain a corresponding evaluation result; the scoring model comprehensively scores each search result from the dimensions of keyword hit rate, ES relevance, dynamic product title matching, dynamic penalty for word frequency density, and dynamic timeliness decay. Based on the evaluation results, the target retrieval result corresponding to the image is determined from the initial retrieval results.

2. The method according to claim 1, characterized in that, The text information includes a timestamp; the evaluation of each initial search result using a scoring model to obtain a corresponding evaluation result includes: For each initial search result, a keyword hit rate score is calculated based on the number of keywords hit in the log corresponding to the initial search result and the total number of keywords in the keyword set. The ES relevance score is calculated based on the original ES score corresponding to the initial search result, the maximum score and the minimum score among all initial search results; A dynamic product title matching score is calculated based on the keyword set and the product titles in the initial search results. The word frequency density score is calculated based on the total frequency of keyword occurrences. A timeliness score is calculated based on the timestamp and the log generation timestamp. The evaluation result is obtained by weighting and summing the keyword hit rate score, ES relevance score, dynamic product title matching score, word frequency density score, and timeliness score.

3. The method according to claim 2, characterized in that, The step of calculating the dynamic product title matching score based on the keyword set and the product titles in the initial search results includes: Calculate the similarity between the keyword set and the logs corresponding to the initial search results, as well as the frequency of each product title appearing in the logs; The dynamic product title matching score is calculated based on the similarity and the frequency.

4. The method according to claim 2, characterized in that, The calculation of the timeliness score based on the timestamp and the log generation timestamp includes: The time stamp and the log generation time stamp are input into a continuous decay model based on Gaussian radial basis functions to obtain the timeliness score.

5. The method according to claim 2, characterized in that, The evaluation result is obtained by weighted summation of keyword hit rate score, ES relevance score, dynamic product title matching score, word frequency density score, and timeliness score, including: The image is generated based on keyword quality; the keyword quality is used to characterize the amount of information contained in the keywords extracted from the image. The weight coefficients for each scoring dimension are determined based on the pre-acquired dynamic adjustment matrix and the basic weight vector. The evaluation results are obtained by calculating the keyword hit rate score, ES relevance score, dynamic product title matching score, word frequency density score, timeliness score, and corresponding weight coefficients.

6. The method according to claim 5, characterized in that, The process of generating the basic weight vector corresponding to the image based on keyword quality includes: The basic weight vector is determined based on the timestamp, the number of keywords in the keyword set, and the number of long-tail products that the keywords in the keyword set hit.

7. The method according to claim 1, characterized in that, The text information includes a timestamp; the search is performed based on the keyword set and the timestamp from the background log to obtain multiple search results, including: Full-text search is performed based on the background logs to obtain candidate original logs containing keywords from the keyword set; Based on the exposed product field in the background log, the keyword is retrieved to obtain a specific product recommendation link; Based on the timestamp, a retrieval is performed to obtain log fragments within a preset range before and after the timestamp; The multiple initial search results are obtained based on the candidate raw logs, the specific product recommendation links, and the log shards.

8. The method according to any one of claims 1-7, characterized in that, The extraction of the keyword set from the text information includes: Extract initial keywords from the text information; If the number of initial keywords is greater than the preset number, the initial keywords are sorted according to their part-of-speech weights, and the preset number of keywords are extracted from the keyword sequence to obtain the keyword set.

9. A log retrieval device, characterized in that, include: An image recognition module is used to recognize an image and obtain the text information contained in the image; wherein the image is a screenshot or photo of a front-end page; The keyword extraction module is used to extract a set of keywords from the text information; The retrieval module is used to retrieve multiple initial retrieval results from the background logs based on the keyword set. The scoring module is used to evaluate each of the initial search results using a scoring model to obtain the corresponding evaluation results. The scoring model comprehensively scores each of the search results from the dimensions of keyword hit rate, ES relevance, dynamic product title matching, dynamic penalty for word frequency density, and dynamic timeliness decay. The target retrieval result determination module is used to determine the target retrieval result corresponding to the image from the initial retrieval results based on the evaluation result.

10. An electronic device, characterized in that, include: Processor, memory, and bus, among which: The processor and the memory communicate with each other via the bus; The memory stores program instructions that can be executed by the processor, and the processor can execute the method as described in any one of claims 1-8 by calling the program instructions.

11. A non-transitory computer-readable storage medium, characterized in that, The non-transitory computer-readable storage medium stores computer instructions that, when executed by a computer, cause the computer to perform the method as described in any one of claims 1-8.

12. A computer program product, characterized in that, It includes computer program instructions, which, when read and executed by a processor, perform the method as described in any one of claims 1-8.