CN108717432B - Resource query method and device - Google Patents

Resource query method and device Download PDF

Info

Publication number
CN108717432B
CN108717432B CN201810448602.1A CN201810448602A CN108717432B CN 108717432 B CN108717432 B CN 108717432B CN 201810448602 A CN201810448602 A CN 201810448602A CN 108717432 B CN108717432 B CN 108717432B
Authority
CN
China
Prior art keywords
resource
index
server
network
tag
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810448602.1A
Other languages
Chinese (zh)
Other versions
CN108717432A (en
Inventor
冯锋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201810448602.1A priority Critical patent/CN108717432B/en
Publication of CN108717432A publication Critical patent/CN108717432A/en
Application granted granted Critical
Publication of CN108717432B publication Critical patent/CN108717432B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a resource query method and a resource query device, and belongs to the field of resource management. The method is applied to a first server in a resource system and comprises the following steps: after any network resource is stored in a first database, correspondingly storing a resource label and a resource index of the network resource into a storage space of the first server; receiving an inquiry request of a first terminal, wherein the inquiry request carries at least one resource label; acquiring at least one target resource index from the resource indexes stored in the storage space of the first server, wherein the target resource index is a resource index corresponding to at least one resource label; and returning a resource query result to the first terminal based on at least one target resource index. The method and the device can directly acquire the resource index corresponding to the resource label from the resource indexes stored in the local storage space, and the operation of acquiring the resource index is simple and convenient, the acquisition efficiency is high, and the resource query efficiency is further improved.

Description

Resource query method and device
Technical Field
The present invention relates to the field of resource management, and in particular, to a resource query method and apparatus.
Background
With the development of the internet, users often share own network resources to the network so that other users can view the network conveniently. For example, the network resource may be a video, a picture, an article or a post, etc. In addition, in practical application, in order to facilitate other users to query the network resources needed by themselves from massive network resources, when the users share the network resources, the users may be required to set resource tags for the shared network resources, where the resource tags are used to indicate categories of the network resources, and then the other users may conveniently query the needed network resources through the resource tags.
In the related art, a server generally stores network resources uploaded by a user in a resource database, and stores a resource index of each network resource in an index database corresponding to a resource tag of the network resource, where the resource index of the network resource is used to indicate a storage location of the network resource. That is, the server is generally connected to a plurality of index databases, each index database being used for storing a resource index corresponding to a kind of resource tag. In practical application, the terminal may send a query request to the server according to a query operation of a user, where the query request carries at least one resource tag to request to query a network resource corresponding to the at least one resource tag. When the server receives the query request, for each resource tag in the at least one resource tag, at least one resource index may be obtained from the index database corresponding to each resource tag, then the resource index obtained from the index database corresponding to each resource tag is determined as at least one target resource index, then at least one network resource is obtained from the resource database based on the at least one target resource index, and the at least one network resource is returned to the terminal.
After receiving the query request, the index database corresponding to the resource tag needs to be searched first, then the resource index is obtained from the resource database, and when there are many resource tags, the index database corresponding to each resource tag in the multiple resource tags needs to be searched, and the resource index is obtained from the resource database corresponding to each resource tag, so that the obtaining efficiency of the resource index is low, and the query efficiency of the network resource is low.
Disclosure of Invention
The embodiment of the invention provides a resource query method and a resource query device, which can be used for solving the problems of low resource index acquisition efficiency and low network resource query efficiency in the related technology. The technical scheme is as follows:
in one aspect, a resource query method is provided, which is applied to a first server in a resource system, and the method includes:
after any network resource is stored in a first database, correspondingly storing a resource label and a resource index of the network resource into a storage space of the first server, wherein the first database is used for storing the network resource issued in the resource system;
receiving a query request of a first terminal, wherein the query request carries at least one resource label, and the resource label is used for indicating the category of a resource to be queried;
acquiring at least one target resource index from resource indexes stored in a storage space of the first server, wherein the target resource index is a resource index corresponding to the at least one resource label;
and returning a resource query result to the first terminal based on the at least one target resource index.
In one aspect, an apparatus for querying a resource is provided, where the apparatus includes:
the first storage module is used for correspondingly storing the resource labels and the resource indexes of the network resources into the storage space of the first server after any network resource is stored into a first database;
a receiving module, configured to receive an inquiry request of a first terminal, where the inquiry request carries at least one resource tag, and the resource tag is used to indicate a category to which a resource to be inquired belongs;
a first obtaining module, configured to obtain at least one target resource index from resource indexes stored in a storage space of the first server, where the target resource index is a resource index corresponding to the at least one resource tag;
and the first sending module is used for returning a resource query result to the first terminal based on the at least one target resource index.
In one aspect, a server is provided, which includes a processor and a memory, where at least one instruction, at least one program, a set of codes, or a set of instructions is stored in the memory, and the instruction, the program, the set of codes, or the set of instructions is loaded and executed by the processor to implement the above resource query method.
In one aspect, a computer-readable storage medium is provided, in which at least one instruction, at least one program, a set of codes, or a set of instructions is stored, and the instruction, the program, the set of codes, or the set of instructions is loaded and executed by a processor to implement the above resource query method.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
in the embodiment of the invention, for any server in the resource system, after any network resource is stored in the first database, the first server can directly and correspondingly store the resource tag and the resource index of the network resource in the local storage space, after receiving the query request, the first server directly obtains the resource index corresponding to the resource tag from the resource index stored in the local storage space, and returns the query result based on the obtained resource index.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic diagram of an internet forum according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a resource system according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of another resource system provided by an embodiment of the invention;
FIG. 4 is a flowchart of a resource query method according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of another resource system provided by an embodiment of the invention;
FIG. 6 is a schematic diagram of a resource system provided in the related art;
FIG. 7 is a flow chart of a storage of a network resource according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of a resource query apparatus according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of a terminal 900 according to an embodiment of the present invention;
fig. 10 is a schematic structural diagram of a server 1000 according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
Before explaining the embodiments of the present invention in detail, an application scenario of the embodiments of the present invention will be described.
Before explaining the embodiments of the present invention in detail, an application scenario of the embodiments of the present invention will be described.
The resource query method provided by the embodiment of the invention is used in a scene that a User queries network resources on the network, and the network resources can be videos, pictures, posts or UGC (User Generated Content) and the like. In particular, the method is mainly applied to a scene of inquiring network resources through resource tags.
In the query process, the user may select the resource tag in the query interface, perform the query based on the selected resource tag, or input the resource tag in the query interface, and perform the query based on the input resource tag, which is not limited in the embodiment of the present invention.
For example, a query interface may provide a query entry corresponding to a plurality of resource tags, and a user may query a network resource corresponding to any resource tag in the plurality of resource tags by triggering the query entry corresponding to the resource tag. Taking a network resource as an example of a video, a video website usually sets topics named by multiple resource tags, such as "movie", "music", "animation", and "fun", and a user can query a video corresponding to a resource tag by clicking the topic named by a certain resource tag, and when a query operation of the user is detected, the current query interface can jump to a topic interface corresponding to the resource tag, and multiple videos corresponding to the resource tag are displayed on the topic interface.
For another example, the query interface may provide a search box in which the user may enter resource tags to query through the entered resource tags. Taking the network resource as the video as an example, when a user wants to search for a funny video, the user can input a resource label "funny" in the search box and then click a confirmation button to confirm the query. When the terminal detects the click operation of the confirmation button, the terminal can send an inquiry request to the server, and the inquiry request carries a resource label 'laugh'.
In addition, the user can share the network resources on the network, and can set resource tags for the shared network resources. Specifically, the resource label of the network resource may be selected by the user from a plurality of resource labels provided by the resource sharing interface, or may be input by the user.
For example, taking the network resource as a video as an example, a user may upload a video made by the user on a video website, and set a corresponding resource tag for the uploaded video, so that other users may query the video uploaded by the user through the resource tag set by the user. For example, the user may set a music tag for an uploaded music video, a fun tag for an uploaded fun video, and the like.
For another example, taking the network resource as a post, the user may publish the post in an internet forum to post his own opinion and opinion through the post, and in order to make other users find the post published by himself easier, the user may set a corresponding tag for the post to identify a rough classification of the post through the tag. And other users can inquire the posts with the tags in the internet forum according to the tags which sense interests of the users, so that the users can conveniently find favorite contents. For example, the display interface of the internet forum may be as shown in fig. 1.
The system architecture of the present invention is described below.
The embodiment of the invention is applied to a resource system, and the resource system comprises at least one server and is used for providing services such as storage or inquiry of resources for users.
Fig. 2 is a schematic diagram of a resource system according to an embodiment of the present invention, and as shown in fig. 2, the resource system includes a first server 10, a first database 20, and a first terminal 30, and the first server 10 may be connected to the first database 20 and the first terminal 30 through a network, respectively.
The first server 20 is a server for providing a network resource sharing and querying service for a user, for example, the first server may be a background server of a network resource platform, such as UGC. The first database 20 is used to store network resources published within the resource system. The first terminal 30 is a user terminal, and may be a mobile phone, a tablet computer, a computer, or the like.
In this embodiment of the present invention, after storing any network resource in the first database 20, the first server 30 may directly store the network resource and the resource index into the storage space of the first server 30 correspondingly, and then may receive an inquiry request of the first terminal 30, where the inquiry request carries at least one resource tag, and then obtain at least one target resource index from the resource indexes already stored in the storage space of the first server 30, where the at least one target resource index is a resource index corresponding to the at least one resource tag, and finally return a resource inquiry result to the first terminal 30 based on the at least one target resource index.
That is, in the embodiment of the present invention, the first server 30 may store the network resource and the resource index into the local storage space, and when receiving the query request, may directly query the resource index corresponding to the resource tag from the local storage space, and return the query result based on the queried resource index, thereby avoiding the operation of obtaining the resource index from the index database corresponding to each resource tag, and improving the resource query efficiency.
Further, the resource system may further include other servers besides the first server 10, and a server cluster may be formed among the plurality of servers, so as to jointly provide resource services for the user. As shown in fig. 3, the resource system further includes a second server 40.
After the first server 10 correspondingly stores the resource tag and the resource index of the network resource into the storage space of the first server 10, the resource tag and the resource index of the network resource may also be sent to the second server 40, and the second server 40 correspondingly stores the resource tag and the resource index of the network resource into the storage space of the second server 40.
Further, as shown in fig. 3, the resource system may further include a second database 50, and in this embodiment of the present invention, the second database 40 is configured to store resource tags and resource indexes of network resources published in the resource system.
For example, the first server 10 may further store the resource tag and the resource index of the network resource to the second database 50, obtain the resource tag and the resource index, which are stored by the second server 40 correspondingly, from the second database 50, and update the resource tag and the resource index, which are already stored in the storage space of the first server, based on the obtained resource tag and resource index.
That is, each server may upload the resource tag and the resource index of the network resource received by itself to the second database 50, and may also obtain the resource tag and the resource index uploaded by other servers from the second database 50, so that data synchronization between the servers may be achieved, it is ensured that each server can return the resource query result for the query request of the user, and the reliability of the service is improved.
Further, the resource system may further include a second terminal, where the second terminal may send a sharing request to the first server 10, where the sharing request carries a network resource, and the first server 10 may store the network resource in the first database 20, obtain a resource tag of the network resource, and correspondingly store the resource tag and the resource index of the network resource in the storage space of the first server 10. The second terminal and the first terminal 30 may be the same terminal or different terminals, which is not limited in this embodiment of the present invention.
Fig. 4 is a flowchart of a resource query method provided in an embodiment of the present invention, where the method is applied to a first server in a resource system, and as shown in fig. 4, the resource query method may include the following steps:
step 401: after the first server stores any network resource in the first database, the resource label and the resource index of the network resource are correspondingly stored in the storage space of the first server.
The network resource refers to a resource that a user can browse on the internet, for example, the network resource may be a video, a picture, a post, or UGC. The resource labels of the network resources are used to indicate the category to which the network resources belong, for example, the resource labels of music may include "pop", "rock", "folk song" or "jazz", etc. The first database is a database for storing network resources published within the resource system. The resource index is used for indicating the storage position of the network resource in the first database, and the network resource can be obtained from the first database according to the resource index.
After the first server obtains the network resource to be stored, the resource index of the network resource to be stored can be determined according to the storage information of the first database, and then the network resource is stored in the first database according to the determined resource index. Generally, the first database may sequentially store the network resources, and thus, the resource index of the network resource to be stored may be determined according to a preset storage sequence of the network resource and a resource index of the network resource stored last time.
The resource label of the network resource can be obtained from a sending end of the network resource, and can also be determined according to the network resource. When the sending end of the network resource only sends the network resource to the first server, but does not send the resource tag of the network resource, the first server may also determine the resource tag of the network resource according to the network resource, for example, extract a keyword from a topic of the network resource, and determine the extracted keyword as the resource tag of the network resource.
For example, before storing any network resource in the first database, the first server may receive a network resource sent by the second terminal and a resource tag of the network resource, which may be input by the user for the network resource in the second terminal. Or before any network resource is stored in the first database, the first server may receive the network resource sent by the second terminal, then extract a keyword from a topic of the network resource, and determine the extracted keyword as a resource tag of the network resource.
It should be noted that, in the embodiment of the present invention, after the first server stores any network resource in the first database, the resource tag and the resource index of the network resource may be directly and correspondingly stored in the storage space of the first server, that is, the resource tag and the resource index of the network resource may be directly stored in the local storage space of the first server, and it is not necessary to store the resource index of the network resource in the index database corresponding to the resource tag of the network resource. Therefore, the storage efficiency of the resource index can be improved, the problems of data storage errors or data loss and the like which are easy to occur in the process of storing the resource index into the index database can be avoided, and the storage reliability is improved.
Specifically, the first server may store the resource tag and the resource index of the network resource to a memory of the first server or a target hard disk correspondingly. By correspondingly storing the network resource tags and the resource indexes into the memory of the first server, the subsequent reading efficiency of the resource tags and the resource indexes of the network resources can be improved, and the subsequent query efficiency of the resource indexes can be improved. By correspondingly storing the data into the target hard disk of the first server, the memory pressure of the first server can be relieved, and the processing performance of the first server is improved.
Specifically, the first server may store the resource tag and the resource index of the network resource into a target directory in the storage space of the first server according to the resource tag of the network resource, where the target directory is a directory corresponding to the resource tag.
Further, after the resource tag and the resource index of the network resource are correspondingly stored in the storage space of the first server, the first server may also send the resource tag and the resource index of the network resource to a second server, and the second server correspondingly stores the resource tag and the resource index of the network resource into the storage space of the second server, where the second server is a server other than the first server in the resource system.
The first server and the second server are both servers which provide resource query service for users in the resource system, and the users can query any server when querying network resources, namely, the terminal can send query requests to any server.
In the embodiment of the invention, the first server sends the resource label and the resource index of the network resource to the second server, so that the currently stored data can be synchronized to the second server, thereby realizing data synchronization between the servers, ensuring that a user can inquire the network resource through the second server and improving the reliability of resource inquiry.
Further, after the resource tag and the resource index of the network resource are correspondingly stored in the storage space of the first server, the first server may also correspondingly store the resource tag and the resource index of the network resource to the second database, that is, the first server not only stores the resource tag and the resource index of the network resource in the local storage space, but also writes the resource tag and the resource index of the network resource into the second database. Therefore, the resource labels and the resource indexes of the network resources can be backed up through the second database, and the reliability of data storage is improved.
Further, when the first server needs to store the resource tag and the resource index into the second database, the first server may further obtain the resource tag and the resource index, which are stored by the second server, from the second database, and update the resource tag and the resource index, which are already stored in the storage space of the first server, based on the obtained resource tag and resource index. The second server refers to a server other than the first server in the resource system.
The updating of the resource tag and the resource index stored in the storage space of the first server based on the acquired resource tag and resource index means that the resource tag and the resource index stored in the storage space of the first server are supplemented based on the acquired resource tag and resource index, so that the storage space of the first server can store the resource tag and the resource index which are correspondingly stored in the database by other servers.
That is, each server in the resource system can upload the resource labels and resource indexes of the network resources received by the server to the second database, and can also acquire the resource labels and resource indexes uploaded by other servers from the second database, so that data synchronization among the servers can be realized, each server can be ensured to return resource query results according to the query requests of the users, and the reliability of the service is improved.
Further, the first server may also obtain synchronization data from the second database when needed, update the stored data based on the synchronization data if the stored data of the first server and the synchronization data are not consistent, and not update the stored data if the stored data of the first server and the synchronization data are consistent.
The synchronous data refers to resource tags and resource indexes which are correspondingly stored in the second database within a second preset time before the acquisition time, the acquisition time refers to the time when the first server acquires the synchronous data, and the stored data refers to the resource tags and the resource indexes which are correspondingly stored in the storage space by the first server within the second preset time before the acquisition time.
The second preset time period may be preset, and may be negotiated between the first server and the second database, for example, through a protocol between the first server and the second database. For example, the second preset time period may be 1 minute, 10 minutes, or half an hour, etc.
That is, the first server may obtain the resource tag and the resource index stored in the second database in the last period of time, and update the source tag and the resource index stored in the first server in the last period of time according to the resource tag and the resource index stored in the second database in the last period of time, so that the data storage error of the first server may be compensated.
Specifically, updating the stored data based on the synchronization data may include: and replacing the stored data with the synchronous data, or modifying the stored data based on the synchronous data, so that the modified stored data and the synchronous data are kept consistent.
Specifically, the synchronization data may be obtained from the second database when the first server receives the data update instruction, or the synchronization data may be obtained from the second database every first preset time.
The data update instruction may be triggered by a specified condition, for example, the specified condition may be that no network resource is received within a third preset time period, or that a resource index queried by the query request cannot be found after the query request is received. By acquiring the synchronous data from the second database when the data updating instruction is received and updating the stored data of the first server based on the synchronous data, the data storage error of the first server can be made up.
The first preset duration is greater than or equal to the second preset duration, and the first preset duration may be preset, specifically may be set by a user, or may be set by default by the first server. For example, the first preset time period may be 10 minutes, half an hour, or 1 hour, etc. By acquiring the synchronous data from the second database every other first preset time, namely periodically acquiring the synchronous data, and updating the stored data of the first server based on the synchronous data, the reliability of data storage in the first server can be improved.
For example, when the resource tags and the resource indexes of the network resources received by each server in the resource system are mutually synchronized, the resource tags and the resource indexes of the network resources can be additionally stored in the second database, the synchronization data can be acquired from the second database, and the local stored data can be updated based on the synchronization data.
In a possible embodiment, the second database may sort the stored resource indexes corresponding to different resource tags according to a preset sorting policy, so as to obtain an index sorting result of each resource tag. Further, the first server may also obtain an index sorting result of each resource tag from the second database periodically or aperiodically, if the first server does not sort the resource indexes corresponding to the stored different resource tags according to a preset sorting policy, the obtained index sorting result of each resource tag may be stored in the storage space of the first server, and if the first server already stores the index sorting results of the plurality of resource tags, when the index sorting results of the plurality of resource tags already stored by the first server are inconsistent with the index sorting result of each resource tag obtained from the server, the index sorting results of the plurality of resource tags stored by the first server may be updated based on the obtained index sorting result of each resource tag.
In a possible embodiment, when the first server obtains the index sorting results of the plurality of resource tags, for each resource tag, only the resource indexes whose sorting positions are located in the top N in the index sorting result of each resource tag may be stored in the local storage space, where N is a positive integer. For example, N may be 500, 800, 1000, or the like. Further, for the first N resource indexes corresponding to each resource tag, that is, the resource indexes whose sorting positions are located in the first N in the index sorting result of each resource tag, the first terminal may further obtain the first N network resources corresponding to each resource tag according to the first N resource indexes corresponding to each resource tag, and cache the obtained first N network resources corresponding to each resource tag in the storage space of the first server, so that the network resources corresponding to the resource tags may be obtained from the local storage space directly according to the resource tags carried in the query request in the subsequent process.
In a possible embodiment, the first server may further obtain, from the second database, the resource tag and the resource index of the network resource that is accessed more than the first threshold number of times, and/or the resource tag and the corresponding resource index that are queried more than the second threshold number of times, and then store the obtained resource tag and resource index into the storage space of the first server.
That is, the resource tags and the resource indexes with higher heat, that is, higher accessed times or attention degrees, may be synchronized from the second database, so that the reliability of the first server resource query may be improved.
The first threshold and the second threshold may be preset, specifically may be set by a user as needed, or may be set by default by a server, which is not limited in the embodiment of the present invention.
Further, in the embodiment of the present invention, the first server may store the resource labels and the resource indexes in a full amount, or may store only the partial resource labels and the resource indexes that meet the requirements, and store the partial resource labels and the resource indexes that do not meet the requirements in the second database.
In a possible implementation, the first server may obtain, from the resource tags and resource indexes already stored in the storage space of the first server, the resource tags and resource indexes of the network resources whose number of times of access is less than a third threshold, and/or the resource tags and corresponding resource indexes whose number of times of query is less than a fourth threshold, and then store the obtained resource tags and resource indexes in the second database.
That is, the resource labels and the resource indexes of the network resources with less user access times, or the resource labels and the corresponding resource indexes with less queried times, may be transferred from the local storage space to the second database, so that the storage space of the first server may be saved, and the operation performance of the first server may be improved.
The third threshold and the fourth threshold may be preset, specifically may be set by a user, or may be set by default by the first server, which is not limited in the embodiment of the present invention.
For example, fig. 5 is a schematic diagram of another resource system provided in an embodiment of the present invention, and as shown in fig. 5, the resource system includes a first terminal, a first server, a third server, and a data center. The data center includes a first database and a second database. The first terminal can be respectively connected with the first server and the third server through a network, the first server can be connected with the data center through the network, and the third server can be connected with the first server through the network.
Specifically, the first terminal may upload and query the network resource through the first server. The third server is used for providing comment service of the network resource for the user, the first terminal sends a comment request of the network resource to the third server, and the first terminal can synchronize comment information of the network resource to the first server. The first server may store the network resources to a first database included in the data center, and may interact with a second database according to the method provided by the embodiment of the present invention. For example, the first server may correspondingly store the resource tags and the resource indexes of the network resources to the second database, or may periodically obtain synchronization data from the second database to update locally stored data, or may obtain the index sorting result of each resource tag from the second database to update the index sorting result of each locally stored resource tag according to the obtained index sorting result of each resource tag, and the like.
It should be noted that the devices shown in fig. 5 do not constitute a limitation of the resource system, and the resource system may include more or less devices than those shown, or some of the devices may be combined.
Step 402: the first server receives an inquiry request of a first terminal, wherein the inquiry request carries at least one resource label.
The resource label is used for indicating the category of the resource to be inquired, and the inquiry request is used for requesting to inquire the network resource corresponding to the at least one resource label.
Specifically, the query request may be triggered by the first terminal when a query operation of the user is detected, and the query operation may be an operation of confirming a query option triggered after the user inputs or selects the at least one resource tag in the query interface.
Step 403: and obtaining at least one target resource index from the resource indexes stored in the storage space of the first server, wherein the target resource index is a resource index corresponding to the at least one resource label.
That is, in the embodiment of the present invention, the resource index corresponding to the at least one resource tag may be directly queried from the local storage space of the first server, the query logic is simple, and the query logic is simple and can be implemented only by traversing the storage space of the first server, the time cost is low, an operation that the index databases corresponding to the at least one resource tag respectively need to be determined first and then the index resources are respectively obtained from the corresponding index databases in the related art is avoided, and the query efficiency is improved.
Specifically, obtaining at least one target resource index from the resource indexes stored in the storage space of the first server may include the following two implementation manners:
the first implementation mode comprises the following steps:and determining the resource index corresponding to the at least one resource label stored in the storage space of the first server as the at least one target resource index.
That is, all the resource indexes corresponding to the at least one resource tag that have been stored by the first server may be obtained as the at least one target resource index.
The resource index corresponding to the at least one resource tag may be a resource index corresponding to any resource tag in the at least one resource tag, or may be a resource index corresponding to all resource tags in the at least one resource tag. That is, the at least one target resource index may be a resource index of a network resource including any resource tag of the at least one resource tag, or may be a resource index of a network resource including all resource tags of the at least one resource tag.
The second implementation mode comprises the following steps:and acquiring a resource index corresponding to the at least one resource label meeting a preset condition from the resource indexes stored in the storage space of the first server, and taking the acquired resource index as the at least one target resource index.
The preset condition may be set according to actual needs, for example, the preset condition may be that a sorting condition or a storage time condition is satisfied.
In a possible embodiment, the first server may obtain an index sorting result corresponding to each resource tag in the at least one resource tag, and obtain resource indexes with sorting positions located in a preset number from the index sorting result corresponding to each resource tag; and determining the resource index obtained from the index sorting result corresponding to each resource label as the at least one target resource index.
And the index sorting result corresponding to each resource label is obtained by sorting the stored resource index corresponding to each resource label by the first server according to a preset sorting strategy. For example, the preset sorting strategy may be sorting by time, sorting by heat, sorting by number of scores, and the like.
The time sorting means the reverse sorting according to the sequence of the uploading time of the corresponding network resources, the hot sorting means the sorting according to the sequence of the accessed times of the corresponding network resources from large to small and/or the sorting according to the sequence of the queried times from large to small, and the ranking according to the good evaluation number means the ranking according to the sequence of the good evaluation numbers of the corresponding network resources from large to small.
The preset number may be preset, specifically may be set by a user as needed, or may be set by the first server as a default. For example, the predetermined number may be 10 or 20, etc.
By acquiring the resource indexes with the preset number of the sequencing positions, the number of the resource query results returned to the first terminal can be reduced, transmission resources are saved, the query accuracy can be improved, the effectiveness of the resource query results returned to the user is improved, the returned query results are all the query results generally required by the user, and the condition that some meaningless query results are returned to the user is avoided.
Step 404: and returning a resource query result to the first terminal based on the at least one target resource index.
Specifically, based on the at least one target resource index, returning the resource query result to the first terminal may include the following two implementation manners:
the first implementation mode comprises the following steps:and acquiring at least one network resource from the first database based on the at least one target resource index, and returning the at least one network resource to the terminal as the resource query result.
By returning the at least one network resource to the terminal, the timeliness of the terminal for acquiring the network resource can be improved, and the user experience is improved.
The second implementation mode comprises the following steps:and returning the at least one target resource index as the resource query result to the first terminal, and accessing the corresponding network resource by the first terminal based on the at least one target network resource index.
The at least one target network resource index can also carry key information of the corresponding network resource, so that a user can roughly judge whether the user needs the corresponding network resource according to the key information of the corresponding network resource, and then accesses the corresponding network resource through the obtained target resource index when the user needs the network resource. For example, the key information of the network resource is used to roughly describe the network resource, and the key information of the network resource may be a subject, a summary, a thumbnail, or the like of the network resource.
Specifically, after receiving the at least one target network resource index, the terminal may send an access request to the server when receiving an access operation to any target network resource index, where the access request carries the target network resource index. When the server receives the access request, the server may obtain the target network resource from the first database according to the target network resource index, and return the target network resource to the terminal.
Since the data size of the resource index is often much smaller than the data size of the network resource, the transmission resource of the first server and the first terminal can be saved and the respective processing performance can be improved by returning the at least one target resource index to the first terminal as the resource query result.
In the related art, a plurality of index databases are usually configured for the first server in advance, and each index database corresponds to one resource tag and is used for storing a resource index corresponding to one resource tag. After the first server stores the network resource in the first database, the resource index of the network resource needs to be stored in the index database corresponding to the resource tag of the network resource, that is, the resource index needs to be written in the index database. Moreover, when the number of resource tags of the network resource is large, the resource index needs to be stored in the index database corresponding to each resource tag, that is, the resource index needs to be written into a plurality of index databases, the number of writing times involved in the storage process is large, and the success rate of resource index storage cannot be ensured because the problem of writing errors or data loss is easy to occur in the data writing process.
In addition, in order to facilitate user screening, the resource index corresponding to each resource tag is also generally sorted according to a plurality of sorting manners, such as sorting according to uploading time, queried times, accessed times or comment numbers. When the resource index corresponding to one resource label has multiple sorting modes, multiple index databases are configured for the resource label, and each index database is used for storing the resource index corresponding to the resource label according to one sorting mode.
Fig. 6 is a schematic diagram of a resource system provided in the related art, as shown in fig. 6, the system includes a terminal 100, a server 200, a resource database 300, and a plurality of index databases, where the server 200 may be connected to the terminal 100, the network resource database 300, and the plurality of index databases, and assuming that a network resource uploaded by the terminal 100 includes a tag a and a tag B, a resource index corresponding to the tag a has two sorting modes, i.e., a sorting mode 1 and a sorting mode 2, a resource index corresponding to the tag B has a sorting mode 3, therefore, the index of the network resource needs to be stored in the index database 410 for storing the index resource corresponding to the tag a according to the sorting mode 1, the index database 420 for storing the index resource corresponding to the tag a according to the sorting mode 2, and the index database 430 for storing the index resource corresponding to the tag B according to the sorting mode 3.
As can be seen from the above, as the resource tags of the network resources and the sorting manners of the corresponding network resources increase, the writing amount of the resource index in the index database also increases, for example, if one network resource has 5 resource tags and each resource tag has 3 sorting manners, the resource index corresponding to the resource tag needs to be written into different index databases 15 times in total, the number of writing times involved is large, the maintenance cost is high, and data loss easily occurs in the writing process.
In the embodiment of the invention, the resource identifier and the resource index are directly and correspondingly stored in the storage space of the first server, and the resource index is directly inquired from the storage space of the first server according to the inquiry request, so that the problems that the resource label in the index database has more writing amount, the data is easy to lose in the writing process and the maintenance cost is high in the related technology are solved.
In the embodiment of the invention, for any server in the resource system, after any network resource is stored in the first database, the first server can directly and correspondingly store the resource tag and the resource index of the network resource in the local storage space, after receiving the query request, the first server directly obtains the resource index corresponding to the resource tag from the resource index stored in the local storage space, and returns the query result based on the obtained resource index.
Next, taking the resource system including the first terminal, the first server, the first database, the second database and the second server as an example, a process of storing the network resource uploaded by the user through the first terminal is described, as shown in fig. 7, the process of storing the network resource may include the following steps 701 and 709:
step 701: the first terminal sends the network resource to the first server.
The first terminal may send the network resource to the first server according to the sharing operation of the user, that is, the network resource is a network resource shared by the user on the resource system.
Step 702: the first server stores the network resource to a first database.
Specifically, the first server may determine a resource index of the network resource, store the network resource in the first database based on the resource index, and subsequently obtain the network resource from the first database based on the resource index.
Step 703: the first database sends the stored result to the first server.
The storage result refers to a storage result of the first database for the network resource, and is used for indicating whether the first database successfully stores the network resource.
Step 704: the first server correspondingly stores the index data in the local storage space.
The index data refers to a resource label and a resource index of the network resource.
Specifically, the index data may be stored in a local memory or a local hard disk correspondingly.
Step 705: and the first server correspondingly stores the index data to a second database.
That is, the first server may synchronize the resource tag and the resource index of the received network resource to the second database.
Step 706: the second database returns the storage result to the first server.
The storage result refers to a storage result of the second database for the index data, and is used for indicating whether the second database successfully stores the index data.
Step 707: the first server sends the index data to the second server.
That is, the first server may synchronize the resource tag and the resource index of the received network resource to other servers in the resource system.
Step 708: and the second server correspondingly stores the index data in the local storage space and returns a storage result to the first server.
Similarly, the second server may store the index data in a local memory or a local hard disk correspondingly. The storage result refers to a storage result of the second server for the index data, and is used for indicating whether the second server successfully stores the index data.
Step 709: the first server returns the storage result of the network resource to the client.
The storage result is used to indicate the storage result corresponding to each storage process executed by the first server on the network resource, or may only indicate the storage result of the first database on the network resource, which is not limited in the embodiment of the present invention.
Fig. 8 is a schematic structural diagram of a resource query apparatus according to an embodiment of the present invention, which is applied to a first server in a resource system, as shown in fig. 8, the apparatus includes:
a first storage module 801, configured to store any network resource in a first database, and then correspondingly store a resource tag and a resource index of the network resource in a storage space of a first server, where the first database is used to store a network resource issued in the resource system;
a receiving module 802, configured to receive an inquiry request of a first terminal, where the inquiry request carries at least one resource tag, and the resource tag is used to indicate a category to which a resource to be inquired belongs;
a first obtaining module 803, configured to obtain at least one target resource index from resource indexes already stored in a storage space of the first server, where the target resource index is a resource index corresponding to at least one resource tag;
a first sending module 804, configured to return a resource query result to the first terminal based on at least one target resource index.
Optionally, the first storage module is configured to:
and correspondingly storing the resource label and the resource index of the network resource into a target directory in a storage space of the server according to the resource label of the network resource, wherein the target directory is a directory corresponding to the resource label.
Optionally, the first obtaining module includes:
the first obtaining unit is configured to obtain an index ordering result corresponding to each resource tag in at least one resource tag, where the index ordering result corresponding to each resource tag is obtained by the first server ordering the stored resource index corresponding to each resource tag according to a preset ordering policy;
the second obtaining unit is used for obtaining resource indexes with the sequencing positions in the front preset number from the index sequencing result corresponding to each resource label;
and the determining unit is used for determining the resource index acquired from the index sorting result corresponding to each resource label as at least one target resource index.
Optionally, the first sending module 804 is configured to:
based on at least one target resource index, at least one network resource is obtained from the first database, and the at least one network resource is returned to the terminal as the resource query result;
or,
and returning at least one target resource index serving as the resource query result to the first terminal, and accessing the corresponding network resource by the first terminal based on the at least one target network resource index.
Optionally, the apparatus further comprises:
the second storage module is used for correspondingly storing the resource labels and the resource indexes of the network resources to a second database, and the second database is used for storing the resource labels and the resource indexes of the network resources issued in the resource system;
a second obtaining module, configured to obtain, from the second database, a resource tag and a resource index that are correspondingly stored by a second server, where the second server is a server other than the first server in the resource system;
and the updating module is used for updating the resource labels and the resource indexes stored in the storage space of the first server based on the acquired resource labels and the acquired resource indexes.
Optionally, the apparatus further comprises:
a third obtaining module, configured to obtain, from a second database, a resource tag and a resource index of a network resource whose number of times of access is greater than a first threshold, and/or a resource tag and a corresponding resource index whose number of times of query is greater than a second threshold, where the second database is configured to store the resource tag and the resource index of the network resource issued in the resource system;
and the third storage module is used for correspondingly storing the acquired resource label and the resource index into the storage space of the first server.
Optionally, the apparatus further comprises:
a fourth obtaining module, configured to obtain, from the resource tags and resource indexes stored in the storage space of the first server, the resource tags and resource indexes of the network resources whose number of times of access is smaller than a third threshold, and/or the resource tags whose number of times of query is smaller than a fourth threshold and the corresponding resource indexes;
and the fourth storage module is used for correspondingly storing the acquired resource labels and resource indexes in a second database, and the second database is used for storing the resource labels and resource indexes of the network resources released in the resource system.
Optionally, the apparatus further comprises:
and the second sending module is used for sending the resource label and the resource index of the network resource to a second server, and the second server correspondingly stores the resource label and the resource index of the network resource into a storage space of the second server, wherein the second server refers to other servers except the first server in the resource system.
Optionally, the apparatus further includes a fifth obtaining module, where the fifth obtaining module is configured to:
receiving the network resource and a resource label of the network resource sent by the second terminal, wherein the resource label of the network resource is input for the network resource in the second terminal by a user;
or;
and receiving the network resource sent by the second terminal, extracting keywords from the topic of the network resource, and determining the extracted keywords as the resource label of the network resource.
In the embodiment of the invention, for any server in the resource system, after any network resource is stored in the first database, the first server can directly and correspondingly store the resource tag and the resource index of the network resource in the local storage space, after receiving the query request, the first server directly obtains the resource index corresponding to the resource tag from the resource index stored in the local storage space, and returns the query result based on the obtained resource index.
It should be noted that: in the resource query device provided in the foregoing embodiment, when querying a network resource, only the division of the functional modules is described as an example, and in practical applications, the function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the resource query device and the resource query method provided by the above embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiments and are not described herein again.
Fig. 9 is a schematic structural diagram of a terminal 900 according to an embodiment of the present invention. The terminal 900 may be: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III, motion video Experts compression standard Audio Layer 3), an MP4 player (Moving Picture Experts Group Audio Layer IV, motion video Experts compression standard Audio Layer 4), a notebook computer, or a desktop computer. Terminal 900 may also be referred to by other names such as user equipment, portable terminals, laptop terminals, desktop terminals, and the like.
In general, terminal 900 includes: a processor 901 and a memory 902.
Processor 901 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and so forth. The processor 901 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 901 may also include a main processor and a coprocessor, where the main processor is a processor for Processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 901 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed on the display screen. In some embodiments, the processor 901 may further include an AI (Artificial Intelligence) processor for processing computing operations related to machine learning.
Memory 902 may include one or more computer-readable storage media, which may be non-transitory. The memory 902 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in memory 902 is used to store at least one instruction for execution by processor 901 to implement the resource query method provided by the method embodiments herein.
In some embodiments, terminal 900 can also optionally include: a peripheral interface 903 and at least one peripheral. The processor 901, memory 902, and peripheral interface 903 may be connected by buses or signal lines. Various peripheral devices may be connected to the peripheral interface 903 via a bus, signal line, or circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 904, a touch display screen 905, a camera 906, an audio circuit 907, a positioning component 908, and a power supply 909.
The peripheral interface 903 may be used to connect at least one peripheral related to I/O (Input/Output) to the processor 901 and the memory 902. In some embodiments, the processor 901, memory 902, and peripheral interface 903 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 901, the memory 902 and the peripheral interface 903 may be implemented on a separate chip or circuit board, which is not limited by this embodiment.
The Radio Frequency circuit 904 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals. The radio frequency circuitry 904 communicates with communication networks and other communication devices via electromagnetic signals. The radio frequency circuit 904 converts an electrical signal into an electromagnetic signal to transmit, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 904 comprises: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so forth. The radio frequency circuit 904 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocols include, but are not limited to: metropolitan area networks, various generation mobile communication networks (2G, 3G, 4G, and 5G), Wireless local area networks, and/or WiFi (Wireless Fidelity) networks. In some embodiments, the radio frequency circuit 904 may also include NFC (Near Field Communication) related circuits, which are not limited in this application.
The display screen 905 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display screen 905 is a touch display screen, the display screen 905 also has the ability to capture touch signals on or over the surface of the display screen 905. The touch signal may be input to the processor 901 as a control signal for processing. At this point, the display 905 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display 905 may be one, providing the front panel of the terminal 900; in other embodiments, the number of the display panels 905 may be at least two, and each of the display panels is disposed on a different surface of the terminal 900 or is in a foldable design; in still other embodiments, the display 905 may be a flexible display disposed on a curved surface or a folded surface of the terminal 900. Even more, the display screen 905 may be arranged in a non-rectangular irregular figure, i.e. a shaped screen. The Display panel 905 can be made of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), and other materials.
The camera assembly 906 is used to capture images or video. Optionally, camera assembly 906 includes a front camera and a rear camera. Generally, a front camera is disposed at a front panel of the terminal, and a rear camera is disposed at a rear surface of the terminal. In some embodiments, the number of the rear cameras is at least two, and each rear camera is any one of a main camera, a depth-of-field camera, a wide-angle camera and a telephoto camera, so that the main camera and the depth-of-field camera are fused to realize a background blurring function, and the main camera and the wide-angle camera are fused to realize panoramic shooting and VR (Virtual Reality) shooting functions or other fusion shooting functions. In some embodiments, camera assembly 906 may also include a flash. The flash lamp can be a monochrome temperature flash lamp or a bicolor temperature flash lamp. The double-color-temperature flash lamp is a combination of a warm-light flash lamp and a cold-light flash lamp, and can be used for light compensation at different color temperatures.
Audio circuit 907 may include a microphone and a speaker. The microphone is used for collecting sound waves of a user and the environment, converting the sound waves into electric signals, and inputting the electric signals to the processor 901 for processing, or inputting the electric signals to the radio frequency circuit 904 for realizing voice communication. For stereo sound acquisition or noise reduction purposes, the microphones may be multiple and disposed at different locations of the terminal 900. The microphone may also be an array microphone or an omni-directional pick-up microphone. The speaker is used to convert electrical signals from the processor 901 or the radio frequency circuit 904 into sound waves. The loudspeaker can be a traditional film loudspeaker or a piezoelectric ceramic loudspeaker. When the speaker is a piezoelectric ceramic speaker, the speaker can be used for purposes such as converting an electric signal into a sound wave audible to a human being, or converting an electric signal into a sound wave inaudible to a human being to measure a distance. In some embodiments, audio circuit 907 may also include a headphone jack.
The positioning component 908 is used to locate the current geographic Location of the terminal 900 for navigation or LBS (Location Based Service). The Positioning component 908 may be a Positioning component based on the GPS (Global Positioning System) in the united states, the beidou System in china, the graves System in russia, or the galileo System in the european union.
Power supply 909 is used to provide power to the various components in terminal 900. The power source 909 may be alternating current, direct current, disposable or rechargeable. When power source 909 comprises a rechargeable battery, the rechargeable battery may support wired or wireless charging. The rechargeable battery may also be used to support fast charge technology.
In some embodiments, terminal 900 can also include one or more sensors 910. The one or more sensors 910 include, but are not limited to: acceleration sensor 911, gyro sensor 912, pressure sensor 913, fingerprint sensor 914, optical sensor 915, and proximity sensor 916.
The acceleration sensor 911 can detect the magnitude of acceleration in three coordinate axes of the coordinate system established with the terminal 900. For example, the acceleration sensor 911 may be used to detect the components of the gravitational acceleration in three coordinate axes. The processor 901 can control the touch display 905 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 911. The acceleration sensor 911 may also be used for acquisition of motion data of a game or a user.
The gyro sensor 912 may detect a body direction and a rotation angle of the terminal 900, and the gyro sensor 912 may cooperate with the acceleration sensor 911 to acquire a 3D motion of the user on the terminal 900. The processor 901 can implement the following functions according to the data collected by the gyro sensor 912: motion sensing (such as changing the UI according to a user's tilting operation), image stabilization at the time of photographing, game control, and inertial navigation.
Pressure sensors 913 may be disposed on the side bezel of terminal 900 and/or underneath touch display 905. When the pressure sensor 913 is disposed on the side frame of the terminal 900, the user's holding signal of the terminal 900 may be detected, and the processor 901 performs left-right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 913. When the pressure sensor 913 is disposed at a lower layer of the touch display 905, the processor 901 controls the operability control on the UI interface according to the pressure operation of the user on the touch display 905. The operability control comprises at least one of a button control, a scroll bar control, an icon control and a menu control.
The fingerprint sensor 914 is used for collecting a fingerprint of the user, and the processor 901 identifies the user according to the fingerprint collected by the fingerprint sensor 914, or the fingerprint sensor 914 identifies the user according to the collected fingerprint. Upon recognizing that the user's identity is a trusted identity, processor 901 authorizes the user to perform relevant sensitive operations including unlocking the screen, viewing encrypted information, downloading software, paying, and changing settings, etc. The fingerprint sensor 914 may be disposed on the front, back, or side of the terminal 900. When a physical key or vendor Logo is provided on the terminal 900, the fingerprint sensor 914 may be integrated with the physical key or vendor Logo.
The optical sensor 915 is used to collect ambient light intensity. In one embodiment, the processor 901 may control the display brightness of the touch display 905 based on the ambient light intensity collected by the optical sensor 915. Specifically, when the ambient light intensity is high, the display brightness of the touch display screen 905 is increased; when the ambient light intensity is low, the display brightness of the touch display screen 905 is turned down. In another embodiment, the processor 901 can also dynamically adjust the shooting parameters of the camera assembly 906 according to the ambient light intensity collected by the optical sensor 915.
Proximity sensor 916, also known as a distance sensor, is typically disposed on the front panel of terminal 900. The proximity sensor 916 is used to collect the distance between the user and the front face of the terminal 900. In one embodiment, when the proximity sensor 916 detects that the distance between the user and the front face of the terminal 900 gradually decreases, the processor 901 controls the touch display 905 to switch from the bright screen state to the dark screen state; when the proximity sensor 916 detects that the distance between the user and the front surface of the terminal 900 gradually becomes larger, the processor 901 controls the touch display 905 to switch from the breath screen state to the bright screen state.
Those skilled in the art will appreciate that the configuration shown in fig. 9 does not constitute a limitation of terminal 900, and may include more or fewer components than those shown, or may combine certain components, or may employ a different arrangement of components.
Fig. 10 is a schematic structural diagram of a server 1000 according to an embodiment of the present invention, where the server 1000 may generate a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 1001 and one or more memories 1002, where the memory 1002 stores at least one instruction, and the at least one instruction is loaded and executed by the processors 1001 to implement the application power consumption monitoring method provided by each method embodiment. Of course, the server 1000 may also have components such as a wired or wireless network interface, a keyboard, and an input/output interface, so as to perform input and output, and the server 1000 may also include other components for implementing the functions of the device, which are not described herein again.
In an exemplary embodiment, a computer-readable storage medium, such as a memory, including instructions executable by a processor in the terminal or the server to perform the resource query method in the above embodiments is also provided. For example, the computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (13)

1. A resource query method applied to a first server in a resource system, the method comprising:
after any network resource is stored in a first database, correspondingly storing a resource label and a resource index of the network resource into a storage space of the first server, wherein the first database is used for storing the network resource issued in the resource system;
receiving a query request of a first terminal, wherein the query request carries at least one resource label, and the resource label is used for indicating the category of a resource to be queried;
acquiring at least one target resource index from resource indexes stored in a storage space of the first server, wherein the target resource index is a resource index corresponding to the at least one resource label;
returning a resource query result to the first terminal based on the at least one target resource index;
correspondingly storing the resource label and the resource index of the network resource into the storage space of the first server, including:
and correspondingly storing the resource label and the resource index of the network resource into a target directory in a storage space of the first server according to the resource label of the network resource, wherein the target directory is a directory corresponding to the resource label.
2. The method of claim 1, wherein the obtaining at least one target resource index from the resource indexes already stored in the storage space of the first server comprises:
obtaining an index sorting result corresponding to each resource tag in the at least one resource tag, where the index sorting result corresponding to each resource tag is obtained by sorting, by the first server, the stored resource index corresponding to each resource tag according to a preset sorting strategy;
acquiring resource indexes with the sequencing positions in the preset number from the index sequencing result corresponding to each resource label;
and determining the resource index obtained from the index sorting result corresponding to each resource label as the at least one target resource index.
3. The method of claim 1, wherein the returning resource query results to the first terminal based on the at least one target resource index comprises:
based on the at least one target resource index, acquiring at least one network resource from the first database, and returning the at least one network resource to the terminal as the resource query result;
or,
and returning the at least one target resource index as the resource query result to the first terminal, and accessing the corresponding network resource by the first terminal based on the at least one target network resource index.
4. The method of any of claims 1-3, wherein the method further comprises:
correspondingly storing the resource labels and the resource indexes of the network resources to a second database, wherein the second database is used for storing the resource labels and the resource indexes of the network resources issued in the resource system;
acquiring a resource label and a resource index which are correspondingly stored by a second server from the second database, wherein the second server refers to other servers except the first server in the resource system;
and updating the resource labels and the resource indexes stored in the storage space of the first server based on the acquired resource labels and resource indexes.
5. The method of any of claims 1-3, wherein the method further comprises:
acquiring resource tags and resource indexes of network resources with the accessed times larger than a first threshold value and/or resource tags and corresponding resource indexes with the queried times larger than a second threshold value from a second database, wherein the second database is used for storing the resource tags and the resource indexes of the network resources released in the resource system;
and correspondingly storing the acquired resource label and the resource index into the storage space of the first server.
6. The method according to any one of claims 1-3, wherein after storing the resource tag and the resource index correspondence of the network resource in the storage space of the first server, further comprising:
acquiring resource labels and resource indexes of network resources with the accessed times smaller than a third threshold value from the resource labels and resource indexes stored in the storage space of the first server, and/or acquiring resource labels and corresponding resource indexes with the queried times smaller than a fourth threshold value;
and correspondingly storing the acquired resource label and the resource index in a second database, wherein the second database is used for storing the resource label and the resource index of the network resource released in the resource system.
7. The method according to any one of claims 1-3, wherein after storing the resource tag and the resource index correspondence of the network resource in the storage space of the first server, further comprising:
and sending the resource label and the resource index of the network resource to a second server, and correspondingly storing the resource label and the resource index of the network resource into a storage space of the second server by the second server, wherein the second server is other servers except the first server in the resource system.
8. The method of any of claims 1-3, wherein prior to storing the resource tag and resource index correspondence for the network resource in the storage space of the first server, further comprising:
receiving the network resource and a resource label of the network resource sent by a second terminal, wherein the resource label of the network resource is input for the network resource in the second terminal by a user;
or;
receiving the network resource sent by the second terminal, extracting keywords from the theme of the network resource, and determining the extracted keywords as the resource label of the network resource.
9. A resource query apparatus, applied to a first server in a resource system, the apparatus comprising:
the first storage module is used for correspondingly storing the resource labels and the resource indexes of the network resources into the storage space of the first server after any network resource is stored into a first database, and the first database is used for storing the network resources issued in the resource system;
a receiving module, configured to receive an inquiry request of a first terminal, where the inquiry request carries at least one resource tag, and the resource tag is used to indicate a category to which a resource to be inquired belongs;
a first obtaining module, configured to obtain at least one target resource index from resource indexes stored in a storage space of the first server, where the target resource index is a resource index corresponding to the at least one resource tag;
a first sending module, configured to return a resource query result to the first terminal based on the at least one target resource index;
the first storage module is configured to:
and correspondingly storing the resource label and the resource index of the network resource into a target directory in a storage space of the server according to the resource label of the network resource, wherein the target directory is a directory corresponding to the resource label.
10. The apparatus of claim 9, wherein the first obtaining module comprises:
a first obtaining unit, configured to obtain an index ordering result corresponding to each resource tag in the at least one resource tag, where the index ordering result corresponding to each resource tag is obtained by the first server ordering, according to a preset ordering policy, the stored resource index corresponding to each resource tag;
a second obtaining unit, configured to obtain resource indexes with preset numbers of top sorting positions from the index sorting result corresponding to each resource tag;
a determining unit, configured to determine the resource index obtained from the index sorting result corresponding to each resource tag as the at least one target resource index.
11. The apparatus of any of claims 9-10, wherein the apparatus further comprises:
the second storage module is used for correspondingly storing the resource labels and the resource indexes of the network resources to a second database, and the second database is used for storing the resource labels and the resource indexes of the network resources issued in the resource system;
a second obtaining module, configured to obtain, from the second database, a resource tag and a resource index that are correspondingly stored by a second server, where the second server is a server other than the first server in the resource system;
and the updating module is used for updating the resource labels and the resource indexes stored in the storage space of the first server based on the acquired resource labels and the acquired resource indexes.
12. A server, comprising a processor and a memory, wherein the memory has stored therein at least one instruction, at least one program, set of codes, or set of instructions, which is loaded and executed by the processor to implement the resource query method of any one of claims 1-8.
13. A computer readable storage medium having stored therein at least one instruction, at least one program, a set of codes, or a set of instructions, which is loaded and executed by a processor to implement the resource query method as claimed in any one of claims 1-8.
CN201810448602.1A 2018-05-11 2018-05-11 Resource query method and device Active CN108717432B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810448602.1A CN108717432B (en) 2018-05-11 2018-05-11 Resource query method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810448602.1A CN108717432B (en) 2018-05-11 2018-05-11 Resource query method and device

Publications (2)

Publication Number Publication Date
CN108717432A CN108717432A (en) 2018-10-30
CN108717432B true CN108717432B (en) 2022-02-18

Family

ID=63899787

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810448602.1A Active CN108717432B (en) 2018-05-11 2018-05-11 Resource query method and device

Country Status (1)

Country Link
CN (1) CN108717432B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110110007A (en) * 2019-04-15 2019-08-09 平安普惠企业管理有限公司 Data managing method and Related product
CN110134698A (en) * 2019-04-15 2019-08-16 平安普惠企业管理有限公司 Data managing method and Related product
CN110119396B (en) * 2019-04-15 2023-10-20 北京铠悦科技有限公司 Data management method and related product
CN110119427B (en) * 2019-04-15 2024-05-28 北京神州数码云科信息技术有限公司 Data management method and related product
CN110110006A (en) * 2019-04-15 2019-08-09 平安普惠企业管理有限公司 Data managing method and Related product
CN110659283A (en) * 2019-08-15 2020-01-07 中国平安财产保险股份有限公司 Data label processing method and device, computer equipment and storage medium
CN110717110B (en) * 2019-10-12 2022-04-22 北京达佳互联信息技术有限公司 Multimedia resource filtering method and device, electronic equipment and storage medium
CN110851431B (en) * 2019-10-30 2022-12-20 中盈优创资讯科技有限公司 Data processing method and device for data center station
CN114138387A (en) * 2021-11-25 2022-03-04 北京声智科技有限公司 List data loading method and device, electronic equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101123578A (en) * 2007-09-01 2008-02-13 腾讯科技(深圳)有限公司 A method and system for improving access speed of network resource
CN101753559A (en) * 2009-12-17 2010-06-23 深圳创维-Rgb电子有限公司 Network resource obtaining system and network resource list obtaining method
CN104182483A (en) * 2014-08-07 2014-12-03 北京有名信实科技有限公司 Social network based service index database establishment method and service search method
CN104915449A (en) * 2015-06-30 2015-09-16 河海大学 Faceted search system and method based on water conservancy object classification labels
CN106096050A (en) * 2016-06-29 2016-11-09 乐视控股(北京)有限公司 A kind of method and apparatus of video contents search
CN106407250A (en) * 2015-07-28 2017-02-15 阿里巴巴集团控股有限公司 Information query method, device and system, server and client side
CN106489144A (en) * 2014-04-28 2017-03-08 康维达无线有限责任公司 Search engine optimization for Resource TOC

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110016085A1 (en) * 2009-07-16 2011-01-20 Netapp, Inc. Method and system for maintaining multiple inode containers in a storage server

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101123578A (en) * 2007-09-01 2008-02-13 腾讯科技(深圳)有限公司 A method and system for improving access speed of network resource
CN101753559A (en) * 2009-12-17 2010-06-23 深圳创维-Rgb电子有限公司 Network resource obtaining system and network resource list obtaining method
CN106489144A (en) * 2014-04-28 2017-03-08 康维达无线有限责任公司 Search engine optimization for Resource TOC
CN104182483A (en) * 2014-08-07 2014-12-03 北京有名信实科技有限公司 Social network based service index database establishment method and service search method
CN104915449A (en) * 2015-06-30 2015-09-16 河海大学 Faceted search system and method based on water conservancy object classification labels
CN106407250A (en) * 2015-07-28 2017-02-15 阿里巴巴集团控股有限公司 Information query method, device and system, server and client side
CN106096050A (en) * 2016-06-29 2016-11-09 乐视控股(北京)有限公司 A kind of method and apparatus of video contents search

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
《An ID-tree index strategy for supporting similarity searches in information filtering systems》;Ye-In Chang等;《IEEE》;20101111;第1-6页 *
《云存储中的密文排序检索技术研究》;王朗;《中国优秀硕士学位论文全文数据库 (信息科技辑)》;20160430;第I137-46页 *

Also Published As

Publication number Publication date
CN108717432A (en) 2018-10-30

Similar Documents

Publication Publication Date Title
CN108717432B (en) Resource query method and device
CN110674022B (en) Behavior data acquisition method and device and storage medium
CN110213153B (en) Display method, acquisition method, device, terminal and storage medium of unread messages
CN110248236B (en) Video playing method, device, terminal and storage medium
CN113411680B (en) Multimedia resource playing method, device, terminal and storage medium
CN111694834A (en) Method, device and equipment for putting picture data into storage and readable storage medium
CN110147503B (en) Information issuing method and device, computer equipment and storage medium
CN111782950B (en) Sample data set acquisition method, device, equipment and storage medium
CN109902089B (en) Query method and device using heterogeneous index, electronic equipment and medium
CN112052354A (en) Video recommendation method, video display method and device and computer equipment
CN113032587B (en) Multimedia information recommendation method, system, device, terminal and server
CN113987326B (en) Resource recommendation method and device, computer equipment and medium
CN109547847B (en) Method and device for adding video information and computer readable storage medium
CN110471614B (en) Method for storing data, method and device for detecting terminal
CN110149408B (en) Service data display method and device, terminal and server
CN114168369A (en) Log display method, device, equipment and storage medium
CN112100528A (en) Method, device, equipment and medium for training search result scoring model
CN111563201A (en) Content pushing method, device, server and storage medium
CN112364244B (en) Multimedia data recommendation method, device, server and storage medium
CN109101158A (en) Import the method, apparatus and storage medium of list of songs
CN115134316B (en) Topic display method, device, terminal and storage medium
CN110808985B (en) Song on-demand method, device, terminal, server and storage medium
CN110717110B (en) Multimedia resource filtering method and device, electronic equipment and storage medium
CN110321332B (en) Multimedia file recovery method, device, terminal and storage medium
CN114817709A (en) Sorting method, device, equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant