WO2016155385A1 - 一种生成文档索引的方法和装置以及一种搜索方法和装置 - Google Patents
一种生成文档索引的方法和装置以及一种搜索方法和装置 Download PDFInfo
- Publication number
- WO2016155385A1 WO2016155385A1 PCT/CN2015/099579 CN2015099579W WO2016155385A1 WO 2016155385 A1 WO2016155385 A1 WO 2016155385A1 CN 2015099579 W CN2015099579 W CN 2015099579W WO 2016155385 A1 WO2016155385 A1 WO 2016155385A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- location
- document
- index table
- related information
- search
- 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.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/951—Indexing; Web crawling techniques
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/31—Indexing; Data structures therefor; Storage structures
- G06F16/316—Indexing structures
- G06F16/328—Management therefor
Definitions
- the present invention relates to the field of Internet search technologies, and in particular, to a method and apparatus for generating a document index, and a search method and apparatus.
- inverted indexes are used to store a mapping of the storage location of a word in a document or set of documents under full-text search. It is the most commonly used data structure in document retrieval systems. By inverting the index, you can quickly get a list of documents containing the word based on the word.
- the inverted index records where each word appears in the document (also known as an offset).
- information related to these locations including but not limited to:
- the inverted index uses 16 bits to record each occurrence of each word.
- the general implementation is to expand 16bit to 32bit, low 16-bit storage location, high 16bit storage and position-related information.
- this method brought the following problems: On the one hand, the index grows too much, because the main content of the inverted index is the position of each word. If this value is expanded from 16bit to 32bit, the entire inverted index will double. . On the other hand, most locations have valuable information about the location, so most of the storage resources are actually wasted.
- the present invention has been made in order to provide a method and apparatus for generating a document index and a search method and apparatus that overcome the above problems or at least partially solve the above problems.
- a method of generating a document index comprising:
- only one location in the document has the information related to the location that needs to be recorded, and the recording is performed in the second index table.
- a search method comprising:
- the document is returned as a search result to the search requester based on the location in the document corresponding to the search term and the location-related information.
- an apparatus for generating a document index comprising:
- a first index table generating unit adapted to generate a first index table indexed by words in the document for recording a word and a position of the word in the document;
- a second index table generating unit configured to generate a second index table indexed by a location in the document, for recording location and location-related information; wherein, only one location in the document has related information to be recorded Recording is performed in the second index table.
- a search device comprising:
- a receiving unit configured to receive a search term sent by the search requester
- a search unit adapted to find a location of the search term in the document according to the first index table, and to find information related to the location of the search term in the document according to the second index table; wherein the first index table is used to record the word and the The position of the word in the document, the second index table is used to record the location and location-related information;
- the sending unit is adapted to return the document as a search result to the search requester based on the location and the location-related information in the document corresponding to the search term.
- a computer program comprising a computer readable generation A code, when the computer readable code is run on a computing device, causes the computing device to perform the method of generating a document index as described above, or cause the computing device to perform the search method described above.
- a computer readable medium wherein the computer program described above is stored.
- the first index table which is indexed by a word in a document, for recording a word and a position of the word in the document according to the present invention, generates a second index table indexed by a position in the document for recording Location and location-related information, wherein only one location in the document has information related to the location that needs to be recorded, the technical solution for recording in the second index table, location and location-related information Separating the storage makes it more convenient and flexible to extend the location-related information in the index, and only the actual location-related information occupies the storage space, thereby avoiding waste of the storage resources.
- FIG. 1 shows a flow chart of a method of generating a document index in accordance with one embodiment of the present invention
- FIG. 2 shows a flow chart of a search method in accordance with one embodiment of the present invention
- FIG. 3 is a structural diagram of an apparatus for generating a document index according to an embodiment of the present invention.
- FIG. 4 is a block diagram showing a search device according to an embodiment of the present invention.
- Figure 5 shows schematically a block diagram of a computing device for performing the method according to the invention
- Figure 6 shows schematically for holding or carrying out the method according to the invention.
- the storage unit of the program code The storage unit of the program code.
- FIG. 1 shows a flow chart of a method of generating a document index in accordance with one embodiment of the present invention. As shown in Figure 1, the method includes:
- Step S110 generating a first index table indexed by words in the document, for recording a word and a position of the word in the document;
- Step S120 generating a second index table indexed by the location in the document, for recording location and location-related information; wherein only one location in the document has information related to the location that needs to be recorded, Recording is performed in the second index table.
- the method shown in FIG. 1 separates the location and the location-related information, so that it is more convenient and flexible to extend the location-related information in the index, and only the actual location-related information occupies the storage space, thereby avoiding storage. Waste of resources.
- the step S120 of the method shown in FIG. 1 generates a second index table indexed by a location in the document, and the location information and the location-related information are included in the second index table. Recording location-related information in the form of a triple;
- the triplet consists of the following three elements: the start position of the position-related information, denoted by start; the length of the position-related information, denoted by len; and the type of position-related information, with rype.
- the triplet can be expressed as ⁇ start, len, type>.
- Start indicates the starting position of the information related to the location, such as the starting position of the title number
- Len represents the length of the location-related information, such as the length of the book name
- Type indicates the type of information related to the location, such as the related information is the title number.
- each location is recorded by 16 bits (i.e., 16 bits); location-related information is retrieved from the location to the triple list (i.e., the second index table).
- the start position start of the position-related information is recorded by 16 bits; the position is related
- the length len of the information is recorded by 8 bits; the type type of the position-related information is recorded by 8 bits.
- location-related information is separated from the location on the storage, which actually makes the extension of the location-related information more flexible and convenient.
- FIG. 2 shows a flow chart of a search method in accordance with one embodiment of the present invention. As shown in Figure 2, the method includes:
- Step S210 receiving a search term sent by the search requester
- Step S220 finding a location of the search term in the document according to the first index table; wherein the first index table is used to record the word and the position of the word in the document;
- Step S230 finding information related to the location of the search term in the document according to the second index table; wherein the second index table is used for recording the location and the location-related information;
- Step S240 returning the document as a search result to the search requester based on the location in the document corresponding to the search term and the location-related information.
- the method shown in FIG. 2 can return search results based on location and location-related information to the search requester, and the location-related information is stored separately from the location, the location-related information is more flexible, and the index space is greatly saved.
- FIG. 3 shows a block diagram of an apparatus for generating a document index according to an embodiment of the present invention.
- the apparatus 300 for generating a document index includes:
- the first index table generating unit 310 is adapted to generate a first index table indexed by words in the document, for recording a word and a position of the word in the document;
- the second index table generating unit 320 is adapted to generate a second index table indexed by the location in the document for recording the location and the location-related information; wherein, only one location in the document has related information to be recorded Only in the second index table is recorded.
- the device shown in FIG. 3 separates the location and the location-related information, making it more convenient and flexible to extend the location-related information in the index, and only the actual location-related information exists.
- the information takes up storage space and avoids the waste of storage resources.
- the second index table generating unit 320 is adapted to record location-related information in the form of a triplet in the second index table
- the triplet is composed of the following three elements: a start position of information related to the location, a length of information related to the location, and a type of information related to the location.
- the triplet can be expressed as ⁇ start, len, type>.
- Start indicates the starting position of the information related to the location, such as the starting position of the title number
- Len represents the length of the location-related information, such as the length of the book name
- Type indicates the type of information related to the location, such as the related information is the title number.
- the first index table generating unit 310 is adapted to record each location with 16 bits; the second index table generating unit 320 is adapted to use location-related information.
- the start position is recorded with 16 bits, the length of the position-related information is recorded with 8 bits, and the type of information suitable for the position is recorded with 8 bits.
- the document includes location-related information of the feature is stored in the second index table, there is no waste. Therefore, compared to the traditional implementation, at least 40% of the index space can be saved. And the location-related information is separated from the location on the storage, which actually makes the extension of the location-related information more flexible and convenient.
- FIG. 4 shows a block diagram of a search device in accordance with one embodiment of the present invention.
- the search device 400 includes:
- the receiving unit 410 is adapted to receive a search term sent by the search requester
- the searching unit 420 is adapted to find a location of the search term in the document according to the first index table, and find information related to the location of the search term in the document according to the second index table; wherein the first index table is used to record the word And the location of the word in the document, the second index table is used to record the location and location-related information;
- the sending unit 430 is adapted to return the document as a search result to the search requester based on the location in the document corresponding to the search term and the location-related information.
- the device shown in FIG. 4 can return the search requester to the search result based on the location-related information, and the location-related information is stored separately from the location, the location-related information is more flexible, and the index space is greatly saved. .
- the first index table indexing a word in a document for recording a word and the position of the word in the document generates a second index indexed by the position in the document.
- a table for recording location and location-related information wherein only one location in the document has information related to the location that needs to be recorded, and the technical solution for recording in the second index table is
- the location-related information is stored separately, so that the location-related information is more convenient and flexible in the index, and only the actual location-related information occupies the storage space, thereby avoiding waste of the storage resources.
- modules in the devices of the embodiments can be adaptively changed and placed in one or more devices different from the embodiment.
- the modules or units or components of the embodiments may be combined into one module or unit or component, and further they may be divided into a plurality of sub-modules or sub-units or sub-components.
- at least some of the elements are mutually exclusive, and all of the features disclosed in the specification, including the accompanying claims, the abstract, and the drawings, and all processes or units of any method or apparatus so disclosed may be combined in any combination.
- Each feature disclosed in this specification may be replaced by alternative features that provide the same, equivalent or similar purpose.
- the various component embodiments of the present invention may be implemented in hardware, or in a software module running on one or more processors, or in a combination thereof.
- a microprocessor or digital signal processor may be used in practice to implement some or all of some or all of the means for generating a document index and search means in accordance with embodiments of the present invention.
- the invention can also be implemented as a device or device program (e.g., a computer program and a computer program product) for performing some or all of the methods described herein.
- Such a program implementing the invention may be stored on a computer readable medium or may be in the form of one or more signals. Such signals may be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
- Figure 5 schematically illustrates a block diagram of a computing device for performing the method in accordance with the present invention.
- the computing device conventionally includes a processor 510 and a computer program product or computer readable medium in the form of a memory 520.
- the memory 520 may be an electronic memory such as a flash memory, an EEPROM (Electrically Erasable Programmable Read Only Memory), an EPROM, a hard disk, or a ROM.
- Memory 520 has a memory space 530 for program code 531 for performing any of the method steps described above.
- storage space 530 for program code may include various program code 531 for implementing various steps in the above methods, respectively.
- the program code can be read from or written to one or more computer program products.
- These computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks. Such computer program products are typically portable or fixed storage units as described with reference to FIG.
- the storage unit may have a similar arrangement to the memory 520 in the computing device of FIG. Storage segment, storage space, etc.
- the program code can be compressed, for example, in an appropriate form.
- the storage unit comprises computer readable code 531 ' for performing the steps of the method according to the invention, ie code that can be read by a processor such as 510, which when executed by the computing device causes the calculation The device performs the various steps in the methods described above.
- the present invention is applicable to computer systems/servers that can operate with numerous other general purpose or special purpose computing system environments or configurations.
- Examples of well-known computing systems, environments, and/or configurations suitable for use with computer systems/servers include, but are not limited to, personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, based on Microprocessor systems, set-top boxes, programmable consumer electronics, networked personal computers, small computer systems, mainframe computer systems, and distributed cloud computing technology environments including any of the above, and the like.
- the computer system/server can be described in the general context of computer system executable instructions (such as program modules) being executed by a computer system.
- program modules may include routines, programs, target programs, components, logic, data structures, and the like that perform particular tasks or implement particular abstract data types.
- the computer system/server can be implemented in a distributed cloud computing environment where tasks are performed by remote processing devices that are linked through a communication network.
- program modules can be located in a local or remote computing system including storage devices On the storage medium.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Business, Economics & Management (AREA)
- General Business, Economics & Management (AREA)
- Software Systems (AREA)
Abstract
一种生成文档索引的方法和装置以及一种搜索方法和装置,其中,生成文档索引的方法包括:生成以文档中的词为索引的第一索引表,用于记录词以及该词在文档中的位置(S110),生成以文档中的位置为索引的第二索引表,用于记录位置以及与位置相关的信息,其中,只有文档中的一个位置具有需要记录的与该位置相关信息时,才在所述第二索引表中进行记录(S120)。通过将位置以及与位置相关的信息分离存储,使得在索引中扩展与位置相关的信息更加方便灵活,且只有实际存在的与位置相关的信息才占用存储空间,避免了存储资源的浪费。
Description
本发明涉及互联网搜索技术领域,具体涉及一种生成文档索引的方法和装置以及一种搜索方法和装置。
在搜索引擎系统中,倒排索引被用来存储在全文搜索下某个单词在一个文档或者一组文档中的存储位置的映射。它是文档检索系统中最常用的数据结构。通过倒排索引,可以根据单词快速获取包含这个单词的文档列表。
即倒排索引会记录每个词在文档里出现的位置(也称为偏移)。为了更好地提升搜索效果,有时需要记录与这些位置相关的信息,包括但不限于:
1.这个位置包括在书名号里;例如,《资治通鉴》中的‘通鉴’的出现就是在书名号里;
2.这个位置包括在引号里;
3.这个位置是在html标签<H3>里。
倒排索引用16个bit来记录每个词的每次出现位置,为了记录与位置相关的信息,一般的实现方式是将16bit扩充为32bit,低16位存储位置,高16bit存储与位置相关的信息。当时这种方法带来如下问题:一方面,索引增长太多,由于倒排索引的主要内容为每个词的出现位置,如果将这个值从16bit扩充到32bit,整个倒排索引会增长一倍。另一方面,大多数的位置并具备有价值的与该位置相关的信息,因此实际上大多数存储资源都被浪费了。
发明内容
鉴于上述问题,提出了本发明以便提供一种克服上述问题或者至少部分地解决上述问题的一种生成文档索引的方法和装置以及一种搜索方法和装置。
依据本发明的一个方面,提供了一种生成文档索引的方法,其中,该方法包括:
生成以文档中的词为索引的第一索引表,用于记录词以及该词在文档中的位置;
生成以文档中的位置为索引的第二索引表,用于记录位置以及与位置相关的信息;
其中,只有文档中的一个位置具有需要记录的与该位置相关信息时,才在所述第二索引表中进行记录。
依据本发明的另一个方面,提供了一种搜索方法,其中,该方法包括:
接收搜索请求方发来的搜索词;
根据第一索引表找到搜索词在文档中的位置;其中,第一索引表用于记录词以及该词在文档中的位置;
根据第二索引表找到与搜索词在文档中的位置相关的信息;其中,第二索引表用于记录位置以及与位置相关的信息;
基于所述搜索词对应的文档中的位置和与位置相关的信息,将所述文档作为搜索结果返回给搜索请求方。
依据本发明的一个方面,提供了一种生成文档索引的装置,其中,该装置包括:
第一索引表生成单元,适于生成以文档中的词为索引的第一索引表,用于记录词以及该词在文档中的位置;
第二索引表生成单元,适于生成以文档中的位置为索引的第二索引表,用于记录位置以及与位置相关的信息;其中,只有文档中的一个位置具有需要记录的相关信息时,才在所述第二索引表中进行记录。
依据本发明的另一个方面,提供了一种搜索装置,其中,该装置包括:
接收单元,适于接收搜索请求方发来的搜索词;
搜索单元,适于根据第一索引表找到搜索词在文档中的位置,以及根据第二索引表找到与搜索词在文档中的位置相关的信息;其中,第一索引表用于记录词以及该词在文档中的位置,第二索引表用于记录位置以及与位置相关的信息;
发送单元,适于基于所述搜索词对应的文档中的位置和与位置相关的信息,将所述文档作为搜索结果返回给搜索请求方。
根据本发明的又一个方面,提出了一种计算机程序,包括计算机可读代
码,当所述计算机可读代码在计算设备上运行时,导致所述计算设备执行上文所述的生成文档索引的方法,或者,导致所述计算设备执行上文所述的搜索方法。
根据本发明的再一个方面,提出了一种计算机可读介质,其中存储了上述的计算机程序。
根据本发明的这种生成以文档中的词为索引的第一索引表,用于记录词以及该词在文档中的位置,生成以文档中的位置为索引的第二索引表,用于记录位置以及与位置相关的信息,其中,只有文档中的一个位置具有需要记录的与该位置相关信息时,才在所述第二索引表中进行记录的技术方案,将位置以及与位置相关的信息分离存储,使得在索引中扩展与位置相关的信息更加方便灵活,且只有实际存在的与位置相关的信息才占用存储空间,避免了存储资源的浪费。
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:
图1示出了根据本发明一个实施例的一种生成文档索引的方法的流程图;
图2示出了根据本发明一个实施例的一种搜索方法的流程图;
图3示出了根据本发明一个实施例的一种生成文档索引的装置的结构图;
图4示出了根据本发明一个实施例的一种搜索装置的结构图;
图5示意性地示出了用于执行根据本发明的方法的计算设备的框图;以及
图6示意性地示出了用于保持或者携带实现根据本发明的方法的
程序代码的存储单元。
下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。
图1示出了根据本发明一个实施例的一种生成文档索引的方法的流程图。如图1所示,该方法包括:
步骤S110,生成以文档中的词为索引的第一索引表,用于记录词以及该词在文档中的位置;
步骤S120,生成以文档中的位置为索引的第二索引表,用于记录位置以及与位置相关的信息;其中,只有文档中的一个位置具有需要记录的与该位置相关信息时,才在所述第二索引表中进行记录。
图1所示的方法,将位置以及与位置相关的信息分离存储,使得在索引中扩展与位置相关的信息更加方便灵活,且只有实际存在的与位置相关的信息才占用存储空间,避免了存储资源的浪费。
在本发明的一个实施例中,图1所示方法的步骤S120所述生成以文档中的位置为索引的第二索引表,用于记录位置以及与位置相关的信息包括:在第二索引表中,以三元组的形式记录与位置相关的信息;
所述三元组由以下三元构成:与位置相关的信息的开始位置,用start表示;与位置相关的信息的长度,用len表示;与位置相关的信息的类型,用rype。
三元组具体可表示为<start,len,type>。
Start表示与位置相关的信息的开始位置,如书名号的起始位置;
len表示与位置相关的信息的长度,如书名号的长度;
type表示与位置相关的信息的类型,如该相关的信息为书名号。
在本发明的一个实施例中每个位置由16比特位(即16bit)来记录;通过位置到三元组列表(即所述的第二索引表)里检索与位置相关的信息。所述与位置相关的信息的开始位置start由16比特位来记录;所述与位置相关
的信息的长度len由8比特位来记录;所述与位置相关的信息的类型type由8比特位来记录。
同时,只有当文档包括特征的与位置相关的信息时才在第二索引表中存储,不存在浪费。因此相对于传统的实现方式,能够节约至少40%的索引空间。
并且与位置相关的信息在存储上与位置分离,实际上使得位置相关信息的扩展更加灵活方便。
图2示出了根据本发明一个实施例的一种搜索方法的流程图。如图2所示该方法包括:
步骤S210,接收搜索请求方发来的搜索词;
步骤S220,根据第一索引表找到搜索词在文档中的位置;其中,第一索引表用于记录词以及该词在文档中的位置;
步骤S230,根据第二索引表找到与搜索词在文档中的位置相关的信息;其中,第二索引表用于记录位置以及与位置相关的信息;
步骤S240,基于所述搜索词对应的文档中的位置和与位置相关的信息,将所述文档作为搜索结果返回给搜索请求方。
图2所示的方法能够给搜索请求方返回基于位置和与位置相关的信息的搜索结果,并且与位置相关的信息与位置分离存储,位置相关信息的扩展更加灵活,且大大节省了索引空间。
图3示出了根据本发明一个实施例的一种生成文档索引的装置的结构图。如图3所示,该生成文档索引的装置300包括:
第一索引表生成单元310,适于生成以文档中的词为索引的第一索引表,用于记录词以及该词在文档中的位置;
第二索引表生成单元320,适于生成以文档中的位置为索引的第二索引表,用于记录位置以及与位置相关的信息;其中,只有文档中的一个位置具有需要记录的相关信息时,才在所述第二索引表中进行记录。
图3所示的装置,将位置以及与位置相关的信息分离存储,使得在索引中扩展与位置相关的信息更加方便灵活,且只有实际存在的与位置相关的信
息才占用存储空间,避免了存储资源的浪费。
在本发明的一个实施例中,第二索引表生成单元320,适于在第二索引表中,以三元组的形式记录与位置相关的信息;
其中,所述三元组由以下三元构成:与位置相关的信息的开始位置,与位置相关的信息的长度;与位置相关的信息的类型。
三元组具体可表示为<start,len,type>。
Start表示与位置相关的信息的开始位置,如书名号的起始位置;
len表示与位置相关的信息的长度,如书名号的长度;
type表示与位置相关的信息的类型,如该相关的信息为书名号。
在本发明的一个实施例中,所述第一索引表生成单元310,适于将每个位置用16比特位来记录;所述第二索引表生成单元320,适于将与位置相关的信息的开始位置用16比特位来记录,将与位置相关的信息的长度用8比特位来记录,适于与将位置相关的信息的类型用8比特位来记录。
同时,只有当文档包括特征的与位置相关的信息时才在第二索引表中存储,不存在浪费。因此相对于传统的实现方式,能够节约至少40%的索引空间。并且与位置相关的信息在存储上与位置分离,实际上使得位置相关信息的扩展更加灵活方便。
图4示出了根据本发明一个实施例的一种搜索装置的结构图。如图4所示,该搜索装置400包括:
接收单元410,适于接收搜索请求方发来的搜索词;
搜索单元420,,适于根据第一索引表找到搜索词在文档中的位置,以及根据第二索引表找到与搜索词在文档中的位置相关的信息;其中,第一索引表用于记录词以及该词在文档中的位置,第二索引表用于记录位置以及与位置相关的信息;
发送单元430,适于基于所述搜索词对应的文档中的位置和与位置相关的信息,将所述文档作为搜索结果返回给搜索请求方。
图4所示的装置能够给搜索请求方返回给基于置和与位置相关的信息的搜索结果,并且与位置相关的信息与位置分离存储,位置相关信息的扩展更加灵活,且大大节省了索引空间。
综上所述,根据本发明的这种生成以文档中的词为索引的第一索引表,用于记录词以及该词在文档中的位置,生成以文档中的位置为索引的第二索引表,用于记录位置以及与位置相关的信息,其中,只有文档中的一个位置具有需要记录的与该位置相关信息时,才在所述第二索引表中进行记录的技术方案,将位置以及与位置相关的信息分离存储,使得在索引中扩展与位置相关的信息更加方便灵活,且只有实际存在的与位置相关的信息才占用存储空间,避免了存储资源的浪费。
需要说明的是:
在此提供的算法和显示不与任何特定计算机、虚拟装置或者其它设备固有相关。各种通用装置也可以与基于在此的示教一起使用。根据上面的描述,构造这类装置所要求的结构是显而易见的。此外,本发明也不针对任何特定编程语言。应当明白,可以利用各种编程语言实现在此描述的本发明的内容,并且上面对特定语言所做的描述是为了披露本发明的最佳实施方式。
在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。
类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。
本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者
单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。
此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在下面的权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。
本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的生成文档索引的装置和搜索装置中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。
例如,图5示意性地示出了用于执行根据本发明的方法的计算设备的框图。该计算设备传统上包括处理器510和以存储器520形式的计算机程序产品或者计算机可读介质。存储器520可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。存储器520具有用于执行上述方法中的任何方法步骤的程序代码531的存储空间530。例如,用于程序代码的存储空间530可以包括分别用于实现上面的方法中的各种步骤的各个程序代码531。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。这些计算机程序产品包括诸如硬盘,紧致盘(CD)、存储卡或者软盘之类的程序代码载体。这样的计算机程序产品通常为如参考图6所述的便携式或者固定存储单元。该存储单元可以具有与图5的计算设备中的存储器520类似布置
的存储段、存储空间等。程序代码可以例如以适当形式进行压缩。通常,存储单元包括用于执行根据本发明的方法步骤的计算机可读代码531’,即可以由例如诸如510之类的处理器读取的代码,这些代码当由计算设备运行时,导致该计算设备执行上面所描述的方法中的各个步骤。
应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。
此外,还应当注意,本说明书中使用的语言主要是为了可读性和教导的目的而选择的,而不是为了解释或者限定本发明的主题而选择的。因此,在不偏离所附权利要求书的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。对于本发明的范围,对本发明所做的公开是说明性的,而非限制性的,本发明的范围由所附权利要求书限定。
本发明可以应用于计算机系统/服务器,其可与众多其它通用或专用计算系统环境或配置一起操作。适于与计算机系统/服务器一起使用的众所周知的计算系统、环境和/或配置的例子包括但不限于:个人计算机系统、服务器计算机系统、瘦客户机、厚客户机、手持或膝上设备、基于微处理器的系统、机顶盒、可编程消费电子产品、网络个人电脑、小型计算机系统、大型计算机系统和包括上述任何系统的分布式云计算技术环境,等等。
计算机系统/服务器可以在由计算机系统执行的计算机系统可执行指令(诸如程序模块)的一般语境下描述。通常,程序模块可以包括例程、程序、目标程序、组件、逻辑、数据结构等等,它们执行特定的任务或者实现特定的抽象数据类型。计算机系统/服务器可以在分布式云计算环境中实施,分布式云计算环境中,任务是由通过通信网络链接的远程处理设备执行的。在分布式云计算环境中,程序模块可以位于包括存储设备的本地或远程计算系统
存储介质上。
本文中所称的“一个实施例”、“实施例”或者“一个或者多个实施例”意味着,结合实施例描述的特定特征、结构或者特性包括在本发明的至少一个实施例中。此外,请注意,这里“在一个实施例中”的词语例子不一定全指同一个实施例。
Claims (10)
- 一种生成文档索引的方法,其中,该方法包括:生成以文档中的词为索引的第一索引表,用于记录词以及该词在文档中的位置;生成以文档中的位置为索引的第二索引表,用于记录位置以及与位置相关的信息;其中,只有文档中的一个位置具有需要记录的与该位置相关信息时,才在所述第二索引表中进行记录。
- 如权利要求1所述的方法,其中,所述生成以文档中的位置为索引的第二索引表,用于记录位置以及与位置相关的信息包括:在第二索引表中,以三元组的形式记录与位置相关的信息;所述三元组由以下三元构成:与位置相关的信息的开始位置;与位置相关的信息的长度;与位置相关的信息的类型。
- 如权利要求2所述的方法,其中,所述每个位置由16比特位来记录;所述与位置相关的信息的开始位置由16比特位来记录;所述与位置相关的信息的长度由8比特位来记录;所述与位置相关的信息的类型由8比特位来记录。
- 一种搜索方法,其中,该方法包括:接收搜索请求方发来的搜索词;根据第一索引表找到搜索词在文档中的位置;其中,第一索引表用于记录词以及该词在文档中的位置;根据第二索引表找到与搜索词在文档中的位置相关的信息;其中,第二索引表用于记录位置以及与位置相关的信息;基于所述搜索词对应的文档中的位置和与位置相关的信息,将所述文档作为搜索结果返回给搜索请求方。
- 一种生成文档索引的装置,其中,该装置包括:第一索引表生成单元,适于生成以文档中的词为索引的第一索引表,用于记录词以及该词在文档中的位置;第二索引表生成单元,适于生成以文档中的位置为索引的第二索引表,用于记录位置以及与位置相关的信息;其中,只有文档中的一个位置具有需 要记录的相关信息时,才在所述第二索引表中进行记录。
- 如权利要求5所述的装置,其中第二索引表生成单元,适于在第二索引表中,以三元组的形式记录与位置相关的信息;其中,所述三元组由以下三元构成:与位置相关的信息的开始位置,与位置相关的信息的长度;与位置相关的信息的类型。
- 如权利要求6所述的装置,其中,所述第一索引表生成单元,适于将每个位置用16比特位来记录;所述第二索引表生成单元,适于将与位置相关的信息的开始位置用16比特位来记录,将与位置相关的信息的长度用8比特位来记录,适于与将位置相关的信息的类型用8比特位来记录。
- 一种搜索装置,其中,该装置包括:接收单元,适于接收搜索请求方发来的搜索词;搜索单元,适于根据第一索引表找到搜索词在文档中的位置,以及根据第二索引表找到与搜索词在文档中的位置相关的信息;其中,第一索引表用于记录词以及该词在文档中的位置,第二索引表用于记录位置以及与位置相关的信息;发送单元,适于基于所述搜索词对应的文档中的位置和与位置相关的信息,将所述文档作为搜索结果返回给搜索请求方。
- 一种计算机程序,包括计算机可读代码,当所述计算机可读代码在计算设备上运行时,导致所述计算设备执行根据权利要求1-3中的任一项所述的生成文档索引的方法,或者,导致所述计算设备执行根据权利要求4所述的搜索方法。
- 一种计算机可读介质,其中存储了如权利要求9所述的计算机程序。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510150540.2 | 2015-03-31 | ||
| CN201510150540.2A CN104715068B (zh) | 2015-03-31 | 2015-03-31 | 一种生成文档索引的方法和装置以及一种搜索方法和装置 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2016155385A1 true WO2016155385A1 (zh) | 2016-10-06 |
Family
ID=53414394
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2015/099579 Ceased WO2016155385A1 (zh) | 2015-03-31 | 2015-12-29 | 一种生成文档索引的方法和装置以及一种搜索方法和装置 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN104715068B (zh) |
| WO (1) | WO2016155385A1 (zh) |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN104715068B (zh) * | 2015-03-31 | 2017-04-12 | 北京奇元科技有限公司 | 一种生成文档索引的方法和装置以及一种搜索方法和装置 |
| CN110096478B (zh) * | 2019-05-09 | 2021-06-29 | 中国联合网络通信集团有限公司 | 文档索引生成方法及设备 |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101131704A (zh) * | 2006-08-23 | 2008-02-27 | 国际商业机器公司 | 用于内容的位置表示的装置和方法 |
| CN102110123A (zh) * | 2009-12-29 | 2011-06-29 | 中国人民解放军国防科学技术大学 | 倒排索引建立方法 |
| CN102662926A (zh) * | 2012-03-29 | 2012-09-12 | 常州华文文字技术有限公司 | 字库的存储与访问方法 |
| US20130024459A1 (en) * | 2011-07-20 | 2013-01-24 | Microsoft Corporation | Combining Full-Text Search and Queryable Fields in the Same Data Structure |
| CN104715068A (zh) * | 2015-03-31 | 2015-06-17 | 北京奇虎科技有限公司 | 一种生成文档索引的方法和装置以及一种搜索方法和装置 |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US7765214B2 (en) * | 2005-05-10 | 2010-07-27 | International Business Machines Corporation | Enhancing query performance of search engines using lexical affinities |
| CN102023989B (zh) * | 2009-09-23 | 2012-10-10 | 阿里巴巴集团控股有限公司 | 一种信息检索方法及其系统 |
| CN102033954B (zh) * | 2010-12-24 | 2012-10-17 | 东北大学 | 关系数据库中可扩展标记语言文档全文检索查询索引方法 |
-
2015
- 2015-03-31 CN CN201510150540.2A patent/CN104715068B/zh active Active
- 2015-12-29 WO PCT/CN2015/099579 patent/WO2016155385A1/zh not_active Ceased
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101131704A (zh) * | 2006-08-23 | 2008-02-27 | 国际商业机器公司 | 用于内容的位置表示的装置和方法 |
| CN102110123A (zh) * | 2009-12-29 | 2011-06-29 | 中国人民解放军国防科学技术大学 | 倒排索引建立方法 |
| US20130024459A1 (en) * | 2011-07-20 | 2013-01-24 | Microsoft Corporation | Combining Full-Text Search and Queryable Fields in the Same Data Structure |
| CN102662926A (zh) * | 2012-03-29 | 2012-09-12 | 常州华文文字技术有限公司 | 字库的存储与访问方法 |
| CN104715068A (zh) * | 2015-03-31 | 2015-06-17 | 北京奇虎科技有限公司 | 一种生成文档索引的方法和装置以及一种搜索方法和装置 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN104715068B (zh) | 2017-04-12 |
| CN104715068A (zh) | 2015-06-17 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN110866091B (zh) | 一种数据检索方法及装置 | |
| US20100287166A1 (en) | Method and system for search engine indexing and searching using the index | |
| US20150120648A1 (en) | Context-aware augmented media | |
| CN108228799B (zh) | 对象索引信息的存储方法及装置 | |
| CN106294603A (zh) | 文件存储方法及装置 | |
| WO2016091069A1 (zh) | 一种数据操作方法及装置 | |
| CN105404627A (zh) | 一种用于确定搜索结果的方法与设备 | |
| US11030263B2 (en) | System and method for updating a search index | |
| JP6932360B2 (ja) | オブジェクト検索方法、装置およびサーバ | |
| WO2015081848A1 (zh) | 社交化扩展搜索方法及相应的装置、系统 | |
| CN106326309A (zh) | 一种数据查询方法和装置 | |
| US10885085B2 (en) | System to organize search and display unstructured data | |
| CN107704202A (zh) | 一种数据快速读写的方法和装置 | |
| WO2017114164A1 (zh) | 一种图数据的处理方法和装置 | |
| US20160072739A1 (en) | Method and system for playing multimedia files | |
| CN113590623B (zh) | 一种用于数据深分页查询的方法、装置及设备 | |
| CN106156070A (zh) | 一种查询方法、文件合并方法与相关装置 | |
| CN110609966B (zh) | 一种页面显示方法、装置及其设备 | |
| WO2015055062A1 (zh) | 数据文件写入方法及系统、数据文件读取方法及系统 | |
| WO2016101758A1 (zh) | 一种跨集群的数据同步方法和装置 | |
| CN107391535A (zh) | 在文档应用中搜索文档的方法及装置 | |
| CN115061990A (zh) | 日志存储方法、日志检索方法、装置、设备及存储介质 | |
| WO2018227931A1 (zh) | 信息判断方法及装置 | |
| CN106227769A (zh) | 数据存储方法及装置 | |
| WO2015154682A1 (zh) | 一种网络请求处理方法、网络服务器和网络系统 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 15887334 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 15887334 Country of ref document: EP Kind code of ref document: A1 |