Data query method and device

By using abstract metadata instead of abstracts for caching in the search engine, the problem of wasted memory space caused by the multi-level cache structure is solved, more efficient query and storage are achieved, and the performance of the search engine is optimized.

CN118733702APending Publication Date: 2024-10-01HUAWEI TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310373642.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-31
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

During the query process of existing search engines, the multi-level cache structure leads to a waste of memory storage space, especially the repeated storage of abstracts, which causes unnecessary space occupation.

Method used

Abstract metadata is used instead of the abstract for caching, and the metadata is used to indicate the location of the abstract in the original document, thereby generating query results, reducing the amount of cached data, saving memory space, and optimizing the query hit rate and storage efficiency through the fusion of document caching.

Benefits of technology

It effectively reduces the amount of cached data, saves memory storage space, improves query efficiency and storage efficiency, and optimizes search engine performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118733702A_ABST
    Figure CN118733702A_ABST
Patent Text Reader

Abstract

The invention provides a data query method and device, and belongs to the technical field of search. The method comprises the steps of obtaining a query statement; according to the query statement, first abstract metadata corresponding to a to-be-queried abstract is obtained in a cache, and the first abstract metadata is used for indicating the position of the to-be-queried abstract in a first original document; generating the abstract to be queried according to the first abstract metadata and the first original document; and generating a query result according to the abstract to be queried. According to the invention, the storage space of the memory can be saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of search technology, and in particular to a method and device for data query. Background Art

[0002] In the era of big data, search engines have become an important tool for people to query and obtain the data they need from massive data.

[0003] In current search engines, in order to improve search efficiency, multiple levels of cache are usually set up, including query result cache, summary cache and document cache. When the search engine performs a query based on a query statement, it first searches in the query result cache. If the desired query result is not found, it searches in the summary cache. If it still does not find a hit, it searches in the document cache. If it still does not find a hit, it searches in the hard disk, generates a summary based on the queried document, generates a query result based on the summary, and returns it to the user.

[0004] In the above search engine, a summary may be stored in the query result cache, summary cache and document cache at the same time. Obviously, this will cause a certain waste of memory storage space. Summary of the invention

[0005] The present disclosure provides a data query method and device, which can save memory space. The corresponding technical solutions are as follows:

[0006] In a first aspect, a method for data query is provided, the method comprising: obtaining a query statement, and obtaining first summary metadata corresponding to a summary to be queried in a cache according to the query statement, wherein the first summary metadata is used to indicate a position of the summary to be queried in a first original document. Then, according to the first summary metadata and the first original document, a summary to be queried is generated, and according to the summary to be queried, a query result is generated.

[0007] In the solution provided by the present disclosure, the summary is no longer cached separately, but the summary metadata is cached, and the summary metadata is used to indicate the location of the summary in the original document. In this way, when performing data query, if you want to query a certain summary, you can first query the summary metadata in the cache, and then generate the summary based on the summary metadata and the original document, and then generate the query result. Because the data volume of the summary metadata is smaller than the data volume of the summary itself, the solution provided by the present disclosure can effectively reduce the cache data volume, thereby saving memory storage space.

[0008] In a possible implementation, a fusion document is also proposed, and the cache may be a fusion document cache. Accordingly, the process of obtaining the first summary metadata corresponding to the summary to be queried in the cache may be as follows:

[0009] In the fusion document cache, it is queried whether a first fusion document including the first original document is stored. In the fusion document cache, if the first fusion document is stored, it is queried whether the first summary metadata is included in the first fusion document. In the first fusion document, if the first summary metadata is included, the first summary metadata is obtained in the first fusion document.

[0010] In the solution provided by the present disclosure, the fused document includes the original document and the summary metadata of the summary generated based on the original document, so that the summary cache can be set separately, and the original document cache in the search engine can be used as the fused document cache. In this way, memory can be further saved.

[0011] In a possible implementation, when a fused document is used, if the first fused document does not contain the first summary metadata, a summary to be queried is generated according to the first original document and the query statement.

[0012] In a possible implementation, when the first fused document in the fused document cache does not contain the first summary metadata, the first summary metadata may be generated according to the position of the summary to be queried in the first original document, and the first summary metadata may be added to the first fused document. In this way, the first fused document stored in the fused document cache will contain the first summary metadata, thereby improving the subsequent query hit rate of the first summary metadata.

[0013] In a possible implementation, when a fused document is used, if the first fused document is not stored in the fused document cache, then a query is made in the hard disk whether the first fused document is stored. If the first fused document is stored in the hard disk, then a query is made in the first fused document whether the first summary metadata is included. If the first summary metadata is included in the first fused document, then the first summary metadata is obtained in the first fused document.

[0014] In a possible implementation, if the first fused document is not stored in the hard disk, a summary to be queried is generated according to the first original document and the query statement.

[0015] In a possible implementation, when the first fused document is not stored in the hard disk, first summary metadata may be generated according to the position of the summary to be queried in the first original document, and a second fused document may be generated according to the first summary metadata and the first original document.

[0016] In a possible implementation, after the second fused document is generated, the fused document cache may be updated using the second fused document, so that the fused document in the fused document cache is a document that the user is more likely to access. Accordingly, the update process may be as follows:

[0017] If it is determined that the free storage space of the fusion document cache is greater than the data volume of the second fusion document, the second fusion document is stored in the fusion document cache. If it is determined that the free storage space of the fusion document cache is not greater than the data volume of the second fusion document, the cache benefits of each fusion document stored in the fusion document cache are determined, and the cache benefit of the second fusion document is determined. If the cache benefit of the second fusion document is greater than the minimum cache benefit among the cache benefits of each fusion document, the fusion document corresponding to the minimum cache benefit is deleted from the fusion document cache, and the second fusion document is stored in the fusion document cache.

[0018] In a possible implementation, the calculation of cache revenue can comprehensively consider the situation of the original document being requested, the situation of the original document generating a summary, and the situation of the fused document itself, so that the fused document stored in the fused document cache is not only more likely to be requested by the user, but also the length of the document itself is not too long. Accordingly, the method for determining the cache revenue of the second fused document can be as follows:

[0019] Determine a first number of summaries generated based on the original document in the second fused document, determine the document length of the second fused document, determine the time when the original document in the second fused document was last requested, determine the number of times the original document in the second fused document is requested, and calculate the cache benefit of the second fused document based on the first number, the document length, the time and the number.

[0020] In a second aspect, a data query device is provided, the device comprising:

[0021] The acquisition module is used to obtain the query statement;

[0022] A query module, configured to obtain, in a cache, first summary metadata corresponding to the summary to be queried according to the query statement, wherein the first summary metadata is used to indicate a position of the summary to be queried in the first original document;

[0023] A generating module is used to generate the summary to be queried according to the first metadata and the first original document; and to generate a query result according to the summary to be queried.

[0024] In a possible implementation, the query module is used to:

[0025] In the fused document cache, query whether a first fused document including the first original document is stored;

[0026] If the first fused document is stored in the fused document cache, querying whether the first summary metadata is included in the first fused document;

[0027] If the first fused document includes the first summary metadata, the first summary metadata is acquired from the first fused document.

[0028] In a possible implementation, the query module is further used to:

[0029] If the first summary metadata is not included in the first fused document, the summary to be queried is generated according to the first original document and the query statement.

[0030] In a possible implementation, the query module is further used to:

[0031] generating the first summary metadata according to the position of the summary to be queried in the first original document;

[0032] The first summary metadata is added to the first fused document.

[0033] In a possible implementation, the query module is further used to:

[0034] If the first fused document is not stored in the fused document cache, querying whether the first fused document is stored in the hard disk;

[0035] If the first fused document is stored in the hard disk, querying whether the first fused document contains the first summary metadata;

[0036] If the first fused document includes the first summary metadata, the first summary metadata is acquired from the first fused document.

[0037] In a possible implementation, the query module is further used to:

[0038] If the first fused document is not stored in the hard disk, the summary to be queried is generated according to the first original document and the query statement.

[0039] In a possible implementation, the query module is further used to:

[0040] generating the first summary metadata according to the position of the summary to be queried in the first original document;

[0041] A second fused document is generated according to the first summary metadata and the first original document.

[0042] In a possible implementation manner, the device further includes an updating module, configured to:

[0043] If the free storage space of the fused document cache is greater than the data volume of the second fused document, storing the second fused document in the fused document cache;

[0044] If the free storage space of the fused document cache is not greater than the data volume of the second fused document, determining the cache revenue of each fused document stored in the fused document cache, and determining the cache revenue of the second fused document;

[0045] If the cache gain of the second fused document is greater than the minimum cache gain among the cache gains of the fused documents, the fused document corresponding to the minimum cache gain is deleted from the fused document cache, and the second fused document is stored in the fused document cache.

[0046] In a possible implementation, the update module is used to:

[0047] determining a first number of summaries generated based on the original documents in the second fused document;

[0048] Determining the document length of the second fused document;

[0049] Determining the time when the original document in the second fused document was last requested;

[0050] determining a number of times an original document in the second fused document is requested;

[0051] A cache benefit of the second fused document is determined according to the first quantity, the document length, the time, and the number of times.

[0052] In a third aspect, a computing device cluster is provided, which includes at least one computing device, each computing device including a processor and a memory, wherein the processor of at least one computing device is used to execute instructions stored in the memory of at least one computing device, so that the computing device cluster performs the method as described in the first aspect or in any achievable manner of the first aspect.

[0053] In a fourth aspect, a computer program product comprising instructions is provided. When the instructions are executed by a computing device cluster, the computing device cluster executes the method as described in the first aspect or in any implementable manner of the first aspect.

[0054] In a fifth aspect, a computer-readable storage medium is provided, comprising computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster can execute the method as described in the first aspect or in any achievable manner of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 is a schematic diagram of a search engine provided by an embodiment of the present disclosure;

[0056] Figure 2 is a flow chart of a method for data query provided by an embodiment of the present disclosure;

[0057] Figure 3 is a schematic diagram of a search engine provided by an embodiment of the present disclosure;

[0058] Figure 4 is a summary schematic diagram provided by an embodiment of the present disclosure;

[0059] Figure 5 is a flow chart of a method for data query provided by an embodiment of the present disclosure;

[0060] Figure 6 is a schematic diagram of a fused document provided by an embodiment of the present disclosure;

[0061] Figure 7 is a schematic diagram of a search engine provided by an embodiment of the present disclosure;

[0062] Figure 8 is a flow chart of a method for data query provided by an embodiment of the present disclosure;

[0063] Fig. 9 is a schematic diagram of a data query device structure provided by an embodiment of the present disclosure;

[0064] Fig.10 It is a schematic diagram of a storage system provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0065] The disclosed embodiment provides a method for data query, in which the summary is no longer cached, but the summary metadata is cached, and the summary metadata is used to indicate the location of the summary in the original document. In this way, when performing data query, if you want to query a certain summary, you can first query the summary metadata in the cache, and then generate the summary based on the summary metadata and the original document, and then generate the query result. Because the data volume of the summary metadata is smaller than the data volume of the summary itself, the data query method provided by the disclosed embodiment can effectively reduce the amount of cached data, thereby saving memory storage space.

[0066] The data query method provided in the embodiment of the present disclosure can be applied to a search engine. Figure 1, showing a system architecture of an existing search engine. The search engine includes a network server, an index server and a document server. The memory of the network server includes a query results cache (QRC), which is used to cache query results. The memory of the index server includes a posting list cache (PLC), which is used to cache posting lists, and the hard disk of the index server is used to store posting lists. The memory of the document server includes a summary cache (SC) and a document cache (DC), which is used to cache summaries, and the document cache is used to cache documents, and the hard disk of the document server is used to store documents.

[0067] Combine the following Figure 1 The system architecture of the search engine shown in FIG. 1 is used to explain the existing data query process. Figure 2 , the existing data query process can include the following steps:

[0068] Step 201: The network server receives a query request.

[0069] In implementation, a user inputs a first query statement in a terminal, and triggers the terminal to generate a query request, wherein the query request includes the first query statement. Then, the terminal sends the query request to a network server.

[0070] The first query statement may be a word, a phrase, a sentence, etc. Exemplarily, the first query statement is: patent application.

[0071] Step 202: The network server queries the query result cache to see whether there is a query result corresponding to the first query statement stored therein.

[0072] In implementation, the query result cache may store the query result in the form of a key-value pair, where the key is the query statement and the value is the query result, as shown in Table 1 below.

[0073] Table 1

[0074] Query Statement Query results Q1 QR1 Q2 QR2 Q3 QR3 …… ……

[0075] Correspondingly, after receiving the query request, the network server obtains the first query statement carried therein, and then uses the first query statement as a key in the query result cache to query whether there is a corresponding value.

[0076] Step 203: If the network server finds the query result corresponding to the first query statement in the query result cache, the network server sends the query result to the user terminal.

[0077] In implementation, the network server uses the first query statement as a key in the query result cache, queries the corresponding value as the query result corresponding to the first query statement, and sends the query result to the user's terminal.

[0078] Step 204: If the network server does not find the query result corresponding to the first query statement in the query result cache, the network server sends the keyword (term) in the first query statement to the index server.

[0079] In implementation, the network server uses the first query statement as a key in the query result cache, and if no corresponding value is found, the keyword in the first query statement can be obtained. Exemplarily, the keyword in the first query statement can be obtained by segmenting the first query statement.

[0080] Then, the network server sends the keywords in the first query statement to the index server.

[0081] Step 205: The index server searches for K document numbers with the highest relevance based on the keywords in the first query statement.

[0082] In implementation, the index server first queries in the inverted index list cache whether an inverted index list corresponding to the keyword in the first query statement is stored.

[0083] In the inverted index list cache, if the inverted index list corresponding to the keyword in the first query statement is queried, the document numbers contained in the queried inverted index list are obtained. Then, these document numbers are scored to obtain the K document numbers with the highest scores.

[0084] If the inverted index list corresponding to the keyword in the first query statement is not found in the inverted index list cache, the inverted index list corresponding to the keyword in the first query statement is searched in the hard disk, and the document numbers contained in the inverted index list are obtained. Then, these document numbers are scored to obtain the K document numbers with the highest scores.

[0085] The following is an explanation of the inverted index list:

[0086] Each keyword corresponds to an inverted index list. An inverted index list contains at least one inverted index item. Each inverted index item corresponds to a document. The inverted index item contains information such as the document number of the corresponding document, the number of times the keyword appears in the document, and the location of the occurrence.

[0087] When calculating the score for the document number, the score may be calculated according to the number of times the keyword in the first query statement appears in the document corresponding to the document number. The higher the number of times the keyword in the first query statement appears in the document corresponding to the document number, the higher the score corresponding to the document number.

[0088] Step 206: The index server sends the K document numbers found by the query to the network server.

[0089] Step 207: The network server sends the first query statement and K document numbers to the document server.

[0090] Step 208: The document server determines K first summary identifiers according to the first query statement and the K document numbers, and for each first summary identifier, queries the summary cache to see whether a summary corresponding to the first summary identifier is stored.

[0091] The summary includes the document title, document Uniform Resource Locator (URL), content fragment (summarization) and highlighted query words (highlights), and the highlighted query words are the keywords in the query statement.

[0092] In implementation, the summary identifier is composed of a query statement and a document number. Accordingly, the document server combines the first query statement and each document number of the K document numbers into a first summary identifier.

[0093] For each first summary identifier, the document server queries in the summary cache whether a summary corresponding to the first summary identifier is stored.

[0094] Specifically, the summary cache can store the summary in the form of a key-value pair, where the key is the summary identifier and the value is the summary, as shown in Table 2 below.

[0095] Table 2

[0096] Summary logo summary SID1 S1 SID 2 S2 SID 3 S3 …… ……

[0097] Correspondingly, the document server uses the first summary identifier as a key to query whether a corresponding value exists in the summary cache, thereby determining whether a summary corresponding to the first summary identifier is stored in the summary cache.

[0098] Step 209: If the document server finds the digest corresponding to the first digest identifier in the digest cache, the document server obtains the digest corresponding to the first digest identifier.

[0099] In implementation, the document server uses the first summary identifier as a key in the summary cache, and if a corresponding value is found, the found value is obtained, which is the summary corresponding to the first summary identifier.

[0100] Step 210: If the document server does not find the summary corresponding to the first summary identifier in the summary cache, the document server queries whether the document corresponding to the first document number in the first summary identifier is stored in the document cache.

[0101] The document includes the document title, document URL and text content (text), and the highlighted query words are the keywords in the query statement.

[0102] In implementation, the document server uses the first summary identifier as a key in the summary cache. If no corresponding value is found, the document server queries whether the first document corresponding to the first document number in the first summary identifier is stored in the document cache.

[0103] The document cache can store summaries in the form of key-value pairs. The key is the document number and the value is the document. See Table 3 below.

[0104] Table 3

[0105]

[0106]

[0107] Correspondingly, the document server uses the first document number as a key in the document cache to query whether a corresponding value exists, thereby determining whether the first document corresponding to the first document number is stored in the summary cache.

[0108] Step 211: If the document server finds the first document corresponding to the first document number in the first summary identifier in the document cache, it generates a summary corresponding to the first summary identifier according to the first document and the first query statement.

[0109] In implementation, the document server uses the first document number as a key in the summary cache, and if a corresponding value is found, the found value is obtained, which is the first document corresponding to the first document number. Then, a summary generation algorithm is used to generate a summary corresponding to the first summary identifier according to the first document and the first query statement.

[0110] Step 212: If the document server does not find the first document corresponding to the first document number in the first summary identifier in the document cache, it searches the hard disk for the first document and generates a summary corresponding to the first summary identifier based on the first document and the first query statement.

[0111] In implementation, the document server uses the first document number as a key in the summary cache. If the corresponding value is not found, the first document is searched in the hard disk, and a summary corresponding to the first summary identifier is generated based on the first document and the first query statement.

[0112] Step 213: The document server assembles the summaries corresponding to the first summary identifiers to generate a query result.

[0113] Step 214: The document server sends the query result to the network server.

[0114] Step 215: The network server sends the query result to the user's terminal.

[0115] In the data query method provided by the embodiment of the present disclosure, the summary itself will no longer be cached separately, but the summary metadata will be cached. Figure 3 , the above Figure 1 The summary cache in Figure 3 The summary metadata cache in the summary metadata cache is used to cache summary metadata. Based on this, in the data query method provided in the embodiment of the present disclosure, the data query processing of the document server (i.e., the above steps 208-215) is mainly improved. The processing of the document server when executing the data query method provided in the embodiment of the present disclosure is described below.

[0116] The following is an explanation of summary metadata:

[0117] The summary metadata includes the location information of the content fragment in the summary in the document and the location information of the highlighted query words in the content fragment. The location information of the content fragment in the document may include the offset between the first character of the content fragment and the first character of the text content of the document, and the text length of the content fragment. The offset is the text length of the interval. For each highlighted query word, the location information of the highlighted query word in the content fragment may include the offset between the first character of the highlighted query word and the first character of the content fragment, and the text length of the highlighted query word. See Figure 4 , the summary includes a content segment (summarization), and the content segment includes two highlighted query terms Highlight1 and Highlight2. The summary metadata of the summary includes the location information of the content segment: [offset, length] and the location information of the highlighted query terms [offset1+length1, offset2+length2]. In addition, the summary metadata can be stored in the form of an integer array. Compared with the summary itself, the summary metadata has a smaller data volume and occupies less memory space when cached.

[0118] like Figure 5 As shown, when executing the data query method provided by the embodiment of the present disclosure, the processing of the document server may include the following steps:

[0119] Step 301: The document server determines K first summary identifiers according to a first query statement and K document numbers, and for each first summary identifier, queries whether summary metadata corresponding to the first summary identifier is stored in a summary metadata cache.

[0120] In implementation, for each first summary identifier, the document server queries in the summary metadata cache whether a summary corresponding to the first summary identifier is stored.

[0121] Specifically, the summary metadata cache may store summary metadata in the form of a key-value pair, where the key is the summary identifier and the value is the summary metadata, as shown in Table 4 below.

[0122] Table 4

[0123] Summary logo Summary metadata SID1 SF1 SID 2 SF2 SID 3 SF3 …… ……

[0124] Correspondingly, the document server uses the first summary identifier as a key to query whether a corresponding value exists in the summary metadata cache, thereby determining whether summary metadata corresponding to the first summary identifier is stored in the summary metadata cache.

[0125] Step 302: If the document server finds the first summary metadata corresponding to the first summary identifier in the summary metadata cache, it queries whether the document corresponding to the first document number in the first summary identifier is stored in the document cache.

[0126] In implementation, the document server uses the first summary identifier as a key in the summary metadata cache, and if a corresponding value is found, the found value is obtained, which is the first summary metadata corresponding to the first summary identifier.

[0127] Then, the document server queries in the document cache whether the first document corresponding to the first document number in the first summary identifier is stored.

[0128] Step 303: If the document server finds the first document corresponding to the first document number in the first summary identifier in the document cache, it generates a summary corresponding to the first summary identifier according to the first document and the first summary metadata.

[0129] In implementation, if the document server finds the first document corresponding to the first document number in the first summary identifier in the document cache, the document server can read the content segment in the first document according to the location information of the content segment included in the first summary metadata, and determine the highlighted query term in the content segment according to the location information of the highlighted query term. Then, the title and document URL are obtained from the first document, and the title, document URL, the obtained content segment and the highlighted query term are combined to form a summary corresponding to the first summary identifier.

[0130] The following describes how to read the content segment in the first document according to the location information of the content segment included in the first summary metadata:

[0131] According to the offset in the position information of the content segment, the position of the first character in the content segment in the text content of the first document is determined, and starting from the first character, characters of a first length are read from the text content as the content segment, wherein the first length is the text length in the position information of the content segment.

[0132] The following is an explanation of determining the highlighted query word in the content segment according to the position information of the highlighted query word:

[0133] According to the offset in the position information of the highlighted query word, the position of the first character in the highlighted query word in the content segment is determined, and starting from the first character, characters of a second length are read in the content segment as the highlighted query word, wherein the second length is the text length in the position information of the highlighted query word.

[0134] Step 304: If the document server does not find the first document corresponding to the first document number in the first summary identifier in the document cache, it searches the hard disk for the first document and generates a summary corresponding to the first summary identifier based on the first document and the first summary metadata.

[0135] Step 305: If the document server does not find the summary metadata corresponding to the first summary identifier in the summary metadata cache, it queries whether the document corresponding to the first document number in the first summary identifier is stored in the document cache.

[0136] In implementation, the document server uses the first summary identifier as a key in the summary metadata cache. If no corresponding value is found, the document server queries whether a document corresponding to the first document number in the first summary identifier is stored in the document cache.

[0137] Step 306: If the document server fails to find the summary metadata corresponding to the first summary identifier in the summary metadata cache, and finds the first document corresponding to the first document number in the first summary identifier in the document cache, then the document server generates a summary corresponding to the first summary identifier according to the first document and the first query statement.

[0138] Step 307: If the document server fails to find the summary metadata corresponding to the first summary identifier in the summary metadata cache, and fails to find the first document corresponding to the first document number in the first summary identifier in the document cache, the document server searches the hard disk for the first document, and generates a summary corresponding to the first summary identifier based on the first document and the first query statement.

[0139] Step 308: The document server assembles the summaries corresponding to the first summary identifiers to generate a query result.

[0140] Step 309: The document server sends the query result to the network server.

[0141] In order to further reduce the amount of cached data and save memory space, the present disclosure also provides a data query method, in which a fusion document is proposed, such as Figure 6 As shown, the fused document contains the original document and the summary metadata of the summary generated based on the original document. The document number of the fused document is the same as the document number of the original document contained in the fused document. The original document here is the document mentioned in the above embodiment. In order to distinguish it from the fused document, the document mentioned in the above embodiment is referred to as the original document.

[0142] See also Figure 7 ,exist Figure 1 Based on the search engines shown, the summary cache is removed and the Figure 1 The document cache in is used as a fusion document cache, and the fusion document cache is used to store fusion documents. Based on this, in the data query method provided in the embodiment of the present disclosure, the data query processing of the document server (i.e., the above steps 208-215) is mainly improved. The following is an explanation of the processing of the document server when executing the data query method provided in the embodiment of the present disclosure. Figure 8 As shown, the process may include the following steps:

[0143] Step 501: The document server determines K first summary identifiers according to a first query statement and K document numbers, and for each first summary identifier, queries whether a first fused document containing a first original document is stored in the fused document cache, wherein the first original document is the original document corresponding to the document number contained in the first summary identifier.

[0144] In implementation, for each first summary identifier, the document server queries in the fused document cache whether a fused document corresponding to the first document number in the first summary identifier is stored.

[0145] Specifically, the fused document cache may store the fused document in the form of a key-value pair, where the key is the document number and the value is the fused document, as shown in Table 5 below.

[0146] Table 5

[0147] Document Number Fusion Document docID1 Mdoc1 docID 2 Mdoc2 docID 3 Mdoc3 …… ……

[0148] Correspondingly, the document server uses the first document number as a key in the fused document cache to query whether a corresponding value exists, thereby determining whether a fused document corresponding to the first document number is stored in the fused document cache.

[0149] Step 502: If the document server finds the first fused document in the fused document cache, it determines whether the first fused document contains the first summary metadata corresponding to the first summary identifier.

[0150] In implementation, the fused document may include at least one summary metadata. Even if the first fused document is found, the first fused document may not necessarily include the first summary metadata corresponding to the first summary identifier. In this case, when the document server finds the first fused document, it may determine whether the first summary metadata corresponding to the first summary identifier is included in the first fused document.

[0151] Step 503: When the document server finds the first fused document in the fused document cache, if it is determined that the first fused document contains the first summary metadata, the document server obtains the first summary metadata from the first fused document and generates a first summary based on the first summary metadata and the first original document.

[0152] Step 504: When the document server finds the first fused document in the fused document cache, if it is determined that the first fused document does not contain the first summary metadata, a first summary is generated according to the first original document and the query statement, and first summary metadata is generated according to the position of the first summary in the first original document, and the first summary metadata is added to the first fused document.

[0153] The process of generating the first summary metadata is described below:

[0154] Determine a first offset between a first character of a content segment in the first summary and a first character of text content in the first original document, and determine a first text length of the content segment. Use the first offset and the first text length as position information of the content segment. Determine a second offset between a first character of a highlighted query term and a character of the content segment, and determine a second text length of the highlighted query term. Use the second offset and the second text length as position information of the highlighted query term. Use the position information of the content segment and the position information of the highlighted query term as first summary metadata.

[0155] Step 505: If the document server does not find the first fused document in the fused document cache, it queries the hard disk to see whether the first fused document is stored.

[0156] Step 506: If the document server finds the first fused document in the hard disk, it searches the first fused document to see whether it contains the first summary metadata.

[0157] Step 507: When the document server finds the first fused document in the hard disk, if it is determined that the first fused document contains the first summary metadata, the document server obtains the first summary metadata from the first fused document, generates a first summary based on the first summary metadata and the first original document, and updates the fused document cache.

[0158] Step 508: When the document server finds the first fused document in the hard disk, if the document server determines that the first summary metadata is not included in the first fused document, the document server generates the first summary according to the first original document and the query statement, generates the first summary metadata according to the position of the first summary in the first original document, adds the first summary metadata to the first fused document, and generates the second fused document. The fused document cache is updated.

[0159] Step 509: If the first fused document is not found in the hard disk, the document server generates a first summary based on the first original document and the query statement, and generates first summary metadata based on the position of the first summary in the first original document. The first summary metadata and the first original document are combined into the first fused document. The fused document cache is updated.

[0160] The updating of the fused document cache is described below. The target fused document may be the first fused document in step 507 , the second fused document in step 508 , or the first fused document in step 509 .

[0161] If the document server determines that the free storage space of the fusion document cache is greater than the data volume of the target fusion document, the target fusion document is stored in the fusion document cache. If the document server determines that the free storage space of the fusion document cache is not greater than the data volume of the target fusion document, the cache revenue of each fusion document stored in the fusion document cache is determined, and the cache revenue of the target fusion document is determined. If the document server determines that the cache revenue of the target fusion document is greater than the minimum cache revenue of the cache revenues of each fusion document stored in the fusion document cache, the fusion document corresponding to the minimum cache revenue is deleted from the fusion document cache, and the second fusion document is stored in the fusion document cache.

[0162] In addition, the document server can also query whether there is a target original document or a target fusion document with the same document number as the fusion document corresponding to the minimum cache benefit stored in the hard disk. If the target original document or the target fusion document is found in the hard disk, the found target original document or the target fusion document is replaced with the fusion document corresponding to the minimum cache benefit. In this way, the summary metadata in the stored fusion document can be the most comprehensive.

[0163] The following is an explanation of the calculation method of the cache benefit of the target fusion document:

[0164] The document server counts the first number of summaries generated based on the original documents in the target fusion document, and counts the document length of the target fusion document, the time when the original document in the target fusion document was last requested, and the number of times the original document in the target fusion document was requested. The cache revenue of the target fusion document is determined based on the first number, document length, time, and number of times. Specifically, the first number, document length, time, and number of times can be substituted into the following formula:

[0165]

[0166] Among them, Benefit is the cache benefit of the target fusion document, Recency is the time when the original document in the target fusion document was last requested, Frequency is the number of times the original document in the target fusion document is requested, Reuse is the first number of summaries generated based on the original documents in the target fusion document, and Size is the document length of the target fusion document.

[0167] The following are the descriptions of the above parameters:

[0168] The time when the original document in the target fused document was last requested: the document server receives the timestamp of the document number of the original document sent by the network server as the time when the original document in the target fused document was last requested.

[0169] Number of times the original document in the target fused document is requested: the document server receives the number of times the document number of the original document sent by the network server as the number of times the original document in the target fused document is requested.

[0170] The first number of summaries generated based on the original documents in the target fusion document: the document server uses the number of summary metadata included in the target fusion document as the first number of summaries generated based on the original documents in the target fusion document.

[0171] Document length of target fusion document: the document server uses the data volume of the target fusion document as the document length of the target fusion document.

[0172] Based on the same technical concept, the present disclosure also provides a data query device, which can be the above document server, such as Fig. 9 As shown, the device comprises:

[0173] An acquisition module 810 is used to acquire a query statement;

[0174] A query module 820 is configured to obtain, in the cache, first summary metadata corresponding to the summary to be queried according to the query statement, wherein the first summary metadata is used to indicate a position of the summary to be queried in the first original document;

[0175] The generating module 830 is used to generate the summary to be queried according to the first metadata and the first original document; and generate a query result according to the summary to be queried.

[0176] In a possible implementation, the query module 820 is used to:

[0177] In the fused document cache, query whether a first fused document including the first original document is stored;

[0178] If the first fused document is stored in the fused document cache, querying whether the first summary metadata is included in the first fused document;

[0179] If the first fused document includes the first summary metadata, the first summary metadata is acquired from the first fused document.

[0180] In a possible implementation, the query module 820 is further configured to:

[0181] If the first summary metadata is not included in the first fused document, the summary to be queried is generated according to the first original document and the query statement.

[0182] In a possible implementation, the query module 820 is further configured to:

[0183] generating the first summary metadata according to the position of the summary to be queried in the first original document;

[0184] The first summary metadata is added to the first fused document.

[0185] In a possible implementation, the query module 820 is further configured to:

[0186] If the first fused document is not stored in the fused document cache, querying whether the first fused document is stored in the hard disk;

[0187] If the first fused document is stored in the hard disk, querying whether the first fused document contains the first summary metadata;

[0188] If the first fused document includes the first summary metadata, the first summary metadata is acquired from the first fused document.

[0189] In a possible implementation, the query module 820 is further configured to:

[0190] If the first fused document is not stored in the hard disk, the summary to be queried is generated according to the first original document and the query statement.

[0191] In a possible implementation, the query module 820 is further configured to:

[0192] generating the first summary metadata according to the position of the summary to be queried in the first original document;

[0193] A second fused document is generated according to the first summary metadata and the first original document.

[0194] In a possible implementation manner, the device further includes an updating module, configured to:

[0195] If the free storage space of the fused document cache is greater than the data volume of the second fused document, storing the second fused document in the fused document cache;

[0196] If the free storage space of the fused document cache is not greater than the data volume of the second fused document, determining the cache revenue of each fused document stored in the fused document cache, and determining the cache revenue of the second fused document;

[0197] If the cache gain of the second fused document is greater than the minimum cache gain among the cache gains of the fused documents, the fused document corresponding to the minimum cache gain is deleted from the fused document cache, and the second fused document is stored in the fused document cache.

[0198] In a possible implementation, the update module is used to:

[0199] determining a first number of summaries generated based on the original documents in the second fused document;

[0200] Determining the document length of the second fused document;

[0201] Determining the time when the original document in the second fused document was last requested;

[0202] determining a number of times an original document in the second fused document is requested;

[0203] A cache benefit of the second fused document is determined according to the first quantity, the document length, the time, and the number of times.

[0204] The data query device provided in the above embodiment only uses the division of the above functional modules as an example when processing cloud resources. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the document server is divided into different functional modules to complete all or part of the functions described above. In addition, the data query device provided in the above embodiment and the data query method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0205] The present disclosure also provides a storage cluster, which may be the above-mentioned document server. Fig.10 As shown, the storage cluster includes one or more servers 110 ( Fig.10 Three servers 110 are shown in the figure, but not limited to three servers 110), and each server 110 can communicate with each other. The server 110 is a device with both computing and storage capabilities, such as a server, a desktop computer, etc. For example, an ARM server or an X86 server can be used as the server 110 here. In terms of hardware, Fig.10As shown, the server 110 includes at least a processor 112, a memory 113, a network card 114 and a hard disk 105. The processor 112, the memory 113, the network card 114 and the hard disk 105 are connected by a bus. Among them, the processor 112 and the memory 113 are used to provide computing resources. Specifically, the processor 112 is a central processing unit (CPU) for processing data access requests from outside the server 110 (application server or other server 110), and is also used to process requests generated inside the server 110. Exemplarily, when the processor 112 receives a write data request, the data in these write data requests will be temporarily stored in the memory 113. When the total amount of data in the memory 113 reaches a certain threshold, the processor 112 sends the data stored in the memory 113 to the hard disk 105 for persistent storage. The processor 112 can execute the data query method provided by the present disclosure, and can realize the functions of the acquisition module 810, the query module 820 and the generation module 830 as described above. In addition, the processor 112 is also used for computing or processing data, such as metadata management, data deduplication, data compression, data verification, virtualized storage space, and address conversion. Fig.10 Only one CPU is shown

[0206] 112. In actual applications, there are often multiple CPUs 112, wherein one CPU 112 has one or more CPU cores. This embodiment does not limit the number of CPUs and CPU cores.

[0207] The memory 113 refers to an internal memory that directly exchanges data with the processor. It can read and write data at any time, and the speed is very fast. It serves as a temporary data storage for the operating system or other running programs. The memory includes at least two types of memories. For example, the memory can be either a random access memory or a read-only memory (ROM). For example, the random access memory is a dynamic random access memory (DRAM) or a storage class memory (SCM). DRAM is a semiconductor memory, and like most random access memories (RAM), it is a volatile memory device. SCM is a composite storage technology that combines the characteristics of traditional storage devices and memory. Storage class memory can provide faster read and write speeds than hard disks, but the access speed is slower than DRAM, and the cost is cheaper than DRAM. However, DRAM and SCM are only exemplary descriptions in this embodiment, and the memory can also include other random access memories, such as static random access memories (SRAM). As for the read-only memory, for example, it can be a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), etc. In addition, the memory 113 can also be a dual in-line memory module or a dual-line memory module (DIMM), that is, a module composed of a dynamic random access memory (DRAM), or a solid state disk (SSD). In actual applications, a plurality of memories 113 and different types of memories 113 can be configured in the storage server 110. This embodiment does not limit the number and type of memory 113. In addition, the memory 113 can be configured to have a power-saving function. The power-saving function means that when the system loses power and then powers on again, the data stored in the memory 113 will not be lost. The memory with a power-saving function is called a non-volatile memory.

[0208] The hard disk 105 is used to provide storage resources, such as storing data, and can be a disk or other types of storage media, such as a solid state drive or a shingled magnetic recording hard disk. The network card 114 is used to communicate with other application servers 110 .

[0209] The present disclosure also provides a computer program product including instructions. The computer program product may be software or a program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device is caused to perform a data query method.

[0210] The present disclosure also provides a computer-readable storage medium. The computer-readable storage medium may be any available medium that can be stored by a computing device or a data storage device such as a data center that includes one or more available media. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk). The computer-readable storage medium includes instructions that instruct the computing device to perform a method for querying data.

[0211] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for data query, It is characterized in that The method comprises: Get the query statement; According to the query statement, obtaining first summary metadata corresponding to the summary to be queried in the cache, wherein the first summary metadata is used to indicate a position of the summary to be queried in the first original document; Generate the summary to be queried according to the first summary metadata and the first original document; Generate a query result according to the summary to be queried.

2. The method according to claim 1, It is characterized in that The step of obtaining first summary metadata corresponding to the summary to be queried in the cache includes: In the fused document cache, query whether a first fused document including the first original document is stored; If the first fused document is stored in the fused document cache, querying whether the first summary metadata is included in the first fused document; If the first fused document includes the first summary metadata, the first summary metadata is acquired from the first fused document.

3. The method according to claim 2, It is characterized in that The method further comprises: If the first summary metadata is not included in the first fused document, the summary to be queried is generated according to the first original document and the query statement.

4. The method according to claim 3, It is characterized in that The method further comprises: generating the first summary metadata according to the position of the summary to be queried in the first original document; The first summary metadata is added to the first fused document.

5. The method according to any one of claims 2 to 4, It is characterized in that The method further comprises: If the first fused document is not stored in the fused document cache, querying whether the first fused document is stored in the hard disk; If the first fused document is stored in the hard disk, querying whether the first fused document contains the first summary metadata; If the first fused document includes the first summary metadata, the first summary metadata is acquired from the first fused document.

6. The method according to claim 5, It is characterized in that The method further comprises: If the first fused document is not stored in the hard disk, the summary to be queried is generated according to the first original document and the query statement.

7. The method according to claim 6, It is characterized in that The method further comprises: generating the first summary metadata according to the position of the summary to be queried in the first original document; A second fused document is generated according to the first summary metadata and the first original document.

8. The method according to claim 7, It is characterized in that The method further comprises: If the free storage space of the fused document cache is greater than the data volume of the second fused document, storing the second fused document in the fused document cache; If the free storage space of the fused document cache is not greater than the data volume of the second fused document, determining the cache revenue of each fused document stored in the fused document cache, and determining the cache revenue of the second fused document; If the cache gain of the second fused document is greater than the minimum cache gain among the cache gains of the fused documents, the fused document corresponding to the minimum cache gain is deleted from the fused document cache, and the second fused document is stored in the fused document cache.

9. The method according to claim 8, It is characterized in that The determining the cache benefit of the second fused document includes: determining a first number of summaries generated based on the original documents in the second fused document; Determining the document length of the second fused document; Determining the time when the original document in the second fused document was last requested; determining a number of times an original document in the second fused document is requested; A cache benefit of the second fused document is determined according to the first quantity, the document length, the time, and the number of times.

10. A data query device, It is characterized in that The device comprises: The acquisition module is used to obtain the query statement; A query module, configured to obtain, in a cache, first summary metadata corresponding to the summary to be queried according to the query statement, wherein the first summary metadata is used to indicate a position of the summary to be queried in the first original document; A generating module is used to generate the summary to be queried according to the first metadata and the first original document; and to generate a query result according to the summary to be queried.

11. A computing device cluster, It is characterized in that comprising at least one computing device, each computing device comprising a processor and a memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method according to any one of claims 1 to 9.

12. A computer program product comprising instructions, It is characterized in that When the instructions are executed by a computing device cluster, the computing device cluster executes the method according to any one of claims 1 to 9.

13. A computer-readable storage medium, It is characterized in that The method comprises computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster performs the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Semantic analysis of search results to generate snippets responsive to receipt of a query

    US20180365318A1