Material query method and device and related equipment

By generating the first identifier of the material query request in the advertising delivery system, quickly matching and inserting the target page in the cache, the problem of low material query efficiency is solved, and efficient material query and filtering is achieved.

CN120407867APending Publication Date: 2025-08-01BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510474342.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-16
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

In the prior art, material query efficiency is low, especially in advertising delivery systems, the material content uploaded at adjacent times is duplicated or similar, resulting in staff turning a large number of pages to find non-repetitive material content.

Method used

By receiving the material query request from the user side, a first identifier corresponding to the material information of the preset dimension is generated, and the material matching the identifier is queried in the cache, and the cache is used to quickly match and insert the target page to avoid repeated acquisition of materials.

Benefits of technology

It improves the efficiency of material query, reduces the possibility of obtaining duplicate materials, simplifies the screening process of staff, and improves the accuracy and efficiency of material query.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120407867A_ABST
    Figure CN120407867A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a material query method and device and related equipment. The method comprises the steps that a material query request sent by a user side is received; generating a first identifier corresponding to the material information of at least one dimension according to a preset mapping relationship between the material information of each dimension and the identifier; querying a plurality of first materials matched with the first identifier in a plurality of materials corresponding to the query range in a cache; sequentially inserting the plurality of first materials into a plurality of target pages; and sending the plurality of target pages to the user side. According to the method, after the material query request sent by the user side is received, the first identifier is generated according to the target material information and the paging parameter included in the material query request, and the multiple first materials matched with the first identifier are queried in the query range in the cache, so that the first materials are quickly matched in the cache through the first identifier; through matching of the first identifier and the first material, obtaining of repeated materials is avoided, and the material query efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Internet technologies, and particularly to a method and apparatus for querying materials and related devices. Background Art

[0002] Currently, in the business of building advertisements in an advertising placement system, it is necessary to screen materials for generating advertisements for related material building work. In the prior art, materials are usually sorted by time, name, content of a film list, etc. of the materials. However, in this sorting method, materials are usually uploaded in batches, which may lead to the situation that the content of materials uploaded at adjacent times is repeated or similar. In this case, when staff screen these materials for material building work, they need to flip through a large number of pages to find non-repeated material content, resulting in a low efficiency of material query in the prior art. Summary of the Invention

[0003] The purpose of the embodiments of the present invention is to provide a method and apparatus for querying materials and related devices to solve the problem of low efficiency of material query in the prior art. The specific technical solutions are as follows:

[0004] In the first aspect of the present invention, first, a method for querying materials is provided, and the method includes:

[0005] Receiving a material query request sent by a user terminal, where the material query request includes target material information and a paging parameter, the target material information includes material information of at least one dimension requested by the user terminal to query, and the paging parameter is used to represent the query range of materials;

[0006] Generating a first identifier corresponding to the material information of the at least one dimension according to a preset mapping relationship between the material information of each dimension and an identifier, where the first identifier is an identifier obtained by converting the material information of each dimension into a string according to the mapping relationship;

[0007] Querying a plurality of first materials matching the first identifier from a plurality of materials corresponding to the query range in a cache;

[0008] Inserting the plurality of first materials into a plurality of target pages in sequence;

[0009] Sending the plurality of target pages to the user terminal.

[0010] In the second aspect of the present invention, a device for querying materials is further provided, and the device includes:

[0011] A receiving module, configured to receive a material query request sent by a user terminal, where the material query request includes target material information and paging parameters, the target material information includes material information of at least one dimension requested by the user terminal to query, and the paging parameters are used to characterize the query range of the materials;

[0012] A generating module, configured to generate a first identifier corresponding to the material information of the at least one dimension according to a preset mapping relationship between the material information of each dimension and the identifier, where the first identifier is an identifier obtained by converting the material information of each dimension into a string according to the mapping relationship;

[0013] A querying module, configured to query a plurality of first materials that match the first identifier from a plurality of materials corresponding to the query range in a cache;

[0014] An inserting module, configured to sequentially insert the plurality of first materials into a plurality of target pages;

[0015] A sending module, configured to send the plurality of target pages to the user terminal.

[0016] In a third aspect of the embodiments of the present application, an electronic device is further provided, including a processor, a memory, and a program or instruction stored on the memory and executable on the processor, where when the program or instruction is executed by the processor, the steps of the material query method described in any one of the first aspects are implemented.

[0017] In a fourth aspect of the embodiments of the present application, a computer-readable storage medium is further provided, where a program or instruction is stored on the readable storage medium, and when the program or instruction is executed by a processor, the steps of the material query method described in any one of the first aspects are implemented.

[0018] In a fifth aspect of the embodiments of the present application, a computer program product is further provided, where the computer program product is stored in a storage medium, and the computer program product is executed by at least one processor to implement the steps of the material query method described in any one of the first aspects.

[0019] An embodiment of the present invention provides a method and apparatus for querying materials and related devices. The method includes: receiving a material query request sent by a client, where the material query request includes target material information and a paging parameter, the target material information includes material information of at least one dimension requested by the client for querying, and the paging parameter is used to represent the query range of materials; generating a first identifier corresponding to the material information of the at least one dimension according to a preset mapping relationship between the material information of each dimension and an identifier, where the first identifier is an identifier obtained by converting the material information of each dimension into a string according to the mapping relationship; querying a plurality of first materials that match the first identifier from a plurality of materials corresponding to the query range in a cache; sequentially inserting the plurality of first materials into a plurality of target pages; and sending the plurality of target pages to the client. In this application, after receiving the material query request sent by the client, a first identifier is generated according to the target material information and the paging parameter included in the material query request, and a plurality of first materials that match the first identifier are queried within the query range in the cache. Thus, the first materials can be quickly matched in the cache through the first identifier, and by matching the first identifier with the first materials, the acquisition of duplicate materials is avoided, and the efficiency of material query is improved. Description of the Drawings

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art.

[0021] Figure 1 It is a flowchart of the method for querying materials in an embodiment of this application;

[0022] Figure 2 It is one of the schematic diagrams of the processing flow in an embodiment of this application;

[0023] Figure 3 It is the second of the schematic diagrams of the processing flow in an embodiment of this application;

[0024] Figure 4 It is a schematic diagram of the structure of the material query apparatus in an embodiment of this application;

[0025] Figure 5 It is a schematic diagram of the structure of an electronic device in an embodiment of this application. Detailed Embodiments

[0026] The following will clearly and completely describe the technical solutions in the embodiments of this application with reference to the drawings in the embodiments of this application. Obviously, the described embodiments are some, but not all, of the embodiments of this application. All other embodiments obtained by those of ordinary skill in the art without creative efforts based on the embodiments in this application belong to the scope of protection of this application.

[0027] Before discussing the exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts depict the steps as sequential processes, many of the steps can be implemented in parallel, concurrently, or simultaneously. In addition, the order of the steps can be rearranged. The process can be terminated when its operations are completed, but it can also have additional steps not included in the figures. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.

[0028] In addition, terms such as "first", "second", etc. may be used herein to describe various directions, actions, steps, or elements, etc., but these directions, actions, steps, or elements are not limited by these terms. These terms are only used to distinguish the first direction, action, step, or element from another direction, action, step, or element. For example, without departing from the scope of the present application, the first order request can be referred to as the second order request, and similarly, the second order request can be referred to as the first order request. Both the first order request and the second order request are order requests, but they are not the same order request. The terms "first", "second", etc. should not be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first", "second" may explicitly or implicitly include one or more of such features. In the description of the present application, the meaning of "a plurality" is at least two, such as two, three, etc., unless otherwise specifically defined.

[0029] An embodiment of the present application provides a method for querying materials, as Figure 1 shown, the method includes:

[0030] Step 101, receiving a material query request sent by a user terminal, the material query request including target material information and a paging parameter, the target material information including material information of at least one dimension requested by the user terminal to query, and the paging parameter being used to characterize the query range of the materials.

[0031] In this embodiment, the method of the present application can be executed by a server side. The server side in the present application can include an index and a cache. Among them, the index can be an index library such as ElasticSearch, and the cache can be a Redis database. The material query request is generated by the user terminal. When the user wants to query certain materials, a material query request can be generated on the user terminal and sent to the server side.

[0032] Among them, the material query request includes target material information and paging parameters. The target material information includes the material information of at least one dimension requested to be queried. The material information may include, but is not limited to, material ID, name, format, MD5, material type, duration, size, belonging type, belonging playlist, upload time, etc., which are not specifically limited in this embodiment. When generating a material query request, the client can set the material information of one or more dimensions to achieve precise matching in the server. The paging parameter is used to determine the query range of materials in the server, that is, to determine the data set that needs to be queried in the server.

[0033] Step 102: Generate a first identifier corresponding to the material information of the at least one dimension according to the mapping relationship between the material information of each dimension and the identifier preset.

[0034] In this embodiment, after receiving the material query request, a first identifier is generated according to the target material information and the preset mapping relationship included in the material query request. Specifically, the first identifier can be an md5 value. Among them, the md5 value is a widely used hash function that can convert data inputs of any length (such as files, texts, etc.) into hash values of a fixed length of 128 bits (16 bytes).

[0035] Specifically, the target material information and the preset mapping relationship are respectively converted into corresponding strings, and then the string corresponding to the target material information and the string corresponding to the preset mapping relationship are concatenated to generate the first identifier.

[0036] It should be noted that in this embodiment, the paging parameter and other query parameters that do not affect the index query result (such as the requested user name userName) need to be excluded, and then the first identifier is generated. Since the first identifier is a set including all material results, excluding these parameters can avoid the first identifier corresponding to multiple query results.

[0037] In this embodiment, the preset mapping relationship can be a conversion relationship from a dimension to an md5 value. For example, the first three character strings of the md5 value are determined as the character string corresponding to the material ID. After converting the material ID into a string, it is filled into the first three character strings of the md5. The fourth to sixth character strings of the md5 value are determined as the character string corresponding to the material name. After converting the material name into a string, it is filled into the fourth to sixth character strings of the md5. The above is an example of the conversion relationship, and other conversion relationships are not specifically limited in this embodiment. Subsequently, matching in the cache through the first identifier is also to match the md5 value of the material in the cache with the first identifier to determine the matched material.

[0038] Step 103: Among the multiple materials corresponding to the query range in the cache, query for multiple first materials that match the first identifier.

[0039] In this embodiment, the query range is the query range set by the client. For example, the client can set the number of materials displayed per page and the number of pages to query. Exemplarily, the client sets the number of materials displayed per page to 20 in the material query request and the query page to the first page. Then, the server will paginate all the materials that meet the first identifier according to a pagination layout of 20 materials per page, obtaining multiple pages. Each page includes 20 materials. According to the first page queried by the user, the first page among the multiple pages is presented to the user. Thus, the materials included in the first page are determined as multiple first materials, thereby completing the query for multiple first materials that match the first identifier.

[0040] It should be noted that the matching in this embodiment can be partial character matching or all-character matching, and it can be set according to the actual situation whether it belongs to a successful match.

[0041] After the matching between the first identifier and multiple first materials is completed, download the multiple matched first materials in the server index. It should be noted that in this embodiment, after the matching between the first identifier and multiple first materials is completed, a cache list is generated according to the multiple first materials. The cache list includes multiple first materials and the IDs corresponding to the first materials. When the user queries the same first materials later, they can directly download them from the cache without having to download them again from the server index. If the user is querying the first materials for the first time, or if the previously cached relevant data becomes invalid due to expiration or other reasons, the corresponding result cannot be obtained from the cache. At this time, the user needs to download the first materials from the server index.

[0042] Step 104: Insert the multiple first materials into the multiple target pages in sequence.

[0043] In this embodiment, after the server queries the multiple first materials required by the client, the multiple first materials are inserted into the multiple target pages in sequence and then returned to the client. Among them, the number of first materials included in each target page among the multiple target pages can be determined according to the number of materials displayed per page set in the pagination information.

[0044] Step 105: Send the multiple target pages to the client.

[0045] Send the generated multiple target pages to the client. It should be further noted that this query process can be saved in the cache, facilitating the user to directly read the query results from the cache when querying multiple times, without having to query the index again, thereby improving the query efficiency.

[0046] After receiving a material query request sent by the client, the present application generates a first identifier according to the target material information and paging parameters included in the material query request, and queries a plurality of first materials matching the first identifier within the query range in the cache. Thus, the first materials can be quickly matched in the cache through the first identifier. By matching the first identifier with the first materials, the acquisition of duplicate materials is avoided, and the efficiency of material query is improved.

[0047] In some possible implementation manners, optionally, before querying a plurality of first materials matching the first identifier among the plurality of materials corresponding to the query range in the cache in step 103, the method further includes:

[0048] Determine the number of materials displayed per page and the target page number according to the paging parameters. The number of materials displayed per page is used to represent the number of materials displayed per page in the cache, and the target page number is used to represent the page code to be queried in the cache;

[0049] Generate a start position and an end position according to the number of materials displayed per page and the target page number. The start position is the position where the query starts in the cache, and the end position is the position where the query ends in the cache;

[0050] Determine the query range in the cache according to the start position and the end position.

[0051] In this embodiment, the paging parameters include the number of materials displayed per page (pageSize) and the target page number (pageNo). The number of materials is used to represent the number of materials displayed per page in the cache. For example, 20 materials or 30 materials are displayed per page. The target page number is used to represent the page code to be queried in the cache. For example, the first page or the third page. Exemplarily, the client sets the number of materials displayed per page to 20 and the target page number to the third page in the material query request. Then the server side will paginate all the materials that meet the first identifier according to a paging layout of 20 materials per page, obtaining multiple pages, with 20 materials in each page. According to the third page queried by the user, the third page among the multiple pages is presented to the user.

[0052] It should be noted that only one target page can be queried each time. For example, only the first page or the third page can be viewed. If the client wants to query multiple pages at the same time, multiple material query requests need to be generated. Determine the query range according to the set number of materials displayed per page and the target page number, that is, calculate the start position start and end position end of this query in the query result. Specifically, the above calculation of the start position and the end position can be implemented through the Java programming language. For example:

[0053] int start = (pageNo - 1) * pageSize

[0054] int end = start + pageSize

[0055] List <long>materialIds = redisClient.LRANGE(start, end)

[0056] Among them, pageSize is the number of materials displayed per page, and pageNo is the target page number.

[0057] Exemplarily, when pageSize is 20 and pageNo is 3, int start = (3 - 1) * 20 = 40, that is, the 40th material is the starting position of the query result. int end = 40 + 20 = 60, that is, the 60th material is the ending position of the query result.

[0058] In this embodiment, by determining the number of materials displayed per page and the target page number through the paging parameters, the range of materials to be queried can be accurately determined in the cache, avoiding querying the entire cache, thereby narrowing the query range and improving the query efficiency.

[0059] Optionally, before step 101, receiving the material query request sent by the client, the method further includes:

[0060] Obtain a plurality of second materials, and the plurality of second materials include the plurality of first materials;

[0061] Determine a plurality of material information respectively corresponding to the plurality of second materials;

[0062] According to each of the second materials and the corresponding material information, generate a plurality of second identifiers respectively. The second identifier is used to represent the mapping relationship between the second material and the corresponding material information. The plurality of second identifiers correspond to the plurality of second materials one by one. The second identifier is an identifier obtained by converting the material information corresponding to the second material into a string according to the mapping relationship;

[0063] Store the plurality of second materials and the plurality of second identifiers in the cache.

[0064] In this embodiment, before the client queries materials, all materials need to be stored in the index and cache on the server side, and then the corresponding materials in the index are obtained through the cache. Specifically, the second material is the material to be stored in the server side. First, it is necessary to determine a plurality of material information respectively corresponding to the plurality of second materials. Optionally, the material information includes but is not limited to at least one of the following: material ID, material name, material format, material password, material duration, material size, material type, and material upload time.

[0065] Thus, index information for each of the second materials, i.e., the second identifier, is generated based on each of the second materials and the corresponding material information. Specifically, each second identifier corresponds to a second material, and thus each second identifier and the corresponding second material are stored in the index and cache. Among them, for materials already existing in the cache, there is no need to query them again in the index.

[0066] It should be further noted that the generation process of the second identifier is the same as that of the first identifier. Specifically, the second material, the corresponding material information, and the preset mapping relationship are respectively converted into corresponding strings, and then the strings corresponding to the second material and the corresponding material information and the string corresponding to the preset mapping relationship are concatenated to generate the second identifier.

[0067] Exemplarily, for example, for a video material, its second identifier may be as follows:

[0068] Material ID: 100011

[0069] Name: "2024XXX Concert"

[0070] Format: "mp4"

[0071] MD5: "a261abd19de6951ee055b01dbe40f2fb"

[0072] Duration: 1800

[0073] Upload time: "2024-12-01 00:00:00".

[0074] It should be noted that in the above example, the second identifier is a string in MD5 format, i.e., "a261abd19de6951ee055b01dbe40f2fb", where different positions of the string respectively correspond to the material ID, name, format, and duration. For example, the first four digits correspond to the material ID, the fourth to the ninth digits correspond to the name, the tenth to the fifteenth digits correspond to the format, the sixteenth to the twenty-third digits correspond to the duration, and the twenty-fourth to the thirty-second digits correspond to the upload time.

[0075] In this embodiment, by preprocessing the data and storing it in the index and cache, it is possible to directly match the first identifier with the second identifier corresponding to the second material when retrieving through the first identifier, so that the material matching the first identifier can be quickly determined in the cache and index.

[0076] Optionally, in step 103, among the multiple materials corresponding to the query range in the cache, querying for multiple first materials that match the first identifier includes:

[0077] Determining, from a plurality of materials corresponding to the query range in the cache, a plurality of target second identifiers corresponding to the plurality of materials;

[0078] Matching the plurality of target second identifiers according to the first identifier to obtain a matching result, the matching result including a plurality of target third identifiers, the target third identifiers being the target second identifiers among the plurality of target second identifiers that match at least some characters in the first identifier;

[0079] The materials corresponding to the multiple target third identifiers are determined as the multiple first materials.

[0080] In this embodiment, after receiving a material query request, the server analyzes the request. For example, the user initiates a material filtering request to the server, and the system receives user-defined filtering parameters. These parameters may include the number of materials displayed per page (pageSize), the current page number (pageNo), filtering keywords, upload start and end times, and material type.

[0081] For example, a creative query request might look like this:

[0082] {

[0083] "userName":"xxx",

[0084] "pageSize":20,

[0085] "pageNo":1,

[0086] "keywords":"XX张XX",

[0087] "startUploadTime":"2024-05-01 00:00:00",

[0088] "endUploadTime":"2024-08-31 23:59:59",

[0089] "materialType":"Image"

[0090] Therefore, the query request is first excluded from the source query, including paging parameters (pageSize and pageNo) and other query parameters that do not affect the index query results (such as the requested user name). The remaining parameters are then sorted and a first identifier is generated. The query range is determined based on the set paging parameters, that is, the starting position (start) and ending position (end) of the query results are calculated. The first identifier is then matched against multiple second identifiers in the cache to determine multiple first sources.

[0091] It should be noted that when the first identifier is matched with multiple second identifiers in this embodiment, a matching result is obtained, where the matching result includes multiple target third identifiers. Specifically, the target third identifier is the target second identifier among the multiple target second identifiers that matches at least part of the characters in the first identifier. In other embodiments, it can also be set that all the characters included in the second identifier need to match all the characters included in the first identifier. Thus, the materials corresponding to the multiple target third identifiers are determined as the multiple first materials. Through the above matching method according to the identifier, the matching efficiency between the first identifier and the second identifier is improved.

[0092] Optionally, step 104, the inserting the multiple first materials into multiple target pages in sequence includes:

[0093] Using a random sorting algorithm to randomly sort the multiple first materials to obtain the sorted multiple first materials;

[0094] Inserting the sorted multiple first materials into multiple consecutively sorted target pages in sequence.

[0095] In this embodiment, when the server returns multiple first materials to the client, it is necessary to randomly sort the multiple materials and then insert them into multiple target pages and then return them to the client. Specifically, the materials queried from the index are loaded into the memory, and the shuffle algorithm is used to randomly shuffle the order of the materials. In this way, even the materials uploaded at adjacent times will show a randomly distributed state in the query results, effectively avoiding the problem of repeated material content caused by traditional time sorting.

[0096] When performing shuffling, if there is a need to ensure an even distribution of the proportion of material types, then it is necessary to analyze the number of landscape materials and portrait materials of the materials and then perform sorting. Among them, the logic of directly shuffling and randomly disrupting the material id list is as follows (described its function using the Java programming language):

[0097]

[0098] In the above logic, according to the randomly generated random number, the first material at each position is exchanged with the position of the first material at the corresponding random number position until all the first materials have completed the position exchange.

[0099] By storing the multiple first materials after random disruption processing in the cache, it is convenient to directly obtain them from the cache when querying the same first materials next time. Specifically, the key of the cache can be the previously generated first identifier, and the value is a string containing the material id, where the string is saved in the form of a list.

[0100] In an embodiment, indexes are used to store and index-filter data. The shuffle algorithm is utilized to randomly sort the data in memory. The signature algorithm is used to generate a unique identifier for the user's screening request, and the result after random sorting is cached. By changing the traditional single-dimensional sorting method according to time, name, etc., the materials are presented in a random distribution. This effectively solves the problem that it is difficult to screen suitable materials due to the repetition of material content in adjacent times caused by batch uploading, significantly improves the material screening efficiency, reduces the workload of page turning and searching by the screening personnel, and gives different materials more equal chances of being selected, thus enriching the diversity of the material sources for advertising creativity.

[0101] In other implementation manners, a more efficient random sorting algorithm, namely the approximate random algorithm, can also be used. Specifically, in some scenarios where the sorting accuracy requirement is not absolutely strict (such as the preliminary screening or quick browsing stage), a fast algorithm based on approximate sorting is introduced. This algorithm sacrifices a certain degree of sorting accuracy in exchange for a significant improvement in computing speed. For example, the sampling sorting algorithm is adopted. First, the material data is sampled, and an approximate sorting model is constructed based on the sampling result. Then, the entire material data set is quickly sorted according to this model. In this way, the sorting speed can be greatly improved while ensuring that the materials are roughly in order and meet the basic screening requirements, providing users with a faster material preview and preliminary screening function. In the preliminary conceptualization stage of advertising creativity production, users can quickly browse the approximate sorting results of a large number of materials, quickly locate the range of materials that may be useful, and then perform more precise screening and sorting operations according to needs, improving the overall efficiency and flexibility of creativity production.

[0102] In other implementation manners, more flexible sorting rules can also be used for improvement. Specifically, a context-aware model can be established according to the delivery platform (social media, video platform, offline advertising screen, etc.), delivery time (holidays, weekdays, day, night, etc.), and target audience characteristics (age, gender, region, hobbies, etc.). According to different delivery contexts, the material sorting rules are dynamically adjusted. The above implementation manners can be combined with the content of the above embodiments, thereby improving the accuracy and effect of advertising delivery, enabling advertising materials to better adapt to different delivery contexts, attracting the attention of the target audience, and improving the click-through rate, conversion rate, and brand influence of the advertisement.

[0103] Optionally, the first materials include landscape-format materials and portrait-format materials. The step of sequentially inserting the sorted multiple first materials into multiple target pages with continuous sorting includes:

[0104] Determining a preset ratio according to the material query request, where the preset ratio is used to indicate the ratio between the landscape-format materials and the portrait-format materials in the target page;

[0105] Insert the sorted multiple first materials into multiple consecutive sorted target pages in sequence, where the ratio between the landscape-oriented materials and the portrait-oriented materials included in the multiple consecutively sorted target pages is equal to the preset ratio.

[0106] In this embodiment, the first materials include landscape-oriented materials and portrait-oriented materials. If all the landscape-oriented materials or portrait-oriented materials are placed on one page, the display effect is poor, and users cannot directly query various materials.

[0107] Users can set a preset ratio in the material query request. This preset ratio represents the ratio between the landscape-oriented materials and the portrait-oriented materials in each page. For example, when the preset ratio is 1:1, the number of landscape-oriented materials and portrait-oriented materials in each page is the same. Accordingly, insert the sorted multiple first materials into the multiple consecutive sorted target pages in sequence according to the preset ratio.

[0108] In this embodiment, a shuffling algorithm with dynamic adjustment and weight distribution is adopted. If users require a more balanced distribution of material types in the previous page results to facilitate users to quickly select appropriate types of materials according to different creative requirements. Then when using the shuffling algorithm, the materials can be grouped by material type first and randomly shuffled respectively, and then the shuffled data of different material types are evenly combined into the final material order.

[0109] Exemplarily, for example, the number of landscape-oriented material ids in the index query result is 70, and the number of portrait-oriented material ids is 30. If users require that the landscape-oriented materials and portrait-oriented materials in the data ranked in the front are randomly combined in a ratio of about 1:1, the implementation steps are as follows: First, the shuffling algorithm randomly shuffles the landscape-oriented materials and portrait-oriented materials respectively. Then use a random number to randomly generate 0 or 1 each time. If it is 0, take a material id from the shuffled landscape-oriented materials in sequence, otherwise take a material id from the portrait-oriented materials, and then put them into the final result list in sequence until all the material ids of one of the material types are sorted, and finally put the remaining material ids of one of the material types into the result list in sequence.

[0110] By the method in this embodiment, the problem that it is difficult to conveniently select according to requirements due to uneven proportion of material types (such as large difference in the landscape / portrait ratio) is solved, which facilitates creative personnel to quickly locate the required types of materials in the early stage, improves the accuracy and convenience of material screening, helps to improve the efficiency and quality of advertising creative construction, and can better meet the diverse needs of different creative designs for material types.

[0111] Optionally, step 104, inserting the multiple first materials into the multiple consecutive sorted target pages in sequence, includes:

[0112] When the number of the multiple first materials is greater than a preset threshold, group the multiple first materials to obtain at least two material groups;

[0113] After randomly sorting the first materials included in each material group, insert them into a plurality of target pages in continuous sorting in sequence to obtain at least two page sets, each page set includes a plurality of target pages in continuous sorting, and the at least two page sets and the at least two material groups correspond one by one.

[0114] In this embodiment, the preset threshold is a preset value. For example, the preset value can be 500,000 materials or set to other values. When the number of the first materials queried is greater than the preset threshold, the query sorting performance and cache performance will be greatly affected. Therefore, it is necessary to group the multiple first materials to obtain at least two material groups. Exemplarily, for example, divide the multiple first materials into at least two material groups according to the material ID. For example, each material group includes 50,000 first materials. When querying for the first time, only query 50,000 data that meet the conditions as the first material group, and sort this material group through the shuffle algorithm, and record some metadata of this material group in the cache, such as the material group number and the range of material IDs. When the user flips the page to more than 50,000 materials, at this time, query the second material group from the index according to the metadata information of the first material group and the query conditions, and randomly shuffle the cache. And so on, the third and fourth material groups can be processed. When inserting pages, perform corresponding insertions according to different groups to obtain different page sets. When giving feedback to the client, feedback different page sets to the client. In this way, it is ensured that the data order in a single material group is random, and the data is also random globally. At the same time, the quantity limit problem is broken through, and the query efficiency is also improved.

[0115] Through the above method, the screening requirements of a large amount of material data can be processed, and it is no longer limited to a relatively small fixed data volume, enabling more materials to participate in the screening process, increasing the possibility of finding high-quality materials, especially suitable for business scenarios with a large material library scale, and improving the integrity and comprehensiveness of the overall material screening.

[0116] In one implementation, for example Figure 2 as shown Figure 2 One of the process schematic diagrams provided for this application. The server side includes a service platform, a cache, and an index. The specific implementation process is as follows: 1. First, the service platform receives a material query request sent by the user, which includes target material information and paging parameters. 2. According to the material query request and the mapping relationship of identifiers, generate a unique identifier corresponding to the material query request: the first identifier. 3. The service platform queries in the cache based on the first identifier to check if there are multiple first materials corresponding to the first identifier, where the multiple first materials are represented in a list form. 4. The cache returns a cache result to the service platform. 5. When the cache result indicates that there are no multiple first materials in the cache, the service platform queries in the index. 6. The index returns a query result to the service platform, where the query result includes multiple first materials presented in a list. 7. Use a shuffling algorithm to reorder the multiple first materials. 8. Save the multiple first materials in the cache to generate a cache result, so that when the user queries with the same first identifier, they can directly obtain the materials from the cache.

[0117] It should be noted that, as Figure 3 shown, Figure 3 Another process schematic diagram provided for this application. When the user generates a material query request to query the first materials at the user side, first receive the first identifier, where the first identifier is a unique identifier corresponding to the material query request generated according to the material query request and the mapping relationship of identifiers. Query in the cache based on the first identifier to determine if there are multiple first materials corresponding to the first identifier in the cache, and generate a result. In the case where the result is negative, query in the index to obtain multiple first materials, and reorder the multiple first materials according to the shuffling algorithm. Save the reordered multiple first materials in the cache to generate a cache result. And return the query result to the user side, where the query result includes multiple first materials. In the case where the result is positive, that is, when there are multiple first materials corresponding to the first identifier in the cache, generate a query result based on the multiple first materials and return it to the user side.

[0118] When querying in the cache based on the first identifier, if there is already a query result in the cache, directly feedback the query result to the user side. If the user is querying for the first time based on the current set of filtering conditions, or if the previously cached relevant data has expired or become invalid for other reasons, the corresponding result cannot be obtained from the cache. At this time, query the index data according to the query conditions (including filtering keywords, upload time range, material type, etc.), such as querying 50,000 pieces of data that meet the conditions. After obtaining the query materials, randomly sort the query materials and save them in the cache for easy querying of the same type of materials next time, and feedback the query result to the user side.

[0119] After receiving a material query request sent by the client, this application generates a first identifier according to the target material information and paging parameters included in the material query request, and queries a plurality of first materials matching the first identifier within the query range in the cache. Thus, the first materials can be quickly matched in the cache through the first identifier. By matching the first identifier with the first materials, obtaining duplicate materials is avoided, and the efficiency of material query is improved.

[0120] An embodiment of this application provides a device for querying materials, as Figure 4 shown. The material query device 400 includes:

[0121] A receiving module 410, configured to receive a material query request sent by the client. The material query request includes target material information and paging parameters. The target material information includes material information of at least one dimension requested by the client for query, and the paging parameters are used to represent the query range of materials.

[0122] A generating module 420, configured to generate a first identifier corresponding to the material information of the at least one dimension according to a preset mapping relationship between the material information of each dimension and the identifier. The first identifier is an identifier obtained by converting the material information of each dimension into a string according to the mapping relationship.

[0123] A query module 430, configured to query a plurality of first materials matching the first identifier among a plurality of materials corresponding to the query range in the cache.

[0124] An inserting module 440, configured to sequentially insert the plurality of first materials into a plurality of target pages.

[0125] A sending module 450, configured to send the plurality of target pages to the client.

[0126] Optionally, it further includes:

[0127] A first determining module, configured to determine the number of materials displayed per page and the target page number according to the paging parameters. The number of materials displayed per page is used to represent the number of materials displayed per page in the cache, and the target page number is used to represent the page code to be queried in the cache.

[0128] A calculating module, configured to generate a starting position and an ending position according to the number of materials displayed per page and the target page number. The starting position is the position to start querying in the cache, and the ending position is the position to end the query in the cache.

[0129] A second determining module, configured to determine the query range in the cache according to the starting position and the ending position.

[0130] Optionally, it further includes:

[0131] A material acquisition module for acquiring a plurality of second materials, where the plurality of second materials include the plurality of first materials;

[0132] A material determination module for determining a plurality of material information respectively corresponding to the plurality of second materials;

[0133] A material matching module for generating a plurality of second identifiers respectively after matching each of the second materials with the corresponding material information. The second identifier is used to represent the mapping relationship between the second material and the corresponding material information. The plurality of second identifiers correspond one-to-one with the plurality of second materials. The second identifier is an identifier obtained by converting the material information corresponding to the second material into a string according to the mapping relationship;

[0134] A material storage module for storing the plurality of second materials and the plurality of second identifiers in the cache.

[0135] Optionally, the query module 430 includes:

[0136] A first determination sub-module for determining a plurality of target second identifiers corresponding to the plurality of materials among the plurality of materials corresponding to the query range in the cache;

[0137] A matching sub-module for matching according to the first identifier among the plurality of target second identifiers, and the matching result includes a plurality of target third identifiers. The target third identifier is the target second identifier among the plurality of target second identifiers that matches at least part of the characters in the first identifier;

[0138] A second determination sub-module for determining the materials corresponding to the plurality of target third identifiers as the plurality of first materials.

[0139] Optionally, the material information includes at least one of the following: material ID, material name, material format, material password, material duration, material size, material type, and material upload time.

[0140] Optionally, the insertion module 440 includes:

[0141] A sorting sub-module for randomly sorting the plurality of first materials using a random sorting algorithm to obtain the sorted plurality of first materials;

[0142] An insertion sub-module for sequentially inserting the sorted plurality of first materials into a plurality of target pages with consecutive sorting.

[0143] Optionally, the first materials include landscape materials and portrait materials, and the insertion sub-module includes:

[0144] A determination unit, configured to determine a preset ratio according to the material query request, where the preset ratio is used to indicate the ratio between the landscape-oriented material and the portrait-oriented material in the target page;

[0145] An insertion unit, configured to sequentially insert the sorted multiple first materials into multiple consecutively sorted target pages, where the ratio between the landscape-oriented materials and the portrait-oriented materials included in the multiple consecutively sorted target pages is equal to the preset ratio.

[0146] Optionally, the insertion module 440 includes:

[0147] A grouping sub-module, configured to group the multiple first materials to obtain at least two material groups when the number of materials in the multiple first materials is greater than a preset threshold;

[0148] An aggregate insertion sub-module, configured to randomly sort the first materials included in each material group and then sequentially insert them into multiple consecutively sorted target pages to obtain at least two page aggregates, each page aggregate including multiple consecutively sorted target pages, and the at least two page aggregates correspond to the at least two material groups one by one.

[0149] After receiving a material query request sent by a client, the present application generates a first identifier according to the target material information and paging parameters included in the material query request, and queries multiple first materials matching the first identifier within the query range in the cache, so as to quickly match the first materials in the cache through the first identifier. Through the matching of the first identifier and the first materials, the acquisition of duplicate materials is avoided, and the efficiency of material query is improved.

[0150] Figure 5 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application, as Figure 5 shown. The electronic device 500 includes a memory 510 and a processor 520. The number of processors 520 in the electronic device 500 can be one or more. Figure 5 Taking one processor 520 as an example; the memory 510 and the processor 520 in the server can be connected through a bus or other means. Figure 5 Taking the connection through a bus as an example.

[0151] The memory 510, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as program instructions / modules corresponding to the member push method in the embodiments of the present application. The processor 520 runs the software programs, instructions, and modules stored in the memory 510 to execute various functional applications and data processing of the server / terminal / server, that is, to implement the above-mentioned material query method.

[0152] Among them, the processor 520 is used to run the computer program stored in the memory 510 to implement the following steps:

[0153] Receive a material query request sent by the user terminal. The material query request includes target material information and paging parameters. The target material information includes material information of at least one dimension requested by the user terminal for query, and the paging parameters are used to represent the query range of the materials;

[0154] Generate a first identifier corresponding to the material information of the at least one dimension according to the preset mapping relationship between the material information of each dimension and the identifier. The first identifier is an identifier obtained by converting the material information of each dimension into a string according to the mapping relationship;

[0155] Query a plurality of first materials that match the first identifier among a plurality of materials corresponding to the query range in the cache;

[0156] Insert the plurality of first materials into a plurality of target pages in sequence;

[0157] Send the plurality of target pages to the user terminal.

[0158] Optionally, before querying the plurality of first materials that match the first identifier among the plurality of materials corresponding to the query range in the cache, the method further includes:

[0159] Determine the number of materials displayed per page and the target page number according to the paging parameters. The number of materials displayed per page is used to represent the number of materials displayed per page in the cache, and the target page number is used to represent the page code to be queried in the cache;

[0160] Generate a start position and an end position according to the number of materials displayed per page and the target page number. The start position is the position where the query starts in the cache, and the end position is the position where the query ends in the cache;

[0161] Determine the query range in the cache according to the start position and the end position.

[0162] Optionally, before receiving the material query request sent by the user terminal, the method further includes:

[0163] Obtain a plurality of second materials, where the plurality of second materials include the plurality of first materials;

[0164] Determine the plurality of material information corresponding to the plurality of second materials respectively;

[0165] According to each of the second materials and the corresponding material information, a plurality of second identifiers are respectively generated. The second identifiers are used to represent the mapping relationship between the second materials and the corresponding material information. The plurality of second identifiers correspond one-to-one with the plurality of second materials. The second identifier is an identifier obtained by converting the material information corresponding to the second material into a string according to the mapping relationship;

[0166] Store the plurality of second materials and the plurality of second identifiers in the cache.

[0167] Optionally, among the plurality of materials corresponding to the query range in the cache, querying for a plurality of first materials that match the first identifier includes:

[0168] Determine the plurality of target second identifiers corresponding to the plurality of materials among the plurality of materials corresponding to the query range in the cache;

[0169] Match according to the first identifier among the plurality of target second identifiers to obtain a matching result. The matching result includes a plurality of target third identifiers. The target third identifier is the target second identifier among the plurality of target second identifiers that matches at least part of the characters in the first identifier;

[0170] Determine the materials corresponding to the plurality of target third identifiers as the plurality of first materials.

[0171] Optionally, the material information includes at least one of the following: material ID, material name, material format, material password, material duration, material size, material type, and material upload time.

[0172] Optionally, the inserting the plurality of first materials into a plurality of target pages in sequence includes:

[0173] Use a random sorting algorithm to randomly sort the plurality of first materials to obtain the sorted plurality of first materials;

[0174] Insert the sorted plurality of first materials into the continuously sorted plurality of target pages in sequence.

[0175] Optionally, the first materials include landscape-oriented materials and portrait-oriented materials. The inserting the sorted plurality of first materials into the continuously sorted plurality of target pages in sequence includes:

[0176] Determine a preset ratio according to the material query request. The preset ratio is used to indicate the ratio between the landscape-oriented materials and the portrait-oriented materials in the target page;

[0177] Insert the sorted multiple first materials into multiple consecutive sorted target pages in sequence, where the ratio between the landscape-oriented materials and the portrait-oriented materials included in the multiple consecutively sorted target pages is equal to the preset ratio.

[0178] Optionally, inserting the multiple first materials into the multiple target pages in sequence includes:

[0179] When the number of the multiple first materials is greater than a preset threshold, group the multiple first materials to obtain at least two material groups;

[0180] After randomly sorting the first materials included in each material group, insert them into multiple consecutive sorted target pages in sequence to obtain at least two page sets, each page set including multiple consecutive sorted target pages, and the at least two page sets correspond to the at least two material groups one by one.

[0181] After receiving a material query request sent by a client, this application generates a first identifier according to the target material information and paging parameters included in the material query request, and queries multiple first materials matching the first identifier within the query range in the cache, so as to quickly match the first materials in the cache through the first identifier. By matching the first identifier with the first materials, obtaining duplicate materials is avoided, and the efficiency of material query is improved.

[0182] The computer-readable storage medium of the embodiments of this application can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (non-exhaustive list) of the computer-readable storage medium include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, the computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or combined with an instruction execution system, apparatus, or device.

[0183] A computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, carrying computer-readable program code. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0184] The program code contained on the storage medium can be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0185] The computer program code for performing the operations of this application can be written in one or more programming languages or combinations thereof. The programming languages include object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or terminal. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., by using an Internet service provider to connect through the Internet).

[0186] Another embodiment of this application provides a computer program product. The computer program product is stored in a storage medium and is executed by at least one processor to implement each process of the query method embodiment of the above-mentioned materials and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.

[0187] Note that the above is only a preferred embodiment of this application and the technical principles applied. Those skilled in the art will understand that this application is not limited to the specific embodiments described herein. Various obvious changes, re-adjustments, and substitutions can be made by those skilled in the art without departing from the protection scope of this application. Therefore, although this application has been described in more detail through the above embodiments, this application is not limited to the above embodiments. Without departing from the concept of this application, it can also include more other equivalent embodiments, and the scope of this application is determined by the scope of the appended claims.< / long>

Claims

1. A query method for a material, characterized in that, The method includes: Receiving a material query request sent by a client, where the material query request includes target material information and a paging parameter. The target material information includes material information of at least one dimension requested by the client for query, and the paging parameter is used to characterize the query range of the materials; Generating a first identifier corresponding to the material information of the at least one dimension according to a preset mapping relationship between the material information of each dimension and an identifier. The first identifier is an identifier obtained by converting the material information of each dimension into a string according to the mapping relationship; Querying a plurality of first materials that match the first identifier among a plurality of materials corresponding to the query range in the cache; Inserting the plurality of first materials into a plurality of target pages in sequence; Sending the plurality of target pages to the client.

2. The method according to claim 1, wherein Before querying the plurality of first materials that match the first identifier among the plurality of materials corresponding to the query range in the cache, the method further includes: Determining the number of materials displayed per page and a target page number according to the paging parameter. The number of materials displayed per page is used to represent the number of materials displayed per page in the cache, and the target page number is used to represent the page code to be queried in the cache; Generating a start position and an end position according to the number of materials displayed per page and the target page number. The start position is the position where the query starts in the cache, and the end position is the position where the query ends in the cache; Determining the query range in the cache according to the start position and the end position.

3. The method according to claim 1, wherein Before receiving the material query request sent by the client, the method further includes: Obtaining a plurality of second materials, where the plurality of second materials include the plurality of first materials; Determining a plurality of material information corresponding to the plurality of second materials; Generating a plurality of second identifiers respectively according to each of the second materials and the corresponding material information. The second identifier is used to represent the mapping relationship between the second material and the corresponding material information. The plurality of second identifiers correspond to the plurality of second materials one by one. The second identifier is an identifier obtained by converting the material information corresponding to the second material into a string according to the mapping relationship; Storing the plurality of second materials and the plurality of second identifiers in the cache.

4. The method according to claim 3, wherein The querying the plurality of first materials that match the first identifier among the plurality of materials corresponding to the query range in the cache includes: Determining a plurality of target second identifiers corresponding to the plurality of materials among the plurality of materials corresponding to the query range in the cache; Performing a match according to the first identifier among the plurality of target second identifiers to obtain a match result. The match result includes a plurality of target third identifiers. The target third identifier is the target second identifier among the plurality of target second identifiers that matches at least part of the characters in the first identifier; Determining the materials corresponding to the plurality of target third identifiers as the plurality of first materials.

5. The method according to claim 3, wherein The material information includes at least one of the following: material ID, material name, material format, material password, material duration, material size, material type, and material upload time.

6. The method according to claim 1, characterized in that Said inserting the multiple first materials into the multiple target pages in sequence includes: Randomly sorting the multiple first materials using a random sorting algorithm to obtain the sorted multiple first materials; Inserting the sorted multiple first materials into the multiple continuously sorted target pages in sequence.

7. The method according to claim 6, wherein The first materials include horizontal materials and vertical materials. Said inserting the sorted multiple first materials into the multiple continuously sorted target pages in sequence includes: Determining a preset ratio according to the material query request, where the preset ratio is used to indicate the ratio between the horizontal materials and the vertical materials in the target page; Inserting the sorted multiple first materials into the multiple continuously sorted target pages in sequence, where the ratio between the horizontal materials and the vertical materials included in the multiple continuously sorted target pages is equal to the preset ratio.

8. The method according to claim 1, characterized in that Said inserting the multiple first materials into the multiple target pages in sequence includes: When the number of the multiple first materials is greater than a preset threshold, grouping the multiple first materials to obtain at least two material groups; Randomly sorting the first materials included in each material group and then inserting them into the multiple continuously sorted target pages in sequence to obtain at least two page sets, each page set including the multiple continuously sorted target pages, and the at least two page sets and the at least two material groups correspond one by one.

9. An inquiry device for a material, characterized in that, The device includes: A receiving module, configured to receive a material query request sent by a user terminal. The material query request includes target material information and paging parameters. The target material information includes the material information of at least one dimension requested by the user terminal to query, and the paging parameters are used to characterize the query range of the materials; A generating module, configured to generate a first identifier corresponding to the material information of the at least one dimension according to a preset mapping relationship between the material information of each dimension and the identifier. The first identifier is an identifier obtained by converting the material information of each dimension into a string according to the mapping relationship; A query module, configured to query multiple first materials that match the first identifier from multiple materials corresponding to the query range in the cache; An inserting module, configured to insert the multiple first materials into the multiple target pages in sequence; A sending module, configured to send the multiple target pages to the user terminal.

10. An electronic device, characterized in that, It includes a processor, a memory, and a program or instruction stored on the memory and executable on the processor. When the program or instruction is executed by the processor, the steps of the material query method according to any one of claims 1 to 8 are implemented.

11. A computer-readable storage medium, characterized in that, A program or instruction is stored on the readable storage medium. When the program or instruction is executed by a processor, the steps of the material query method according to any one of claims 1 to 8 are implemented.

12. A computer program product, characterized in that, The computer program product is stored in a storage medium. The computer program product is executed by at least one processor to implement the steps in the material query method according to any one of claims 1 to 8.