Nothing Special   »   [go: up one dir, main page]

CN108694188B - A method and related device for updating index data - Google Patents

A method and related device for updating index data Download PDF

Info

Publication number
CN108694188B
CN108694188B CN201710225105.0A CN201710225105A CN108694188B CN 108694188 B CN108694188 B CN 108694188B CN 201710225105 A CN201710225105 A CN 201710225105A CN 108694188 B CN108694188 B CN 108694188B
Authority
CN
China
Prior art keywords
index data
updating
data
update
index
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
CN201710225105.0A
Other languages
Chinese (zh)
Other versions
CN108694188A (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 CN201710225105.0A priority Critical patent/CN108694188B/en
Publication of CN108694188A publication Critical patent/CN108694188A/en
Application granted granted Critical
Publication of CN108694188B publication Critical patent/CN108694188B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

The embodiment of the invention discloses a method for updating index data, which can be applied to an index data updating device, wherein the index data updating device comprises a memory area and a hard disk area, and the method comprises the steps of receiving an index data updating request; updating the index data in the memory area according to the index data updating request, and obtaining first index data; and if the first index data meets the preset index data updating condition, updating the index data in the hard disk area according to the first index data, and obtaining second index data. The invention also provides an index data updating device. According to the embodiment of the invention, the index data can be stored in a grading manner, and different storage modes are respectively adopted for different index data types, so that the first index data is updated in real time, and the second index data is updated periodically, thereby effectively balancing the updating of the index data, reducing the memory consumption and the computing resource and reducing the computing cost.

Description

一种索引数据更新的方法以及相关装置A method and related device for updating index data

技术领域technical field

本发明涉及互联网技术领域,尤其涉及一种索引数据更新的方法以及相关装置。The invention relates to the technical field of the Internet, in particular to a method for updating index data and a related device.

背景技术Background technique

随着互联网技术的不断发展,用户利用互联网进行检索也越来越普遍。为了进行检索,通常需要先对数据库中的检索资料进行索引。索引是对数据库表中一列或多列的值进行排序的一种结构,使用索引可快速访问数据库表中的特定信息。检索平台在接入各个垂直业务的过程中,一般根据业务的具体类型,例如数据量、数据更新量,以及检索量等业务特性,采用不同的索引存储解决方案。With the continuous development of Internet technology, it is becoming more and more common for users to use the Internet to search. In order to search, it is usually necessary to index the search data in the database first. An index is a structure that sorts the values of one or more columns in a database table, using an index to quickly access specific information in a database table. In the process of accessing various vertical services, the retrieval platform generally adopts different index storage solutions according to the specific types of services, such as data volume, data update volume, and retrieval volume and other business characteristics.

目前,对对于数据量较大且索引更新不频繁的业务而言,一般采用固态硬盘(Solid State Drives,SSD)或者磁盘的存储方式,也就是将全量索引存放于SSD或硬盘中,更新数据的线上生效时间几乎等同于索引数据全量更新的时间。At present, for businesses with a large amount of data and infrequent index updates, solid state drives (Solid State Drives, SSD) or disk storage methods are generally used, that is, the full index is stored in the SSD or hard disk, and the data is updated. The online effective time is almost equal to the time for full update of index data.

然而,采用SSD或硬盘的索引存储方式虽然在一定程度上降低了成本,但是受限于SSD或硬盘的物理特性,同时进行索引更新以及查询会给硬盘带来同时“读”和“写”的问题。为了解决同时“读”和“写”的问题,索引一般不允许实时更新,而采用周期过长的全量更新方式。此时,为了使得增量更新的索引数据能够尽快上线,则需要尽量降低索引全量更新的周期,导致计算成本的增加。However, although the index storage method using SSD or hard disk reduces the cost to a certain extent, it is limited by the physical characteristics of SSD or hard disk. Simultaneous index update and query will bring simultaneous "reading" and "writing" to the hard disk. question. In order to solve the problem of "reading" and "writing" at the same time, the index generally does not allow real-time update, but adopts a full update method with a long period. At this time, in order to make the incrementally updated index data go online as soon as possible, it is necessary to reduce the cycle of full index update as much as possible, resulting in an increase in computing costs.

发明内容Contents of the invention

本发明实施例提供了一种索引数据更新的方法以及相关装置,可以对索引数据进行分级存储,即将索引数据分成第一索引数据和第二索引数据,可针对不同的索引数据类型,分别采用不同的存储方式,以此实现在实时更新第一索引数据的同时,周期性地更新第二索引数据,从而可以有效地平衡索引数据的更新,减少内存消耗以及计算资源,降低计算成本。The embodiment of the present invention provides a method for updating index data and related devices, which can store index data hierarchically, that is, index data is divided into first index data and second index data, and different index data types can be used for different index data types. In this way, the second index data can be updated periodically while the first index data is updated in real time, so that the update of index data can be effectively balanced, memory consumption and computing resources can be reduced, and computing costs can be reduced.

有鉴于此,本发明第一方面提供了一种索引数据更新的方法,所述方法应用于索引数据更新装置,所述索引数据更新装置包含内存区域以及硬盘区域,所述方法包括:In view of this, the first aspect of the present invention provides a method for updating index data, the method is applied to an index data updating device, and the index data updating device includes a memory area and a hard disk area, and the method includes:

接收索引数据更新请求;Receive index data update request;

根据所述索引数据更新请求对所述内存区域中的索引数据进行更新,并得到第一索引数据;update the index data in the memory area according to the index data update request, and obtain first index data;

若所述第一索引数据满足预设索引数据更新条件,则根据所述第一索引数据对所述硬盘区域中的索引数据进行更新,并得到第二索引数据。If the first index data satisfies a preset index data update condition, then update the index data in the hard disk area according to the first index data, and obtain second index data.

本发明第二方面提供了一种索引数据更新装置,所述索引数据更新装置包含内存区域以及硬盘区域,所述索引数据更新装置包括:The second aspect of the present invention provides an index data update device, the index data update device includes a memory area and a hard disk area, and the index data update device includes:

第一接收模块,用于接收索引数据更新请求;A first receiving module, configured to receive an index data update request;

第一更新模块,用于根据所述第一接收模块接收的所述索引数据更新请求对所述内存区域中的索引数据进行更新,并得到第一索引数据;A first updating module, configured to update the index data in the memory area according to the index data update request received by the first receiving module, and obtain first index data;

第二更新模块,用于若所述第一更新模块更新得到的所述第一索引数据满足预设索引数据更新条件,则根据所述第一索引数据对所述硬盘区域中的索引数据进行更新,并得到第二索引数据。A second update module, configured to update the index data in the hard disk area according to the first index data if the first index data updated by the first update module satisfies a preset index data update condition. , and get the second index data.

从以上技术方案可以看出,本发明实施例具有以下优点:It can be seen from the above technical solutions that the embodiments of the present invention have the following advantages:

本发明实施例中,提供了一种索引数据更新的方法,该方法可应用于索引数据更新装置,该索引数据更新装置包含内存区域以及硬盘区域,首先索引数据更新装置接收索引数据更新请求,然后根据索引数据更新请求对内存区域中的索引数据进行更新,并得到第一索引数据,若第一索引数据满足预设索引数据更新条件,则根据第一索引数据对硬盘区域中的索引数据进行更新,并得到第二索引数据。通过上述方法,可以对索引数据进行分级存储,即将索引数据分成第一索引数据和第二索引数据,可针对不同的索引数据类型,分别采用不同的存储方式,以此实现在实时更新第一索引数据的同时,周期性地更新第二索引数据,从而可以有效地平衡索引数据的更新,减少内存消耗以及计算资源,降低计算成本。In an embodiment of the present invention, a method for updating index data is provided. The method can be applied to an index data updating device. The index data updating device includes a memory area and a hard disk area. First, the index data updating device receives an index data updating request, and then Update the index data in the memory area according to the index data update request, and obtain the first index data, if the first index data meets the preset index data update conditions, then update the index data in the hard disk area according to the first index data , and get the second index data. Through the above method, the index data can be stored hierarchically, that is, the index data can be divided into the first index data and the second index data, and different storage methods can be adopted for different index data types, so as to update the first index in real time At the same time, the second index data is updated periodically, so that the update of the index data can be effectively balanced, memory consumption and computing resources are reduced, and computing costs are reduced.

附图说明Description of drawings

图1为本发明实施例中内存索引独立存储方案的拓扑图;FIG. 1 is a topological diagram of a memory index independent storage solution in an embodiment of the present invention;

图2为本发明实施例中硬盘索引独立存储方案的拓扑图;FIG. 2 is a topological diagram of a hard disk index independent storage solution in an embodiment of the present invention;

图3为本发明实施例中内存索引与硬盘索引结合存储的拓扑图;FIG. 3 is a topological diagram of combined storage of memory index and hard disk index in an embodiment of the present invention;

图4为本发明实施例中索引数据更新的方法一个实施例示意图;FIG. 4 is a schematic diagram of an embodiment of a method for updating index data in an embodiment of the present invention;

图5为本发明实施例中数据检索的一个流程示意图;Fig. 5 is a schematic flow chart of data retrieval in the embodiment of the present invention;

图6为本发明实施例中索引数据更新装置一个实施例示意图;FIG. 6 is a schematic diagram of an embodiment of an index data updating device in an embodiment of the present invention;

图7为本发明实施例中索引数据更新装置一个实施例示意图;FIG. 7 is a schematic diagram of an embodiment of an index data updating device in an embodiment of the present invention;

图8为本发明实施例中索引数据更新装置一个实施例示意图;FIG. 8 is a schematic diagram of an embodiment of an index data updating device in an embodiment of the present invention;

图9为本发明实施例中索引数据更新装置一个实施例示意图;FIG. 9 is a schematic diagram of an embodiment of an index data updating device in an embodiment of the present invention;

图10为本发明实施例中索引数据更新装置一个实施例示意图;FIG. 10 is a schematic diagram of an embodiment of an index data updating device in an embodiment of the present invention;

图11为本发明实施例中索引数据更新装置一个实施例示意图;Fig. 11 is a schematic diagram of an embodiment of an index data updating device in an embodiment of the present invention;

图12为本发明实施例中索引数据更新装置一个实施例示意图;FIG. 12 is a schematic diagram of an embodiment of an index data updating device in an embodiment of the present invention;

图13为本发明实施例中索引数据更新装置一个实施例示意图;FIG. 13 is a schematic diagram of an embodiment of an index data updating device in an embodiment of the present invention;

图14为本发明实施例中索引数据更新装置一个结构示意图。FIG. 14 is a schematic structural diagram of an index data updating device in an embodiment of the present invention.

具体实施方式Detailed ways

本发明实施例提供了一种索引数据更新的方法以及相关装置,可以对索引数据进行分级存储,即将索引数据分成第一索引数据和第二索引数据,可针对不同的索引数据类型,分别采用不同的存储方式,以此实现在实时更新第一索引数据的同时,周期性地更新第二索引数据,从而可以有效地平衡索引数据的更新,减少内存消耗以及计算资源,降低计算成本。The embodiment of the present invention provides a method for updating index data and related devices, which can store index data hierarchically, that is, index data is divided into first index data and second index data, and different index data types can be used for different index data types. In this way, the second index data can be updated periodically while the first index data is updated in real time, so that the update of index data can be effectively balanced, memory consumption and computing resources can be reduced, and computing costs can be reduced.

本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本发明的实施例例如能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second", "third", "fourth", etc. (if any) in the description and claims of the present invention and the above drawings are used to distinguish similar objects, and not necessarily Used to describe a specific sequence or sequence. It is to be understood that the data so used are interchangeable under appropriate circumstances such that the embodiments of the invention described herein are, for example, capable of practice in sequences other than those illustrated or described herein. Furthermore, the terms "comprising" and "having", as well as any variations thereof, are intended to cover a non-exclusive inclusion, for example, a process, method, system, product or device comprising a sequence of steps or elements is not necessarily limited to the expressly listed instead, may include other steps or elements not explicitly listed or inherent to the process, method, product or apparatus.

应理解,本发明可应用于服务器的内存区域以及硬盘区域,其中,内存区域即为内存,硬盘区域即为硬盘,目前,对于索引数据的存储通常可以有两种方式,一种为存储于内存中,而另一种则为存储于硬盘中。下面将简单介绍这两种独立存储的方案。It should be understood that the present invention can be applied to the memory area and the hard disk area of the server, wherein the memory area is the memory, and the hard disk area is the hard disk. At present, there are usually two ways to store index data, one is to store in the memory , while the other is stored in the hard disk. The following will briefly introduce these two independent storage solutions.

索引数据存储于内存的方式具体为,请参阅图1,图1为本发明实施例中内存索引独立存储方案的拓扑图,如图所示,在内存中存储有增量索引和全量索引,搜索引擎可以调用内存索引中的信息。在用户进行数据检索时,可通过搜索引擎从内存索引中查找相应的索引数据,并根据索引数据确定对应的检索结果,然后发送至客户端,以展现给用户。在进行数据更新时,内存索引中的增量索引会实时进行更新,并且全量索引也会同步进行更新。The specific method of storing index data in the memory is as follows. Please refer to Figure 1. Figure 1 is a topology diagram of the independent memory index storage solution in the embodiment of the present invention. As shown in the figure, there are incremental indexes and full indexes stored in the memory. Search The engine can call the information in the memory index. When the user searches for data, he can use the search engine to find the corresponding index data from the memory index, and determine the corresponding search result according to the index data, and then send it to the client for presentation to the user. When data is updated, the incremental index in the memory index will be updated in real time, and the full index will also be updated synchronously.

索引数据存储于硬盘的方式具体为,请参阅图2,图2为本发明实施例中硬盘索引独立存储方案的拓扑图,如图所示,在硬盘中存储有全量索引,搜索引擎可以调用全量索引中的信息。在用户进行数据检索时,可以通过搜索引擎从硬盘索引中查找相应的索引数据,并根据索引数据确定对应的检索结果,然后发送至客户端,以展现给用户。在进行数据更新时,硬盘索引中的全量索引也会进行更新。The specific method of storing index data on the hard disk is as follows. Please refer to Figure 2. Figure 2 is a topological diagram of the independent storage scheme of the hard disk index in the embodiment of the present invention. As shown in the figure, the full index is stored in the hard disk, and the search engine can call the information in the index. When the user searches for data, he can use the search engine to find the corresponding index data from the hard disk index, and determine the corresponding search result according to the index data, and then send it to the client for presentation to the user. When data is updated, the full index in the hard disk index will also be updated.

而本发明所采用的索引数据存储方案较上述两种存储方案而言,能够很大限度地降低索引存储成本。请参阅图3,图3为本发明实施例中内存索引与硬盘索引结合存储的拓扑图,如图所示,在一个检索服务中可分为三层,即搜索接入层、搜索引擎实现层以及数据衔接层。其中,检索接入层主要用于对外屏蔽内部搜索引擎的实现细节,主要的功能包括:检索接入、检索结果的归并、检索结果排重以及数据更新请求的接入。搜索引擎实现层主要用于在内部实现时将所有存储分为两部分,即内存索引和硬盘索引,内存索引存储部分保持最近一段时间的更新数据,主要接收实时数据更新请求以及数据检索请求,而硬盘索引存储部分则是保持最新的一份全量索引数据,主要接收数据检索请求,不接收实时数据更新请求。数据衔接层主要用于实现内存与硬盘索引数据的衔接、全量数据定期归并以及全量数据定期更新。Compared with the above two storage schemes, the index data storage solution adopted by the present invention can greatly reduce the index storage cost. Please refer to Fig. 3. Fig. 3 is a topological diagram of memory index and hard disk index combined storage in the embodiment of the present invention. As shown in the figure, a search service can be divided into three layers, namely the search access layer and the search engine implementation layer and data connection layer. Among them, the retrieval access layer is mainly used to shield the implementation details of the internal search engine from the outside, and its main functions include: retrieval access, merging of retrieval results, deduplication of retrieval results, and access to data update requests. The search engine implementation layer is mainly used to divide all storage into two parts during internal implementation, that is, memory index and hard disk index. The memory index storage part keeps updated data in the latest period, and mainly receives real-time data update requests and data retrieval requests, while The hard disk index storage part keeps the latest full index data, and mainly receives data retrieval requests, not real-time data update requests. The data connection layer is mainly used to realize the connection between the memory and the hard disk index data, the regular merging of the full amount of data, and the regular update of the full amount of data.

下面将从索引数据更新装置的角度,对本发明中索引数据更新的方法进行介绍,请参阅图4,本发明实施例中索引数据更新的方法一个实施例包括:The following will introduce the method for updating index data in the present invention from the perspective of the device for updating index data. Please refer to FIG. 4 . An embodiment of the method for updating index data in the embodiment of the present invention includes:

101、索引数据更新装置接收索引数据更新请求,其中,索引数据更新装置包含内存区域以及硬盘区域;101. The index data update device receives an index data update request, wherein the index data update device includes a memory area and a hard disk area;

本实施例中,部署于服务器中的索引数据更新装置首先接收索引数据更新请求,该索引数据更新请求将同步到内存区域以及硬盘区域中。在内存区域存储的是最近一段时间的更新数据,主要用于实时接收索引数据更新请求以及数据检索请求,而硬盘区域存储的是一份最新的全量索引数据,主要接收数据检索请求,但不实时接收索引数据更新请求。In this embodiment, the index data update device deployed in the server first receives an index data update request, and the index data update request will be synchronized to the memory area and the hard disk area. The latest update data is stored in the memory area, which is mainly used to receive index data update requests and data retrieval requests in real time, while the hard disk area stores a copy of the latest full index data, which is mainly used to receive data retrieval requests, but not in real time. Receive index data update requests.

索引数据是为了加速对表中数据行的检索而创建的一种分散的存储结构。索引是针对表而建立的,它是由数据页面以外的索引页面组成的,每个索引页面中的行都会含有逻辑指针,以便加速检索物理数据。Index data is a decentralized storage structure created to speed up the retrieval of data rows in a table. The index is established for the table, which is composed of index pages other than the data page. The rows in each index page will contain logical pointers to speed up the retrieval of physical data.

索引数据主要包括顺排数据、倒排数据和摘要数据等。由于不同业务在数据规模、更新频率以及检索量等各个方面的差别,因此对不同的业务类型所采用的索引存储以及更新模型都是不同的。例如:对于一个数据更新较频繁的业务而言,索引数据的存储模型应该尽可能保证数据更新的性能以及数据的完整性。其中,顺排索引是指一篇文档到这篇文档包含的所有词的映射。倒排索引是指一个词语到所有包含这个词语的文档的映射。Index data mainly includes sequential data, inverted data and summary data. Due to the differences in data size, update frequency, and retrieval volume of different businesses, the index storage and update models adopted for different business types are different. For example: For a business with frequent data updates, the storage model of index data should ensure the performance of data updates and data integrity as much as possible. Among them, the sequential index refers to the mapping from a document to all the words contained in this document. An inverted index is a mapping of a term to all documents containing that term.

102、索引数据更新装置根据索引数据更新请求对内存区域中的索引数据进行更新,并得到第一索引数据;102. The index data updating device updates the index data in the memory area according to the index data update request, and obtains the first index data;

本实施例中,接下来,索引数据更新装置会根据索引数据更新请求,实时地对内存区域中的索引数据进行更新,其中,第一索引数据包括增量索引,增量索引具体可以是指在内存区域中增加新的索引数据。例如,内存区域中的A列表原本有索引数据a和索引数据b,现在A列表更新后增加了索引数据c,索引数据c即为增量索引。于是索引数据a、索引数据b和索引数据c共同构成了第一索引数据。In this embodiment, next, the index data update device will update the index data in the memory area in real time according to the index data update request, wherein the first index data includes an incremental index, and the incremental index can specifically refer to the Add new index data in the memory area. For example, the A list in the memory area originally had index data a and index data b, but now the A list has been updated to add index data c, and the index data c is an incremental index. Then the index data a, the index data b and the index data c together constitute the first index data.

103、若第一索引数据满足预设索引数据更新条件,则索引数据更新装置根据第一索引数据对硬盘区域中的索引数据进行更新,并得到第二索引数据。103. If the first index data satisfies the preset index data updating condition, the index data updating device updates the index data in the hard disk area according to the first index data, and obtains the second index data.

本实施例中,如果存储于内存区域中的第一索引数据满足预设索引数据更新条件,那么索引数据更新装置将利用第一索引数据对硬盘区域中的索引数据进行更新,并得到第二索引数据,第二索引数据也可以称为全量数据。In this embodiment, if the first index data stored in the memory area satisfies the preset index data update condition, then the index data updating device will use the first index data to update the index data in the hard disk area, and obtain the second index data data, the second index data can also be referred to as full data.

类似地,假设硬盘区域中的B列表有索引数据x、索引数据y和索引数据z,现在将内存区域中的第一索引数据(即索引数据a、索引数据b和索引数据c)与B列表中的数据进行合并,就可以得到第二索引数据,即包含索引数据a、索引数据b、索引数据c、索引数据x、索引数据y和索引数据z。Similarly, assuming that the B list in the hard disk area has index data x, index data y, and index data z, now the first index data (ie, index data a, index data b, and index data c) in the memory area is combined with the B list The second index data can be obtained by merging the data in the index data, which includes index data a, index data b, index data c, index data x, index data y and index data z.

本发明实施例中,提供了一种索引数据更新的方法,该方法可应用于索引数据更新装置,该索引数据更新装置包含内存区域以及硬盘区域,首先索引数据更新装置接收索引数据更新请求,然后根据索引数据更新请求对内存区域中的索引数据进行更新,并得到第一索引数据,若第一索引数据满足预设索引数据更新条件,则根据第一索引数据对硬盘区域中的索引数据进行更新,并得到第二索引数据。通过上述方法,可以对索引数据进行分级存储,即将索引数据分成第一索引数据和第二索引数据,可针对不同的索引数据类型,分别采用不同的存储方式,以此实现在实时更新第一索引数据的同时,周期性地更新第二索引数据,从而可以有效地平衡索引数据的更新,减少内存消耗以及计算资源,降低计算成本。In an embodiment of the present invention, a method for updating index data is provided. The method can be applied to an index data updating device. The index data updating device includes a memory area and a hard disk area. First, the index data updating device receives an index data updating request, and then Update the index data in the memory area according to the index data update request, and obtain the first index data, if the first index data meets the preset index data update conditions, then update the index data in the hard disk area according to the first index data , and get the second index data. Through the above method, the index data can be stored hierarchically, that is, the index data can be divided into the first index data and the second index data, and different storage methods can be adopted for different index data types, so as to update the first index in real time At the same time, the second index data is updated periodically, so that the update of the index data can be effectively balanced, memory consumption and computing resources are reduced, and computing costs are reduced.

可选地,在上述图4对应的实施例的基础上,本发明实施例提供的索引数据更新的方法第一个可选实施例中,根据索引数据更新请求对内存区域中的索引数据进行更新,并得到第一索引数据之后,还可以包括:Optionally, on the basis of the above embodiment corresponding to FIG. 4 , in the first optional embodiment of the method for updating index data provided by the embodiment of the present invention, the index data in the memory area is updated according to the index data update request , and after getting the first index data, you can also include:

获取第一索引数据对应的数据量;Obtain the amount of data corresponding to the first index data;

判断第一索引数据对应的数据量是否达到存储容量阈值,若是,则确定第一索引数据满足预设索引数据更新条件。It is judged whether the data amount corresponding to the first index data reaches the storage capacity threshold, and if so, it is determined that the first index data satisfies the preset index data update condition.

本实施例中,索引数据更新装置还可以先获取第一索引数据对应的数据量,然后判断第一索引数据对应的数据量是否达到预先设定的存储容量阈值,当达到该存储容量阈值时,则可以利用第一索引数据对硬盘区域中的索引数据进行更新,并得到第二索引数据。In this embodiment, the index data updating device may first obtain the data volume corresponding to the first index data, and then determine whether the data volume corresponding to the first index data reaches a preset storage capacity threshold, and when the storage capacity threshold is reached, Then, the first index data can be used to update the index data in the hard disk area to obtain the second index data.

由于内存区域的存储资源有限,所以通常需要对内存区域的占用量设置一个存储容量阈值,假如存储容量阈值为80%,当内存区域中索引数据的存储容量达到一定的存储容量阈值(例如80%)时,需要将内存区域中索引数据与硬盘区域中的索引数据进行合并,生成新的全量数据并重新加载。Due to the limited storage resources of the memory area, it is usually necessary to set a storage capacity threshold for the occupied amount of the memory area. If the storage capacity threshold is 80%, when the storage capacity of the index data in the memory area reaches a certain storage capacity threshold (for example, 80% ), the index data in the memory area and the index data in the hard disk area need to be merged to generate a new full amount of data and reload.

其次,本发明实施例中,提供了一种判断第一索引数据是否满足预设索引数据更新条件的方法,具体为先获取第一索引数据对应的数据量,然后判断该数据量是否达到了存储容量阈值,只有达到了存储容量阈值,才确定第一索引数据满足预设索引数据更新条件。通过上述方式,一方面可以设置合理的存储容量阈值,既达到充分利用内存空间的目的,又不造成内存空间的浪费,另一方面当内存中第一索引数据的数据量达到存储容量阈值时,可以自动将第一索引数据发送至硬盘,从而保证充足的内存空间。Secondly, in the embodiment of the present invention, a method for judging whether the first index data satisfies the preset index data update conditions is provided. Specifically, firstly obtain the data volume corresponding to the first index data, and then judge whether the data volume has reached the storage capacity. The capacity threshold, only when the storage capacity threshold is reached, is it determined that the first index data satisfies the preset index data update condition. Through the above method, on the one hand, a reasonable storage capacity threshold can be set, which not only achieves the purpose of fully utilizing the memory space, but also does not cause waste of memory space; on the other hand, when the data volume of the first index data in the memory reaches the storage capacity threshold, The first index data can be automatically sent to the hard disk to ensure sufficient memory space.

可选地,在上述图4对应的实施例的基础上,本发明实施例提供的索引数据更新的方法第二个可选实施例中,根据索引数据更新请求对内存区域中的索引数据进行更新,并得到第一索引数据之后,还可以包括:Optionally, on the basis of the above embodiment corresponding to FIG. 4 , in the second optional embodiment of the method for updating index data provided by the embodiment of the present invention, the index data in the memory area is updated according to the index data update request , and after getting the first index data, you can also include:

检测第一索引数据对应的时刻值;Detect the time value corresponding to the first index data;

判断第一索引数据对应的时刻值是否达到目标时刻,若是,则确定第一索引数据满足预设索引数据更新条件。It is judged whether the time value corresponding to the first index data reaches the target time, and if so, it is determined that the first index data satisfies the preset index data update condition.

本实施例中,除了上述图4对应的第一个实施例中介绍的方式,还可以周期性地对第二索引数据进行更新。具体为,先检测获取到第一索引数据时的时刻值,假设该时刻值为12:00:00,如果这个时刻值达到预先设定的目标时刻,那么认为更新周期已经到了,因此可以确定第一索引数据满足预设索引数据更新条件,于是将第一索引数据发送至硬盘区域,使得硬盘区域根据第一索引数据进行更新,并得到第二索引数据。In this embodiment, in addition to the manner described in the first embodiment corresponding to FIG. 4 above, the second index data may also be updated periodically. Specifically, first detect the time value when the first index data is obtained, assuming that the time value is 12:00:00, if the time value reaches the preset target time, then it is considered that the update cycle has arrived, so it can be determined that the first index data An index data satisfies the preset index data update condition, so the first index data is sent to the hard disk area, so that the hard disk area is updated according to the first index data, and the second index data is obtained.

其次,本发明实施例中,提供了另一种判断第一索引数据是否满足预设索引数据更新条件的方法,具体为先检测第一索引数据对应的时刻值,然后判断该时刻值是否达到目标时刻,只有达到了目标时刻,才确定第一索引数据满足预设索引数据更新条件。通过上述方式,能够在内存资源有限的情况下,利用内存空间周期性地向硬盘发送第一索引数据,使得硬盘也可以周期地进行索引数据更新,不影响内存以及硬盘中索引数据更新的效果,从而提升了方案的灵活性和实用性。Secondly, in the embodiment of the present invention, another method for judging whether the first index data satisfies the preset index data update conditions is provided, specifically, first detecting the time value corresponding to the first index data, and then judging whether the time value reaches the target When the target time is reached, it is determined that the first index data satisfies the preset index data update condition. Through the above method, in the case of limited memory resources, the memory space can be used to periodically send the first index data to the hard disk, so that the hard disk can also periodically update the index data without affecting the effect of updating the index data in the memory and hard disk. Thus, the flexibility and practicability of the scheme are improved.

可选地,在上述图4以及图4对应的第一或第二个实施例的基础上,本发明实施例提供的索引数据更新的方法第三个可选实施例中,根据第一索引数据对硬盘区域中的索引数据进行更新,并得到第二索引数据,可以包括:Optionally, on the basis of the first or second embodiment corresponding to FIG. 4 and FIG. 4 above, in the third optional embodiment of the method for updating index data provided by the embodiment of the present invention, according to the first index data The index data in the hard disk area is updated to obtain the second index data, which may include:

对第一索引数据与硬盘区域中的索引数据进行合并处理,并得到第二索引数据。The first index data and the index data in the hard disk area are merged to obtain the second index data.

本实施例中,将具体介绍如何对硬盘区域中的索引数据进行更新。In this embodiment, how to update the index data in the hard disk area will be specifically introduced.

具体地,假设当前内存区域中存储了A列表,且A列表中包括一段时间内的索引数据,请参阅表1,表1为A列表中的索引数据。Specifically, it is assumed that the A list is stored in the current memory area, and the A list includes index data for a period of time, please refer to Table 1, which shows the index data in the A list.

表1Table 1

Figure BDA0001264975720000081
Figure BDA0001264975720000081

由表1可以看出,第一索引数据也就包括a、b、c和d,接下来将第一索引数据与硬盘区域中已存储的索引数据进行合并处理,即在B列表中展示合并后得到的第二索引数据,请参阅表2,表2为B列表中的索引数据。It can be seen from Table 1 that the first index data also includes a, b, c and d, and then merge the first index data with the index data stored in the hard disk area, that is, display the merged index data in the B list For the obtained second index data, please refer to Table 2, which is the index data in the B list.

表2Table 2

Figure BDA0001264975720000082
Figure BDA0001264975720000082

由表2可以看出,第二索引数据也就包括a、b、c、d和x。至此完成对硬盘区域中索引数据的更新。It can be seen from Table 2 that the second index data also includes a, b, c, d and x. At this point, the update of the index data in the hard disk area is completed.

再次,本发明实施例中,索引数据更新装置对硬盘区域中的索引数据进行更新,然后得到第二索引数据,这个过程可以是将内存区域中的第一索引数据添加到硬盘区域中,与硬盘区域中原本存储的索引数据共同构成第二索引数据。通过上述方式,能够完成硬盘区域中索引数据的更新,从而提升方案的可行性和可操作性,为方案的实现提供具体依据。Again, in the embodiment of the present invention, the index data updating device updates the index data in the hard disk area, and then obtains the second index data. This process may be to add the first index data in the memory area to the hard disk area, and The index data originally stored in the area together constitute the second index data. Through the above method, the update of the index data in the hard disk area can be completed, thereby improving the feasibility and operability of the solution, and providing a specific basis for the realization of the solution.

可选地,在上述图4对应的第三个实施例的基础上,本发明实施例提供的索引数据更新的方法第四个可选实施例中,根据第一索引数据对硬盘区域中的索引数据进行更新,并得到第二索引数据之后,还可以包括:Optionally, on the basis of the third embodiment corresponding to FIG. 4 above, in the fourth optional embodiment of the method for updating index data provided by the embodiment of the present invention, the index in the hard disk area is updated according to the first index data. After the data is updated and the second index data is obtained, it may also include:

根据第二索引数据的检索频率确定第三索引数据,其中,第三索引数据为第二索引数据中的一部分索引数据;determining the third index data according to the retrieval frequency of the second index data, wherein the third index data is a part of the index data in the second index data;

采用第三索引数据替换第一索引数据,以将第三索引数据存储至内存区域。The first index data is replaced by the third index data to store the third index data in the memory area.

本实施例中,索引数据更新装置在得到第二索引数据之后,还可以进一步从第二索引数据中选择一部分检索频率较高的索引数据作为第三索引数据,然后将第三索引数据发送到内存区域中,此时,内存区域中的第一索引数据将被清空,取而代之的是第三索引数据。In this embodiment, after the index data updating device obtains the second index data, it may further select a part of index data with high retrieval frequency from the second index data as the third index data, and then send the third index data to the memory area, at this time, the first index data in the memory area will be cleared and replaced by the third index data.

可以理解的是,无论是硬盘区域中对索引数据进行更新,以得到第二索引数据,还是从第二索引数据中选择第三索引数据,都可以采用线下处理的方式,处理完成后切换路由上线的方案。It can be understood that whether the index data is updated in the hard disk area to obtain the second index data, or the third index data is selected from the second index data, offline processing can be adopted, and the route is switched after the processing is completed. online program.

进一步地,本发明实施例中,索引数据更新装置得到第二索引数据之后,还可以根据第二索引数据的检索频率确定第三索引数据,然后将第三索引数据同步至内存区域,使得内存区域中原本存储的第一索引数据被替换为第三索引数据。通过上述方式,在用户进行检索时,直接从内存区域中提取相应检索结果的可能性更大,通常情况下,从内存中查找信息比在硬盘中查找信息的效率更高,因此,将检索频率较高的第三索引数据存储在内存中,更有利于检索效率的提升,从而增加方案的实用性。Further, in the embodiment of the present invention, after the index data update device obtains the second index data, it can also determine the third index data according to the retrieval frequency of the second index data, and then synchronize the third index data to the memory area, so that the memory area The first index data originally stored in the middle is replaced with the third index data. Through the above method, when the user performs a search, it is more likely to directly extract the corresponding search results from the memory area. Usually, it is more efficient to find information from the memory than from the hard disk. Therefore, the search frequency will be Higher third index data is stored in memory, which is more conducive to the improvement of retrieval efficiency, thereby increasing the practicability of the scheme.

可选地,在上述图4对应的实施例的基础上,本发明实施例提供的索引数据更新的方法第五个可选实施例中,还可以包括:Optionally, on the basis of the above-mentioned embodiment corresponding to FIG. 4 , in the fifth optional embodiment of the method for updating index data provided by the embodiment of the present invention, it may further include:

接收数据检索请求;receive data retrieval requests;

根据数据检索请求从内存区域中获取第一索引数据所对应的第一检索结果,并从硬盘区域获取第二索引数据所对应的第二检索结果;Acquiring the first retrieval result corresponding to the first index data from the memory area according to the data retrieval request, and obtaining the second retrieval result corresponding to the second index data from the hard disk area;

若第一检索结果与第二检索结果一致,则发送第一检索结果或第二检索结果。If the first search result is consistent with the second search result, the first search result or the second search result is sent.

本实施例中,将介绍一种利用索引数据进行数据检索的方式。首先索引数据更新装置接收用户通过客户端发起的数据检索请求,接下来,索引数据更新装置将同时把该数据检索请求发送至内存区域以及硬盘区域中。在内存区域中,利用第一索引数据获取数据检索请求对应的第一检索结果,同时,在硬盘区域中,利用第二索引数据获取数据检索请求对应的第二检索结果。In this embodiment, a method of using index data for data retrieval will be introduced. Firstly, the index data updating device receives a data retrieval request initiated by the user through the client, and then, the index data updating device simultaneously sends the data retrieval request to the memory area and the hard disk area. In the memory area, the first index data is used to obtain the first search result corresponding to the data search request, and at the same time, in the hard disk area, the second index data is used to obtain the second search result corresponding to the data search request.

例如,假设用户在数据检索请求中携带了“2016年奥运会篮球赛”,于是,在内存区域和硬盘区域中将查询与“2016年奥运会篮球赛”相关的目录,即索引数据,通过索引数据就可以得到所需的检索结果。For example, assuming that the user carries "2016 Olympic Basketball Game" in the data retrieval request, then the directory related to "2016 Olympic Basketball Game" will be queried in the memory area and hard disk area, that is, the index data. The desired search results can be obtained.

如果在内存区域中得到的第一检索结果与在硬盘区域中得到的第二检索结果一致,则选择其中一个检索结果发送给用户即可。If the first retrieval result obtained in the memory area is consistent with the second retrieval result obtained in the hard disk area, then one of the retrieval results is selected and sent to the user.

其次,本发明实施例中,介绍了一种数据检索的过程,该过程为先接收用户发送的数据检索请求,然后根据数据检索请求既可以从内存区域中获取第一索引数据所对应的第一检索结果,又可以从硬盘区域获取第二索引数据所对应的第二检索结果,如果检测到第一检索结果与第二检索结果一致,则选择其中一个检索结果即可。通过上述方式,能够得到增量索引对应的检索结果以及全量索引对应的检索结果,从而提升检索的可靠性和全面性,在实际应用在中,可以在第一检索结果与第二检索结果中选择其一进行发送,以此保证发送的检索结果不会重复,从而提升检索的合理性。Secondly, in the embodiment of the present invention, a data retrieval process is introduced. The process is to first receive the data retrieval request sent by the user, and then obtain the first index corresponding to the first index data from the memory area according to the data retrieval request. As for the search result, the second search result corresponding to the second index data can be obtained from the hard disk area, and if it is detected that the first search result is consistent with the second search result, then one of the search results can be selected. Through the above method, the search results corresponding to the incremental index and the search results corresponding to the full index can be obtained, thereby improving the reliability and comprehensiveness of the search. In practical applications, you can choose between the first search result and the second search result One is to send, so as to ensure that the sent search results will not be repeated, thereby improving the rationality of the search.

可选地,在上述图4对应的第五个实施例的基础上,本发明实施例提供的索引数据更新的方法第六个可选实施例中,发送第一检索结果或第二检索结果之前,还可以包括:Optionally, on the basis of the fifth embodiment corresponding to Figure 4 above, in the sixth optional embodiment of the method for updating index data provided by the embodiment of the present invention, before sending the first search result or the second search result , which can also include:

获取第一检索结果的第一更新时长以及第二检索结果的第二更新时长,其中,第一更新时长为获取第一检索结果的时刻到当前时刻之间的时间长度,第二更新时长为获取第二检索结果的时刻到当前时刻之间的时间长度;Obtain the first update duration of the first retrieval result and the second update duration of the second retrieval result, wherein the first update duration is the time length between the moment when the first retrieval result is obtained and the current moment, and the second update duration is The length of time between the moment of the second retrieval result and the current moment;

发送第一检索结果或第二检索结果,可以包括:Sending the first search result or the second search result may include:

若第一更新时长小于第二更新时长,则发送第一检索结果;If the first update duration is less than the second update duration, then send the first retrieval result;

若第一更新时长大于第二更新时长,则发送第二检索结果。If the first update duration is longer than the second update duration, the second retrieval result is sent.

本实施例中,由于搜索引擎内部在实现上将所有索引数据分成了两份存储(即内存存储和硬盘存储),当一个数据检索请求到来时,极有可能在两份索引数据中同时存在同一条查询结果。此时,需要根据结果的更新时间选择最新的结果,作为最终结果返回给用户,而次新的结果将会被直接丢弃。In this embodiment, because the search engine internally divides all index data into two storages (i.e., memory storage and hard disk storage), when a data retrieval request comes, it is very likely that the same index data will exist in the two index data at the same time. A query result. At this time, it is necessary to select the latest result according to the update time of the result and return it to the user as the final result, while the second newest result will be directly discarded.

具体地,假设索引数据更新装置获取第一检索结果的时刻为2017年3月18日10点15分35秒,而获取第二检索结果的时刻为2017年3月17日12点38分27秒,则不难看出,获取第二检索结果的时间更长,于是,将优先发送第一检索结果。这样就可以选择更新的检索结果。反之,如果第一更新时长大于第二更新时长,则向用户发送第二检索结果。Specifically, it is assumed that the index data update device obtains the first retrieval result at 10:15:35 on March 18, 2017, and obtains the second retrieval result at 12:38:27 on March 17, 2017. , it is not difficult to see that it takes longer to obtain the second search result, so the first search result will be sent first. This allows you to select updated search results. Conversely, if the first update duration is longer than the second update duration, the second retrieval result is sent to the user.

再次,本发明实施例中,当第一检索结果与第二检索结果一致时,还可以进一步利用两者的更新时长来选择其中一个检索结果,也就是先获取第一检索结果的第一更新时长以及第二检索结果的第二更新时长,第一更新时长为获取第一检索结果的时刻到当前时刻之间的时间长度,而第二更新时长为获取第二检索结果的时刻到当前时刻之间的时间长度,最后选择更新时长较短的检索结果作为发送对象。通过上述方式,能够使得索引数据更新装置向用户提供更具有时效性的检索结果,同时,第一检索结果通常存储于内存中,若第一更新时长小于第二更新时长,则优先从内存中调用第一检索结果,而从内存中提取所需第一检索结果的时间更短,从而提升方案的可操作性以及实用性。Again, in the embodiment of the present invention, when the first search result is consistent with the second search result, the update duration of the two can be further used to select one of the search results, that is, the first update duration of the first search result is obtained first And the second update duration of the second search result, the first update duration is the time length between the time when the first search result is obtained and the current time, and the second update time is the time between the time when the second search result is obtained and the current time The length of time, and finally select the search result with a shorter update time as the sending object. Through the above method, the index data update device can provide users with more time-sensitive search results. At the same time, the first search result is usually stored in the memory. The first retrieval result, and the time to extract the required first retrieval result from the memory is shorter, thereby improving the operability and practicability of the solution.

可选地,在上述图4对应的实施例的基础上,本发明实施例提供的索引数据更新的方法第七个可选实施例中,还可以包括:Optionally, on the basis of the above-mentioned embodiment corresponding to FIG. 4 , in the seventh optional embodiment of the method for updating index data provided by the embodiment of the present invention, it may further include:

接收数据检索请求;receive data retrieval requests;

根据数据检索请求从硬盘区域获取第二索引数据所对应的检索结果;Acquiring the retrieval result corresponding to the second index data from the hard disk area according to the data retrieval request;

发送第二索引数据所对应的检索结果。Send the retrieval result corresponding to the second index data.

本实施例中,将介绍另一种利用索引数据进行数据检索的方式。首先索引数据更新装置接收用户通过客户端发起的数据检索请求,接下来,索引数据更新装置将该数据检索请求发送至硬盘区域中,这是由于很多情况下,内存区域所能存储的索引数据较为有限,因此,为了克服这个问题,我们可以将数据量较大的索引数据存储于硬盘区域中。以此,索引数据更新装置可以根据数据检索请求,直接从硬盘区域中获取第二索引数据所对应的检索结果即可,最后通过客户端向用户发送该检索数据In this embodiment, another way of using index data for data retrieval will be introduced. First, the index data updating device receives the data retrieval request initiated by the user through the client, and then, the index data updating device sends the data retrieval request to the hard disk area, because in many cases, the index data that can be stored in the memory area is relatively small. Therefore, in order to overcome this problem, we can store index data with a large amount of data in the hard disk area. In this way, the index data update device can directly obtain the retrieval result corresponding to the second index data from the hard disk area according to the data retrieval request, and finally send the retrieval data to the user through the client

其次,本发明实施例中,介绍了一种数据检索的过程,该过程为先接收用户发送的数据检索请求,然后根据数据检索请求直接从硬盘区域中调取检索结果即可,该检索结果只存储于硬盘区域,而不存放于内存区域中,因此无需消耗时间和资源从内存区域中查找检索结果。通过上述方式,能够尽可能减少对内存资源的消耗,直接从硬盘区域中提取相应检索结果,由此提升方案的应用效率以及可行性。Secondly, in the embodiment of the present invention, a data retrieval process is introduced. The process is to first receive the data retrieval request sent by the user, and then directly retrieve the retrieval result from the hard disk area according to the data retrieval request. The retrieval result is only It is stored in the hard disk area, not in the memory area, so there is no need to consume time and resources to find the retrieval results from the memory area. Through the above method, the consumption of memory resources can be reduced as much as possible, and the corresponding retrieval results can be directly extracted from the hard disk area, thereby improving the application efficiency and feasibility of the solution.

为便于理解,下面可以以一个具体应用场景对本发明中实现数据检索的过程进行详细描述,具体为:For ease of understanding, the process of realizing data retrieval in the present invention can be described in detail below in a specific application scenario, specifically:

索引数据更新装置通过对搜索引擎进行抽象,将搜索引擎组件化之后研发的一个自助接入搜索业务的平台。使用索引数据更新装置搭建搜索引擎使得搜索功能的实现更为简单。搜索引擎的核心在于索引数据,其中,多索引数据的操作主要包括索引数据的的存储、更新以及检索等,特别是业务数据量较大时,索引数据的存储以及更新的问题显得更为突出。因此,在搜索服务的搭建过程中,如何对索引数据进行存储、更新成为一个关键的问题。下面将介绍数据检索的具体流程。The index data update device abstracts the search engine and develops a platform for self-service access to search services after the search engine is componentized. Using the index data updating device to build a search engine makes the realization of the search function simpler. The core of a search engine lies in index data. The operation of multi-index data mainly includes the storage, update, and retrieval of index data. Especially when the amount of business data is large, the problem of index data storage and update becomes more prominent. Therefore, in the process of building a search service, how to store and update index data has become a key issue. The specific process of data retrieval will be introduced below.

请参阅图5,图5为本发明实施例中数据检索的一个流程示意图,具体为:Please refer to FIG. 5. FIG. 5 is a schematic flow chart of data retrieval in an embodiment of the present invention, specifically:

步骤201中,首先索引数据更新装置接收用户通过客户端发送的数据检索请求,该请求中携带了用户想要检索的内容;In step 201, first, the index data update device receives a data retrieval request sent by the user through the client, and the request carries the content that the user wants to retrieve;

步骤202中,然后,索引数据更新装置将会根据数据检索请求,判断是否可以从内存区域中获取第一索引数据对应的第一检索结果,同时,也需要判断是否可以从硬盘区域中获取第二索引数据对应的第二检索结果,若能够同时获取到这两个检索结果,则进入步骤203,反之,则跳转至步骤204;In step 202, then, the index data updating device will judge whether the first retrieval result corresponding to the first index data can be obtained from the memory area according to the data retrieval request, and also need to judge whether the second retrieval result corresponding to the first index data can be obtained from the hard disk area. For the second retrieval result corresponding to the index data, if the two retrieval results can be obtained at the same time, enter step 203, otherwise, jump to step 204;

步骤203中,如果索引数据更新装置同时获取到第一检索结果以及第二检索结果,那么还应该从两个检索结果中选择其一作为最终的检索结果;In step 203, if the index data updating device obtains the first retrieval result and the second retrieval result at the same time, it should also select one of the two retrieval results as the final retrieval result;

步骤204中,索引数据更新装置向客户端发送选择得到的检索结果。In step 204, the index data update device sends the selected retrieval results to the client.

下面对本发明中的索引数据更新装置进行详细描述,请参阅图6,索引数据更新装置包含内存区域以及硬盘区域,索引数据更新装置30包括:The index data updating device in the present invention will be described in detail below, please refer to FIG. 6 , the index data updating device includes a memory area and a hard disk area, and the index data updating device 30 includes:

第一接收模块301,用于接收索引数据更新请求;The first receiving module 301 is configured to receive an index data update request;

第一更新模块302,用于根据所述第一接收模块301接收的所述索引数据更新请求对所述内存区域中的索引数据进行更新,并得到第一索引数据;The first updating module 302 is configured to update the index data in the memory area according to the index data update request received by the first receiving module 301, and obtain first index data;

第二更新模块303,用于若所述第一更新模块302更新得到的所述第一索引数据满足预设索引数据更新条件,则根据所述第一索引数据对所述硬盘区域中的索引数据进行更新,并得到第二索引数据。The second update module 303 is configured to update the index data in the hard disk area according to the first index data if the first index data updated by the first update module 302 satisfies the preset index data update condition update, and obtain the second index data.

本实施例中,第一接收模块301接收索引数据更新请求,第一更新模块302根据所述第一接收模块301接收的所述索引数据更新请求对所述内存区域中的索引数据进行更新,并得到第一索引数据,若所述第一更新模块302更新得到的所述第一索引数据满足预设索引数据更新条件,则第二更新模块303根据所述第一索引数据对所述硬盘区域中的索引数据进行更新,并得到第二索引数据。In this embodiment, the first receiving module 301 receives an index data update request, and the first update module 302 updates the index data in the memory area according to the index data update request received by the first receiving module 301, and Obtain the first index data, if the first index data updated by the first update module 302 satisfies the preset index data update condition, then the second update module 303 updates the hard disk area according to the first index data The index data is updated to obtain the second index data.

本发明实施例中,提供了一种索引数据更新装置,该索引数据更新装置包含内存区域以及硬盘区域,首先索引数据更新装置接收索引数据更新请求,然后根据索引数据更新请求对内存区域中的索引数据进行更新,并得到第一索引数据,若第一索引数据满足预设索引数据更新条件,则根据第一索引数据对硬盘区域中的索引数据进行更新,并得到第二索引数据。通过上述方法,可以对索引数据进行分级存储,即将索引数据分成第一索引数据和第二索引数据,可针对不同的索引数据类型,分别采用不同的存储方式,以此实现在实时更新第一索引数据的同时,周期性地更新第二索引数据,从而可以有效地平衡索引数据的更新,减少内存消耗以及计算资源,降低计算成本。In an embodiment of the present invention, an index data update device is provided, the index data update device includes a memory area and a hard disk area, first the index data update device receives an index data update request, and then updates the index in the memory area according to the index data update request The data is updated to obtain first index data. If the first index data satisfies the preset index data update condition, the index data in the hard disk area is updated according to the first index data to obtain second index data. Through the above method, the index data can be stored hierarchically, that is, the index data can be divided into the first index data and the second index data, and different storage methods can be adopted for different index data types, so as to update the first index in real time At the same time, the second index data is updated periodically, so that the update of the index data can be effectively balanced, memory consumption and computing resources are reduced, and computing costs are reduced.

可选地,在上述图6所对应的实施例的基础上,请参阅图7,本发明实施例提供的索引数据更新装置30的另一实施例中,Optionally, on the basis of the above-mentioned embodiment corresponding to FIG. 6 , please refer to FIG. 7 , in another embodiment of the index data updating device 30 provided by the embodiment of the present invention,

所述索引数据更新装置30还包括:The index data updating device 30 also includes:

第一获取模块304A,用于在所述第一更新模块302根据所述索引数据更新请求对所述内存区域中的索引数据进行更新,并得到第一索引数据之后,获取所述第一索引数据对应的数据量;The first acquiring module 304A is configured to acquire the first index data after the first updating module 302 updates the index data in the memory area according to the index data update request and obtains the first index data corresponding amount of data;

第一判断模块304B,用于判断所述第一获取模块304A获取的所述第一索引数据对应的数据量是否达到存储容量阈值,若是,则确定所述第一索引数据满足所述预设索引数据更新条件。The first judging module 304B is configured to judge whether the amount of data corresponding to the first index data acquired by the first acquiring module 304A reaches a storage capacity threshold, and if so, determine that the first index data satisfies the preset index Data update condition.

其次,本发明实施例中,提供了一种判断第一索引数据是否满足预设索引数据更新条件的方法,具体为先获取第一索引数据对应的数据量,然后判断该数据量是否达到了存储容量阈值,只有达到了存储容量阈值,才确定第一索引数据满足预设索引数据更新条件。通过上述方式,一方面可以设置合理的存储容量阈值,既达到充分利用内存空间的目的,又不造成内存空间的浪费,另一方面当内存中第一索引数据的数据量达到存储容量阈值时,可以自动将第一索引数据发送至硬盘,从而保证充足的内存空间。Secondly, in the embodiment of the present invention, a method for judging whether the first index data satisfies the preset index data update conditions is provided. Specifically, firstly obtain the data volume corresponding to the first index data, and then judge whether the data volume has reached the storage capacity. The capacity threshold, only when the storage capacity threshold is reached, is it determined that the first index data satisfies the preset index data update condition. Through the above method, on the one hand, a reasonable storage capacity threshold can be set, which not only achieves the purpose of fully utilizing the memory space, but also does not cause waste of memory space; on the other hand, when the data volume of the first index data in the memory reaches the storage capacity threshold, The first index data can be automatically sent to the hard disk to ensure sufficient memory space.

可选地,在上述图6所对应的实施例的基础上,请参阅图8,本发明实施例提供的索引数据更新装置30的另一实施例中,Optionally, on the basis of the above-mentioned embodiment corresponding to FIG. 6 , please refer to FIG. 8 , in another embodiment of the index data updating device 30 provided by the embodiment of the present invention,

所述索引数据更新装置30还包括:The index data updating device 30 also includes:

检测模块305A,用于在所述第一更新模块302根据所述索引数据更新请求对所述内存区域中的索引数据进行更新,并得到第一索引数据之后,检测所述第一索引数据对应的时刻值;The detection module 305A is configured to detect the index data corresponding to the first index data after the first update module 302 updates the index data in the memory area according to the index data update request and obtains the first index data. time value;

第二判断模块305B,用于判断所述检测模块305A检测得到的所述第一索引数据对应的时刻值是否达到目标时刻,若是,则确定所述第一索引数据满足所述预设索引数据更新条件。The second judgment module 305B is used to judge whether the time value corresponding to the first index data detected by the detection module 305A reaches the target time, and if so, determine that the first index data satisfies the preset index data update condition.

其次,本发明实施例中,提供了另一种判断第一索引数据是否满足预设索引数据更新条件的方法,具体为先检测第一索引数据对应的时刻值,然后判断该时刻值是否达到目标时刻,只有达到了目标时刻,才确定第一索引数据满足预设索引数据更新条件。通过上述方式,能够在内存资源有限的情况下,利用内存空间周期性地向硬盘发送第一索引数据,使得硬盘也可以周期地进行索引数据更新,不影响内存以及硬盘中索引数据更新的效果,从而提升了方案的灵活性和实用性。Secondly, in the embodiment of the present invention, another method for judging whether the first index data satisfies the preset index data update conditions is provided, specifically, first detecting the time value corresponding to the first index data, and then judging whether the time value reaches the target When the target time is reached, it is determined that the first index data satisfies the preset index data update condition. Through the above method, in the case of limited memory resources, the memory space can be used to periodically send the first index data to the hard disk, so that the hard disk can also periodically update the index data without affecting the effect of updating the index data in the memory and hard disk. Thus, the flexibility and practicability of the scheme are improved.

可选地,在上述图6、图7或图8所对应的实施例的基础上,请参阅图9,本发明实施例提供的索引数据更新装置30的另一实施例中,Optionally, on the basis of the above-mentioned embodiments corresponding to FIG. 6, FIG. 7 or FIG. 8, please refer to FIG.

所述第二更新模块303包括:The second update module 303 includes:

处理单元3031,用于对所述第一索引数据与所述硬盘区域中的索引数据进行合并处理,并得到所述第二索引数据。The processing unit 3031 is configured to combine the first index data and the index data in the hard disk area to obtain the second index data.

再次,本发明实施例中,索引数据更新装置对硬盘区域中的索引数据进行更新,然后得到第二索引数据,这个过程可以是将内存区域中的第一索引数据添加到硬盘区域中,与硬盘区域中原本存储的索引数据共同构成第二索引数据。通过上述方式,能够完成硬盘区域中索引数据的更新,从而提升方案的可行性和可操作性,为方案的实现提供具体依据。Again, in the embodiment of the present invention, the index data updating device updates the index data in the hard disk area, and then obtains the second index data. This process may be to add the first index data in the memory area to the hard disk area, and The index data originally stored in the area together constitute the second index data. Through the above method, the update of the index data in the hard disk area can be completed, thereby improving the feasibility and operability of the solution, and providing a specific basis for the realization of the solution.

可选地,在上述图9所对应的实施例的基础上,请参阅图10,本发明实施例提供的索引数据更新装置30的另一实施例中,Optionally, on the basis of the above embodiment corresponding to FIG. 9 , please refer to FIG. 10 , in another embodiment of the index data updating device 30 provided by the embodiment of the present invention,

所述索引数据更新装置30还包括:The index data updating device 30 also includes:

确定模块306A,用于在所述第二更新模块303根据所述第一索引数据对所述硬盘区域中的索引数据进行更新,并得到第二索引数据之后,根据所述第二索引数据的检索频率确定第三索引数据,其中,所述第三索引数据为所述第二索引数据中的一部分索引数据;The determining module 306A is configured to, after the second updating module 303 updates the index data in the hard disk area according to the first index data and obtains the second index data, according to the retrieval of the second index data Frequency determining third index data, wherein the third index data is a part of the second index data;

替换模块306B,用于采用所述确定模块306A确定的所述第三索引数据替换第一索引数据,以将所述第三索引数据存储至所述内存区域。A replacing module 306B, configured to replace the first index data with the third index data determined by the determining module 306A, so as to store the third index data in the memory area.

进一步地,本发明实施例中,索引数据更新装置得到第二索引数据之后,还可以根据第二索引数据的检索频率确定第三索引数据,然后将第三索引数据同步至内存区域,使得内存区域中原本存储的第一索引数据被替换为第三索引数据。通过上述方式,在用户进行检索时,直接从内存区域中提取相应检索结果的可能性更大,通常情况下,从内存中查找信息比在硬盘中查找信息的效率更高,因此,将检索频率较高的第三索引数据存储在内存中,更有利于检索效率的提升,从而增加方案的实用性。Further, in the embodiment of the present invention, after the index data update device obtains the second index data, it can also determine the third index data according to the retrieval frequency of the second index data, and then synchronize the third index data to the memory area, so that the memory area The first index data originally stored in the middle is replaced with the third index data. Through the above method, when the user performs a search, it is more likely to directly extract the corresponding search results from the memory area. Usually, it is more efficient to find information from the memory than from the hard disk. Therefore, the search frequency will be Higher third index data is stored in memory, which is more conducive to the improvement of retrieval efficiency, thereby increasing the practicability of the scheme.

可选地,在上述图6所对应的实施例的基础上,请参阅图11,本发明实施例提供的索引数据更新装置30的另一实施例中,Optionally, on the basis of the above-mentioned embodiment corresponding to FIG. 6 , please refer to FIG. 11 , in another embodiment of the index data updating device 30 provided by the embodiment of the present invention,

所述索引数据更新装置30还包括:The index data updating device 30 also includes:

第二接收模块307A,用于接收数据检索请求;The second receiving module 307A is configured to receive a data retrieval request;

第二获取模块307B,用于根据所述第二接收模块307A接收的所述数据检索请求从所述内存区域中获取所述第一索引数据所对应的第一检索结果,并从所述硬盘区域获取所述第二索引数据所对应的第二检索结果;The second obtaining module 307B is configured to obtain the first retrieval result corresponding to the first index data from the memory area according to the data retrieval request received by the second receiving module 307A, and obtain the first retrieval result corresponding to the first index data from the hard disk area Acquiring a second retrieval result corresponding to the second index data;

第一发送模块307C,用于若所述第二获取模块307B获取的所述第一检索结果与所述第二检索结果一致,则发送所述第一检索结果或所述第二检索结果。The first sending module 307C is configured to send the first search result or the second search result if the first search result obtained by the second obtaining module 307B is consistent with the second search result.

其次,本发明实施例中,介绍了一种数据检索的过程,该过程为先接收用户发送的数据检索请求,然后根据数据检索请求既可以从内存区域中获取第一索引数据所对应的第一检索结果,又可以从硬盘区域获取第二索引数据所对应的第二检索结果,如果检测到第一检索结果与第二检索结果一致,则选择其中一个检索结果即可。通过上述方式,能够得到增量索引对应的检索结果以及全量索引对应的检索结果,从而提升检索的可靠性和全面性,在实际应用在中,可以在第一检索结果与第二检索结果中选择其一进行发送,以此保证发送的检索结果不会重复,从而提升检索的合理性。Secondly, in the embodiment of the present invention, a data retrieval process is introduced. The process is to first receive the data retrieval request sent by the user, and then obtain the first index corresponding to the first index data from the memory area according to the data retrieval request. As for the search result, the second search result corresponding to the second index data can be obtained from the hard disk area, and if it is detected that the first search result is consistent with the second search result, then one of the search results can be selected. Through the above method, the search results corresponding to the incremental index and the search results corresponding to the full index can be obtained, thereby improving the reliability and comprehensiveness of the search. In practical applications, you can choose between the first search result and the second search result One is to send, so as to ensure that the sent search results will not be repeated, thereby improving the rationality of the search.

可选地,在上述图11所对应的实施例的基础上,请参阅图12,本发明实施例提供的索引数据更新装置30的另一实施例中,Optionally, on the basis of the above embodiment corresponding to FIG. 11 , please refer to FIG. 12 , in another embodiment of the index data updating device 30 provided by the embodiment of the present invention,

所述索引数据更新装置30还包括:The index data updating device 30 also includes:

第三获取模块308,用于在所述第一发送模块307C发送所述第一检索结果或所述第二检索结果之前,获取所述第一检索结果的第一更新时长以及所述第二检索结果的第二更新时长,其中,所述第一更新时长为获取所述第一检索结果的时刻到当前时刻之间的时间长度,所述第二更新时长为获取所述第二检索结果的时刻到所述当前时刻之间的时间长度;The third obtaining module 308 is configured to obtain the first update duration of the first search result and the second search result before the first sending module 307C sends the first search result or the second search result. The second update duration of the result, wherein the first update duration is the time length between the moment when the first retrieval result is obtained and the current moment, and the second update duration is the moment when the second retrieval result is obtained the length of time to said current moment;

所述第一发送模块307C包括:The first sending module 307C includes:

第一发送单元307C1,用于若所述第一更新时长小于所述第二更新时长,则发送所述第一检索结果;The first sending unit 307C1 is configured to send the first retrieval result if the first update duration is shorter than the second update duration;

第二发送单元307C2,用于若所述第一更新时长大于所述第二更新时长,则发送所述第二检索结果。The second sending unit 307C2 is configured to send the second retrieval result if the first update duration is longer than the second update duration.

再次,本发明实施例中,当第一检索结果与第二检索结果一致时,还可以进一步利用两者的更新时长来选择其中一个检索结果,也就是先获取第一检索结果的第一更新时长以及第二检索结果的第二更新时长,第一更新时长为获取第一检索结果的时刻到当前时刻之间的时间长度,而第二更新时长为获取第二检索结果的时刻到当前时刻之间的时间长度,最后选择更新时长较短的检索结果作为发送对象。通过上述方式,能够使得索引数据更新装置向用户提供更具有时效性的检索结果,同时,第一检索结果通常存储于内存中,若第一更新时长小于第二更新时长,则优先从内存中调用第一检索结果,而从内存中提取所需第一检索结果的时间更短,从而提升方案的可操作性以及实用性。Again, in the embodiment of the present invention, when the first search result is consistent with the second search result, the update duration of the two can be further used to select one of the search results, that is, the first update duration of the first search result is obtained first And the second update duration of the second search result, the first update duration is the time length between the time when the first search result is obtained and the current time, and the second update time is the time between the time when the second search result is obtained and the current time The length of time, and finally select the search result with a shorter update time as the sending object. Through the above method, the index data update device can provide users with more time-sensitive search results. At the same time, the first search result is usually stored in the memory. The first retrieval result, and the time to extract the required first retrieval result from the memory is shorter, thereby improving the operability and practicability of the solution.

可选地,在上述图6所对应的实施例的基础上,请参阅图13,本发明实施例提供的索引数据更新装置30的另一实施例中,Optionally, on the basis of the above-mentioned embodiment corresponding to FIG. 6 , please refer to FIG. 13 , in another embodiment of the index data updating device 30 provided by the embodiment of the present invention,

所述索引数据更新装置30还包括:The index data updating device 30 also includes:

第三接收模块309A,用于接收数据检索请求;The third receiving module 309A is configured to receive a data retrieval request;

第四获取模块309B,用于根据所述第三接收模块309A接收的所述数据检索请求从所述硬盘区域获取所述第二索引数据所对应的检索结果;The fourth obtaining module 309B is configured to obtain the retrieval result corresponding to the second index data from the hard disk area according to the data retrieval request received by the third receiving module 309A;

第二发送模块309C,用于发送所述第四获取模块309B获取的所述第二索引数据所对应的检索结果。The second sending module 309C is configured to send the retrieval result corresponding to the second index data obtained by the fourth obtaining module 309B.

其次,本发明实施例中,介绍了一种数据检索的过程,该过程为先接收用户发送的数据检索请求,然后根据数据检索请求直接从硬盘区域中调取检索结果即可,该检索结果只存储于硬盘区域,而不存放于内存区域中,因此无需消耗时间和资源从内存区域中查找检索结果。通过上述方式,能够尽可能减少对内存资源的消耗,直接从硬盘区域中提取相应检索结果,由此提升方案的应用效率以及可行性。Secondly, in the embodiment of the present invention, a data retrieval process is introduced. The process is to first receive the data retrieval request sent by the user, and then directly retrieve the retrieval result from the hard disk area according to the data retrieval request. The retrieval result is only It is stored in the hard disk area, not in the memory area, so there is no need to consume time and resources to find the retrieval results from the memory area. Through the above method, the consumption of memory resources can be reduced as much as possible, and the corresponding retrieval results can be directly extracted from the hard disk area, thereby improving the application efficiency and feasibility of the solution.

图14是本发明实施例提供的一种索引数据更新装置结构示意图,该索引数据更新装置400可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上中央处理器(central processing units,CPU)422(例如,一个或一个以上处理器)和存储器432,一个或一个以上存储应用程序442或数据444的存储介质430(例如一个或一个以上海量存储设备)。其中,存储器432和存储介质430可以是短暂存储或持久存储。存储在存储介质430的程序可以包括一个或一个以上模块(图示没标出),每个模块可以包括对服务器中的一系列指令操作。更进一步地,中央处理器422可以设置为与存储介质430通信,索引数据更新装置400上执行存储介质430中的一系列指令操作。FIG. 14 is a schematic structural diagram of an index data updating device provided by an embodiment of the present invention. The index data updating device 400 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (central processing units). , CPU) 422 (eg, one or more processors) and memory 432, one or more storage media 430 (eg, one or more mass storage devices) for storing application programs 442 or data 444. Wherein, the memory 432 and the storage medium 430 may be temporary storage or persistent storage. The program stored in the storage medium 430 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Further, the central processing unit 422 may be configured to communicate with the storage medium 430 , and the index data updating apparatus 400 executes a series of instruction operations in the storage medium 430 .

索引数据更新装置400还可以包括一个或一个以上电源426,一个或一个以上有线或无线网络接口450,一个或一个以上输入输出接口458,和/或,一个或一个以上操作系统441,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM等等。The index data update device 400 may also include one or more power sources 426, one or more wired or wireless network interfaces 450, one or more input and output interfaces 458, and/or, one or more operating systems 441, such as Windows ServerTM , Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

上述实施例中由服务器所执行的步骤可以基于该图14所示的服务器结构。The steps performed by the server in the foregoing embodiments may be based on the server structure shown in FIG. 14 .

其中,中央处理器422可用于执行如下步骤:Wherein, the central processing unit 422 can be used to perform the following steps:

接收索引数据更新请求;Receive index data update request;

根据所述索引数据更新请求对所述内存区域中的索引数据进行更新,并得到第一索引数据;update the index data in the memory area according to the index data update request, and obtain first index data;

若所述第一索引数据满足预设索引数据更新条件,则根据所述第一索引数据对所述硬盘区域中的索引数据进行更新,并得到第二索引数据。If the first index data satisfies a preset index data update condition, then update the index data in the hard disk area according to the first index data, and obtain second index data.

中央处理器422还可用于执行如下步骤:The central processing unit 422 can also be used to perform the following steps:

获取所述第一索引数据对应的数据量;Acquiring a data amount corresponding to the first index data;

判断所述第一索引数据对应的数据量是否达到存储容量阈值,若是,则确定所述第一索引数据满足所述预设索引数据更新条件。Judging whether the amount of data corresponding to the first index data reaches a storage capacity threshold, and if so, determining that the first index data satisfies the preset index data update condition.

中央处理器422还可用于执行如下步骤:The central processing unit 422 can also be used to perform the following steps:

检测所述第一索引数据对应的时刻值;Detecting the time value corresponding to the first index data;

判断所述第一索引数据对应的时刻值是否达到目标时刻,若是,则确定所述第一索引数据满足所述预设索引数据更新条件。It is judged whether the time value corresponding to the first index data reaches the target time, and if so, it is determined that the first index data satisfies the preset index data update condition.

中央处理器422具体用于执行如下步骤:The central processing unit 422 is specifically configured to perform the following steps:

对所述第一索引数据与所述硬盘区域中的索引数据进行合并处理,并得到所述第二索引数据。Merge the first index data and the index data in the hard disk area to obtain the second index data.

中央处理器422还可用于执行如下步骤:The central processing unit 422 can also be used to perform the following steps:

根据所述第二索引数据的检索频率确定第三索引数据,其中,所述第三索引数据为所述第二索引数据中的一部分索引数据;determining third index data according to the retrieval frequency of the second index data, wherein the third index data is a part of the second index data;

采用所述第三索引数据替换第一索引数据,以将所述第三索引数据存储至所述内存区域。replacing the first index data with the third index data, so as to store the third index data in the memory area.

中央处理器422还可用于执行如下步骤:The central processing unit 422 can also be used to perform the following steps:

接收数据检索请求;receive data retrieval requests;

根据所述数据检索请求从所述内存区域中获取所述第一索引数据所对应的第一检索结果,并从所述硬盘区域获取所述第二索引数据所对应的第二检索结果;Obtaining a first retrieval result corresponding to the first index data from the memory area according to the data retrieval request, and obtaining a second retrieval result corresponding to the second index data from the hard disk area;

若所述第一检索结果与所述第二检索结果一致,则发送所述第一检索结果或所述第二检索结果。If the first search result is consistent with the second search result, sending the first search result or the second search result.

中央处理器422还可用于执行如下步骤:The central processing unit 422 can also be used to perform the following steps:

获取所述第一检索结果的第一更新时长以及所述第二检索结果的第二更新时长,其中,所述第一更新时长为获取所述第一检索结果的时刻到当前时刻之间的时间长度,所述第二更新时长为获取所述第二检索结果的时刻到所述当前时刻之间的时间长度;Obtain a first update duration of the first retrieval result and a second update duration of the second retrieval result, wherein the first update duration is the time between the moment when the first retrieval result is obtained and the current moment length, the second update duration is the time length between the moment when the second retrieval result is obtained and the current moment;

中央处理器422具体用于执行如下步骤:The central processing unit 422 is specifically configured to perform the following steps:

若所述第一更新时长小于所述第二更新时长,则发送所述第一检索结果;If the first update duration is less than the second update duration, then send the first retrieval result;

若所述第一更新时长大于所述第二更新时长,则发送所述第二检索结果。If the first update duration is longer than the second update duration, then send the second retrieval result.

中央处理器422还可用于执行如下步骤:The central processing unit 422 can also be used to perform the following steps:

接收数据检索请求;receive data retrieval requests;

根据所述数据检索请求从所述硬盘区域获取所述第二索引数据所对应的检索结果;Acquiring a retrieval result corresponding to the second index data from the hard disk area according to the data retrieval request;

发送所述第二索引数据所对应的检索结果。Sending the retrieval result corresponding to the second index data.

所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.

在本发明所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or May be integrated into another system, or some features may be ignored, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.

所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-OnlyMemory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the essence of the technical solution of the present invention or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes such as U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk.

以上所述,以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。As mentioned above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: it can still understand the foregoing The technical solutions recorded in each embodiment are modified, or some of the technical features are replaced equivalently; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims (12)

1. A method for updating index data, the method being applied to an index data updating device, the index data updating device comprising a memory area and a hard disk area, the method comprising:
receiving an index data update request;
updating the index data in the memory area according to the index data updating request, and obtaining first index data;
if the first index data meets the preset index data updating condition, updating the index data in the hard disk area according to the first index data, and obtaining second index data;
receiving a data retrieval request;
acquiring a first search result corresponding to the first index data from the memory area according to the data search request, and acquiring a second search result corresponding to the second index data from the hard disk area;
If the first search result is consistent with the second search result, acquiring a first update time length of the first search result and a second update time length of the second search result, wherein the first update time length is the time length from the moment of acquiring the first search result to the current moment, and the second update time length is the time length from the moment of acquiring the second search result to the current moment;
if the first updating duration is smaller than the second updating duration, the first search result is sent;
and if the first updating time length is longer than the second updating time length, sending the second search result.
2. The method of claim 1, wherein after updating the index data in the memory area according to the index data update request and obtaining the first index data, the method further comprises:
acquiring the data quantity corresponding to the first index data;
judging whether the data quantity corresponding to the first index data reaches a storage capacity threshold value, if so, determining that the first index data meets the preset index data updating condition.
3. The method of claim 1, wherein after updating the index data in the memory area according to the index data update request and obtaining the first index data, the method further comprises:
detecting a time value corresponding to the first index data;
judging whether the time value corresponding to the first index data reaches a target time or not, if so, determining that the first index data meets the preset index data updating condition.
4. A method according to any one of claims 1 to 3, wherein updating the index data in the hard disk area according to the first index data and obtaining second index data comprises:
and merging the first index data with the index data in the hard disk area to obtain the second index data.
5. The method of claim 4, wherein after updating the index data in the hard disk area according to the first index data and obtaining the second index data, the method further comprises:
determining third index data according to the retrieval frequency of the second index data, wherein the third index data is part of index data in the second index data;
And replacing the first index data with the third index data to store the third index data into the memory area.
6. An index data updating device, wherein the index data updating device includes a memory area and a hard disk area, the index data updating device includes:
the first receiving module is used for receiving an index data updating request;
the first updating module is used for updating the index data in the memory area according to the index data updating request received by the first receiving module and obtaining first index data;
the second updating module is used for updating the index data in the hard disk area according to the first index data if the first index data updated by the first updating module meets the preset index data updating condition, and obtaining second index data;
the second receiving module is used for receiving a data retrieval request;
the second acquisition module is used for acquiring a first search result corresponding to the first index data from the memory area according to the data search request received by the second receiving module, and acquiring a second search result corresponding to the second index data from the hard disk area;
A third obtaining module, configured to obtain a first update duration of the first search result and a second update duration of the second search result if the first search result obtained by the second obtaining module is consistent with the second search result, where the first update duration is a time length from a time point when the first search result is obtained to a current time point, and the second update duration is a time length from a time point when the second search result is obtained to the current time point;
a first sending unit, configured to send the first search result if the first update duration is less than the second update duration;
and the second sending unit is used for sending the second search result if the first updating time length is longer than the second updating time length.
7. The index data updating device according to claim 6, characterized in that the index data updating device further comprises:
the first acquisition module is used for acquiring the data quantity corresponding to the first index data after the first update module updates the index data in the memory area according to the index data update request and obtains the first index data;
The first judging module is used for judging whether the data volume corresponding to the first index data acquired by the first acquiring module reaches a storage capacity threshold or not, and if yes, determining that the first index data meets the preset index data updating condition.
8. The index data updating device according to claim 6, characterized in that the index data updating device further comprises:
the detection module is used for detecting a time value corresponding to the first index data after the first update module updates the index data in the memory area according to the index data update request and obtains the first index data;
and the second judging module is used for judging whether the moment value corresponding to the first index data detected by the detecting module reaches the target moment or not, and if so, determining that the first index data meets the preset index data updating condition.
9. The index data updating apparatus according to any one of claims 6 to 8, wherein said second updating module includes:
and the processing unit is used for merging the first index data with the index data in the hard disk area and obtaining the second index data.
10. The index data updating device according to claim 9, characterized in that the index data updating device further comprises:
the determining module is used for determining third index data according to the retrieval frequency of the second index data after the second updating module updates the index data in the hard disk area according to the first index data and obtains the second index data, wherein the third index data is part of index data in the second index data;
and the replacing module is used for replacing the first index data by the third index data determined by the determining module so as to store the third index data into the memory area.
11. A server comprising a memory and a processor;
the memory stores a program;
the processor is configured to execute the program to implement the method for updating index data according to any one of claims 1 to 5.
12. A computer readable storage medium, wherein a program is stored in the computer readable storage medium, which when executed by a computer device, implements the method for updating index data according to any one of claims 1 to 5.
CN201710225105.0A 2017-04-07 2017-04-07 A method and related device for updating index data Active CN108694188B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710225105.0A CN108694188B (en) 2017-04-07 2017-04-07 A method and related device for updating index data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710225105.0A CN108694188B (en) 2017-04-07 2017-04-07 A method and related device for updating index data

Publications (2)

Publication Number Publication Date
CN108694188A CN108694188A (en) 2018-10-23
CN108694188B true CN108694188B (en) 2023-05-12

Family

ID=63842129

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710225105.0A Active CN108694188B (en) 2017-04-07 2017-04-07 A method and related device for updating index data

Country Status (1)

Country Link
CN (1) CN108694188B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110737747A (en) * 2019-09-12 2020-01-31 苏宁云计算有限公司 data operation method, device and system
CN112069175B (en) * 2020-08-25 2024-03-29 北京五八信息技术有限公司 Data query method and device and electronic equipment
CN112115154A (en) * 2020-09-27 2020-12-22 北京有竹居网络技术有限公司 Data processing and data query method, device, equipment and computer readable medium
CN113076456A (en) * 2021-03-25 2021-07-06 咪咕文化科技有限公司 Data search processing method and device, electronic equipment and storage medium
CN113449155B (en) * 2021-07-16 2024-02-27 百度在线网络技术(北京)有限公司 Method, apparatus, device and medium for feature representation processing
US20240054102A1 (en) * 2022-08-12 2024-02-15 Google Llc Scalable and Cost-Efficient Information Retrieval Architecture for Massive Datasets

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102081625A (en) * 2009-11-30 2011-06-01 中国移动通信集团北京有限公司 Data query method and query server

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101295323B (en) * 2008-06-30 2011-11-02 腾讯科技(深圳)有限公司 Processing method and system for index updating
US9262526B2 (en) * 2010-01-28 2016-02-16 Karl Muth System and method for compiling search results using information regarding length of time users spend interacting with individual search results
CN102169507B (en) * 2011-05-26 2013-03-20 厦门雅迅网络股份有限公司 Implementation method of distributed real-time search engine
CN102339315B (en) * 2011-09-30 2014-11-19 亿赞普(北京)科技有限公司 Index updating method and system of advertisement data
CN103473229A (en) * 2012-06-06 2013-12-25 深圳市世纪光速信息技术有限公司 Memory retrieval system and method, and real-time retrieval system and method
CN103942289B (en) * 2014-04-12 2017-01-25 广西师范大学 Memory caching method oriented to range querying on Hadoop
CN104021223B (en) * 2014-06-25 2017-07-25 国家电网公司 The access method and device of a kind of Cluster Database measuring point
CN104199892B (en) * 2014-08-26 2018-01-30 上海爱数信息技术股份有限公司 A kind of index reading/writing method for merging asynchronous refresh based on compression
CN104537112B (en) * 2015-01-20 2017-07-14 成都携恩科技有限公司 A kind of method of safe cloud computing
CN104899249B (en) * 2015-05-04 2018-07-13 中国科学院信息工程研究所 Reliable index upgrade system and method under a kind of mass data

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102081625A (en) * 2009-11-30 2011-06-01 中国移动通信集团北京有限公司 Data query method and query server

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
An integrated system for building enterprise taxonomies;Li Zhang 等;Information Retrieval;第10卷;1-55 *
一种基于共享执行策略的间隔查询优化技术;周新 等;软件学报;第27卷(第12期);3067-3084 *

Also Published As

Publication number Publication date
CN108694188A (en) 2018-10-23

Similar Documents

Publication Publication Date Title
CN108694188B (en) A method and related device for updating index data
US11645183B1 (en) User interface for correlation of virtual machine information and storage information
US10013317B1 (en) Restoring a volume in a storage system
AU2011312036B2 (en) Automatic replication and migration of live virtual machines
US8914379B2 (en) Index constructing method, search method, device and system
US20130212070A1 (en) Management apparatus and management method for hierarchical storage system
CN103902410B (en) The data backup accelerated method of cloud storage system
WO2015180432A1 (en) Clustering storage method and device
CN104081391A (en) Single instantiation method using file clone and file storage system utilizing the same
CN110347651A (en) Method of data synchronization, device, equipment and storage medium based on cloud storage
JP2015510174A (en) Location independent files
US10642530B2 (en) Global occupancy aggregator for global garbage collection scheduling
CN113760847A (en) Log data processing method, device, device and storage medium
CN105493080B (en) The method and apparatus of data de-duplication based on context-aware
CN115168416A (en) Data caching method, device, storage medium and electronic device
CN111159130A (en) A kind of small file merging method and electronic device
CN109343859A (en) Information processing method, device and storage medium
CN111371583B (en) Server capacity expansion method and device, server and storage medium
US11989159B2 (en) Hybrid snapshot of a global namespace
WO2017145214A1 (en) Computer system for transferring data from center node to edge node
Hou et al. Pacaca: mining object correlations and parallelism for enhancing user experience with cloud storage
WO2024022330A1 (en) Metadata management method based on file system, and related device thereof
CN114385657A (en) Data storage method, device and storage medium
JP5810982B2 (en) SEARCH DEVICE, SEARCH METHOD, AND SEARCH PROGRAM
CN117807174A (en) Index processing method, apparatus, computer device, medium, and program product

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
TG01 Patent term adjustment
TG01 Patent term adjustment