# US 2014/0156671 A1 · Index Constructing Method, Search Method, Device and System

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2014/0156671 A1
- Document ID: US20140156671A1
- Status: Published application
- Kind: A1
- Application number: 14/234,058
- Filed: 2012-06-12
- Published: 2014-06-05
- Earliest claimed: 2011-07-21
- Assignees: Tencent Technology (Shenzhen) Company Limited
- Inventors: Zhengping Zhu; Chao Ma; Yan Shen
- Web page: https://patentgrep.com/patent/US20140156671A1

## CPC

- G06F 16/22: Indexing; Data structures therefor; Storage structures
- G06F 16/2272: {Management thereof}
- G06F 16/13: File access structures, e.g. distributed indices (arrangements of input from, or output to, record carriers G06F3/06)
- G06F 16/134: {Distributed indices}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

The present disclosure discloses an index constructing method, search method, device and system. The index constructing method includes: constructing data obtained in each preset time period into a primary index segment, respectively, and merging the constructed primary index segments into a primary index segment set after each preset time period is over; copying and merging each primary index segment in the primary index segment set into a corresponding large index segment, to obtain a large index segment set; and sending the primary index segments in the primary index segment set or the large index segments in the large index segment set to a search device to provide a search service. The present disclosure constructs the primary index segments on the basis of time, merges the constructed primary index segments into the large index segment, and provides the search service simultaneously with the primary index segments or the large index segments, thus, improving search speed.

## Claims

### Claim 1

An index constructing method comprising:
constructing data obtained in each preset time period into a primary index segment, respectively, and merging the constructed primary index segment into a primary index segment set after each preset time period is over;
copying each primary index segment in the primary index segment set and merging the copied primary index segments into a corresponding large index segment, to obtain a large index segment set; and
sending the primary index segments in the primary index segment set or the large index segments in the large index segment set to a search device to provide search service;
wherein the copying each primary index segment in the primary index segment set and merging the copied primary index segments into a corresponding large index segment specifically includes:
copying each primary index segment in the primary index segment set in turn according to time sequence, and merging the copied primary index segments into the corresponding large index segment; wherein the corresponding large index segment is a large index segment which is in the large index segment set and neighbors a free memory.

### Claim 2

(canceled)

### Claim 3 (depends on 1)

The method of claim 1, wherein after merging the constructed primary index segments into a corresponding large index segment, the method further includes:
every each preset period, deleting primary index segments which are constructed before the each preset period from the primary index segment set.

### Claim 4 (depends on 1)

The method of claim 1, wherein after the copying each primary index segment in the primary index segment set and merging the copied primary index segments into a corresponding large index segment, to obtain a large index segment set, the method further includes:
backing up each large index segment in the large index segment set.

### Claim 5 (depends on 4)

The method of claim 4, wherein each of the primary index segment and the large index segment includes a sequence number value and a sign of whether being complete;
when copying each primary index segment in the primary index segment set and merging the copied primary index segments into a corresponding large index segment, a sequence number value of the large index segment after merged is the larger sequence number value of a sequence number value of the primary index segment and a sequence number value of the large index segment when merging;
the sending the primary index segments in the primary index segment set or the large index segments in the large index segment set to a search device to provide search service specifically includes:
receiving an index segment application sent from the search device, the application carrying a sequence number value and a sign of whether being complete;
sending corresponding index segments to the search device according to the sequence number value and sign of whether being complete carried in the application, the corresponding index segments being primary index segments of the primary index segment set or large index segments of the large index segment set.

### Claim 6 (depends on 5)

The method of claim 5, wherein the returning corresponding index segments to the search device according to the sequence number value and sign of whether being complete carried in the application, specifically includes:
if the sequence number value carried in the application is null, reading backed up index segments and sending the backed up index segments to the search device;
if the sequence number value carried in the application is non-null and the application carries a sign of being incomplete, returning an index segment with a sequence number value the same as the sequence number value carried in the application to the search device;
if the sequence number value carried in the application is non-null and the application carries a sign of being complete, returning an index segment with a sequence number value which is the next sequence number value of the sequence number value carried in the application to the search device.

### Claim 7

An index constructing device comprising:
a constructing module configured to construct data obtained in each preset time period into a primary index segment, respectively, and merge the constructed primary index segment into a primary index segment set after each preset time period is over;
a first merging module configured to copy each primary index segment in the primary index segment set obtained by the constructing module and merge the copied primary index segments into a corresponding large index segment to obtain a large index segment set; and
a sending module configured to send the primary index segments in the primary index segment set obtained by the constructing module or the large index segments in the large index segment set obtained by the first merging module to a search device to provide search service;
wherein the first merging module is specifically configured to copy, in turn according to time sequence, each primary index segment in the primary index segment set obtained by the constructing module through merging, and merge the copied primary index segments into a corresponding large index segment which is a large index segment in the large index segment set and neighbors a free memory.

### Claim 8

(canceled)

### Claim 9 (depends on 7)

The device of claim 7, wherein the device further includes:
a deletion module configured to, after the constructing module merges the constructed primary index segment into the primary index segment set, every each preset period, delete primary index segments which are constructed before the each preset period from the primary index segment set.

### Claim 10 (depends on 7)

The device of claim 7, wherein the device further includes:
a backup module configured to, after the first merging module copies each primary index segment in the primary index segment set obtained by the constructing module and merges the copied primary index segments into a corresponding large index segment to obtain a large index segment set, back up each large index segment in the large index segment set.

### Claim 11 (depends on 10)

The device of claim 10, wherein each of the primary index segment constructed by the constructing module and the large index segment obtained by the first merging module through merging includes a sequence number value and a sign of whether being complete;
when the first merging module copies each primary index segment in the primary index segment set obtained by the constructing module and merges the copied primary index segments into a corresponding large index segment, a sequence number value of the large index segment after merged is the larger of a sequence number value of the primary index segment and a sequence number value of the large index segment when merging;
the sending module specifically includes:
a first receiving unit configured to receive an index segment application sent from the search device, the application carrying a sequence number value and a sign of whether being complete;
a first sending unit configured to, send corresponding index segments to the search device according to the sequence number value and sign of whether being complete carried in the application received by the first receiving unit, the corresponding index segments being primary index segments of the primary index segment set or large index segments of the large index segment set.

### Claim 12 (depends on 11)

The device of claim 11, wherein the first sending unit is specifically configured to, if the sequence number value carried in the application received by the first receiving unit is null, read backed up index segments and send the backed up index segments to the search device; if the sequence number value carried in the application received by the first receiving unit is non-null and the application carries a sign of being incomplete, return an index segment with a sequence number value the same as the sequence number value carried in the application to the search device; if the sequence number value carried in the application received by the first receiving unit is non-null and the application carries a sign of being complete, return an index segment with a sequence number value which is the next sequence number value of the sequence number value carried in the application to the search device.

### Claim 13

A search method comprising:
every each preset period, obtaining a first-level index segment from an index constructing device, and merging the obtained first-level index segment into a first-level index segment set;
copying each first-level index segment in the first-level index segment set and merging the copied first-level index segments into a corresponding second-level index segment to obtain a second-level index segment set;
providing search service according to the first-level index segments in the first-level index segment set and the second-level index segments in the second-level index segment set;
wherein each of the first-level index segment and the second-level index segment includes a sequence number value and a sign of whether being complete;
every each preset period, obtaining a first-level index segment from an index constructing device, specifically includes:
every each preset period, sending an index segment application to the index constructing device, the application carrying a sequence number value and a sign of whether being complete; the sequence number value being the largest sequence number value of those of already existed index segments or null;
receiving the index segment sent by the index constructing device according to the sequence number value and sign of whether being complete, and taking the received index segment as a first-level index segment;
when copying each first-level index segment in the first-level index segment set and merging the copied first-level index segments into a corresponding second-level index segment, a sequence number value of the second-level index segment after merged is the larger sequence number value of a sequence number value of the first-level index segment and a sequence number value of the second-level index segment when merging.

### Claim 14 (depends on 13)

The method of claim 13, wherein the copying each first-level index segment in the first-level index segment set and merging the copied first-level index segments into a corresponding second-level index segment, specifically includes:
copying each first-level index segment in the first-level index segment set in turn according to time sequence and merging the copied first-level index segments into a corresponding second-level index segment; wherein the corresponding second-level index segment is a second-level index segment which is in the second-level index segment set and neighbors a free memory.

### Claim 15

(canceled)

### Claim 16

A search device comprising:
an obtaining module configured to, every each preset period, obtain a first-level index segment from an index constructing device, and merge the obtained first-level index segment into a first-level index segment set;
a second merging module configured to copy each first-level index segment in the first-level index segment set obtained by the obtaining module, and merge the copied first-level index segments into a corresponding second-level index segment to obtain a second-level index segment set;
a search module configured to provide search service according to the first-level index segments in the first-level index segment set obtained by the obtaining module and the second-level index segments in the second-level index segment set obtained by the second merging module;
wherein the second merging module is specifically configured to copy each first-level index segment in the first-level index segment set in turn according to time sequence, and merge the copied first-level index segments into a corresponding second-level index segment; the corresponding second-level index segment is a second-level index segment which is in the second-level index segment set and neighbors a free memory.

### Claim 17

(canceled)

### Claim 18 (depends on 16)

The device of claim 16, wherein each of the first-level index segment obtained by the obtaining module and the second-level index segment obtained by the second merging module includes a sequence number value and a sign of whether being complete;
the obtaining module specifically includes:
a second sending unit configured to, every each preset period, send an index segment application to the index constructing device, the application carrying a sequence number value and a sign of whether being complete;
a second receiving unit configured to receive the index segment sent by the index constructing device according to the sequence number value and sign of whether being complete sent by the second sending unit, and take the received index segment as a first-level index segment and merge the first-level index segment into a corresponding second-level index segment;
when the second merging module copies each first-level index segment in the first-level index segment set obtained by the obtaining module and merges the copied first-level index segments into the corresponding second-level index segment, a sequence number value of the second-level index segment after merged is the larger sequence number value of a sequence number value of the first-level index segment and a sequence number value of the second-level index segment when merging.

### Claim 19

(canceled)
