CN113535710A - Searching method, searching device, terminal equipment and storage medium - Google Patents

Searching method, searching device, terminal equipment and storage medium Download PDF

Info

Publication number
CN113535710A
CN113535710A CN202010322885.2A CN202010322885A CN113535710A CN 113535710 A CN113535710 A CN 113535710A CN 202010322885 A CN202010322885 A CN 202010322885A CN 113535710 A CN113535710 A CN 113535710A
Authority
CN
China
Prior art keywords
search
information
sub
searched
search information
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.)
Granted
Application number
CN202010322885.2A
Other languages
Chinese (zh)
Other versions
CN113535710B (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.)
Sun Yat Sen University
Original Assignee
Sun Yat Sen University
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 Sun Yat Sen University filed Critical Sun Yat Sen University
Priority to CN202010322885.2A priority Critical patent/CN113535710B/en
Publication of CN113535710A publication Critical patent/CN113535710A/en
Application granted granted Critical
Publication of CN113535710B publication Critical patent/CN113535710B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/248Presentation of query results

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application is applicable to the technical field of information, and provides a searching method, a searching device, terminal equipment and a storage medium, wherein the method comprises the following steps: when receiving information to be searched, identifying the search type of the information to be searched; if the search type is binary search, generating a plurality of pieces of sub-search information according to the information to be searched; respectively adopting the plurality of sub-search information to search, and obtaining a search result matched with each sub-search information; and outputting the search result. By the method, efficient and accurate binary search can be realized.

Description

Searching method, searching device, terminal equipment and storage medium
Technical Field
The present application belongs to the field of information technology, and in particular, relates to a search method, apparatus, terminal device, and storage medium.
Background
Modern computer systems typically store data in binary bits and have a variety of data representations such as decimal, hexadecimal, single byte, multi-byte, etc. Generally, input and output of data are in units of bytes or characters, and are not directly processed in a binary bit manner. This is also true in the field of data search, and the search patterns of mainstream search engines are usually in bytes or characters, and do not support binary bit search. However, in some scenarios, binary search still has an urgent need. Although part of special systems realize the function of binary search, the result is often acquired in a traversal mode, and the search efficiency is poor.
Data indexing is an effective means to improve data search efficiency. In the field of data indexing, suffix indexing does not need to divide words of data, indexes can be created indiscriminately for any type of data, and 100% recall ratio is achieved. The suffix index is generally in byte units, generally only supports a search mode in byte units, and cannot realize binary search. Therefore, how to implement efficient and accurate binary search in combination with data indexing technology is a problem to be solved at present.
Disclosure of Invention
In view of this, embodiments of the present application provide a search method, an apparatus, a terminal device, and a storage medium, which can implement efficient and accurate binary search.
A first aspect of an embodiment of the present application provides a search method, including:
when receiving information to be searched, identifying the search type of the information to be searched;
if the search type is binary search, generating a plurality of pieces of sub-search information according to the information to be searched;
respectively adopting the plurality of sub-search information to search, and obtaining a search result matched with each sub-search information;
and outputting the search result.
A second aspect of an embodiment of the present application provides a search apparatus, including:
the search type identification module is used for identifying the search type of the information to be searched when the information to be searched is received;
the sub-search information generation module is used for generating a plurality of pieces of sub-search information according to the information to be searched if the search type is binary search;
the sub-search information search module is used for respectively adopting the plurality of sub-search information to search and obtaining a search result matched with each sub-search information;
and the search result output module is used for outputting the search result.
A third aspect of embodiments of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the search method according to the first aspect when executing the computer program.
A fourth aspect of embodiments of the present application provides a computer-readable storage medium, which stores a computer program that, when executed by a processor, implements the search method according to the first aspect.
A fifth aspect of embodiments of the present application provides a computer program product, which, when running on a terminal device, causes the terminal device to execute the search method according to the first aspect.
Compared with the prior art, the embodiment of the application has the following advantages:
according to the embodiment of the application, when the information to be searched is received, the search type of the information to be searched is identified, so that the search or the processing can be respectively carried out according to different search types. Specifically, if the search type is binary search, a plurality of pieces of sub-search information may be generated according to the information to be searched, the information to be searched is expanded into a byte mode, and then the plurality of pieces of sub-search information in the byte mode are respectively used for searching to obtain a search result matched with each piece of sub-search information; and for the information to be searched with the search type of byte search, the information can be directly searched in a byte search mode. According to the method and the device, the binary search problem of any type of data can be solved by adopting the mode expansion and suffix index technology, and the efficiency and performance of binary search are effectively improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the embodiments or the description of the prior art will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the application, and that for a person skilled in the art, other drawings can be derived from them without inventive effort.
FIG. 1 is a diagram illustrating a suffix index creation process according to an embodiment of the present application;
FIG. 2 is a flow chart illustrating steps of a search method according to an embodiment of the present application;
FIG. 3 is a flow chart illustrating steps of another search method according to an embodiment of the present application;
FIG. 4 is a diagram illustrating an embodiment of the present application in which information to be searched is expanded into complete bytes;
FIG. 5 is a system architecture diagram of a search method according to an embodiment of the present application;
FIG. 6 is a schematic diagram of a search process of a search method according to an embodiment of the present application;
FIG. 7 is a schematic diagram of a search apparatus according to an embodiment of the present application;
fig. 8 is a schematic diagram of a terminal device according to an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. However, it will be apparent to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
The technical solution of the present application will be described below by way of specific examples.
The searching method disclosed by the embodiment of the application solves the binary searching problem of any type of data by adopting the mode expansion and suffix index technology. When the search method of the embodiment of the present application is implemented, an index needs to be created for original data in units of bytes. Therefore, the process of creating a suffix index of the original data will be described first.
Referring to FIG. 1, a schematic diagram of a suffix index creation process according to an embodiment of the present application is shown. According to the creation process shown in fig. 1, for the original data to be added, an index library may be first specified. If the designated index library exists, adding the original data, and storing the added original data as a local file; and if the designated index library does not exist, storing the original data as a local file after the corresponding index library is created. In the storage process, if the storage fails, failure information may be prompted to a user, otherwise, metadata information corresponding to the stored original data may be recorded, where the metadata information is used as a description of the original data and may include information such as a data size, a segment ID where the original data is located, and an offset in the segment. On the other hand, for stored raw data, a suffix index of the raw data may be created. The original data, the suffix index of the original data and the metadata together constitute complete suffix index information of the original data.
In this embodiment, the original data may be stored as a local file, and the index database records the original data and its suffix index information, which may be stored in units of bytes.
Referring to fig. 2, a schematic flow chart illustrating steps of a search method according to an embodiment of the present application is shown, which may specifically include the following steps:
s201, when receiving information to be searched, identifying the search type of the information to be searched;
in this embodiment, the information to be searched may refer to search contents input by the user in one search task. The search content may have a corresponding search pattern, such as a byte pattern, a binary pattern, and the like.
S202, if the search type is binary search, generating a plurality of pieces of sub-search information according to the information to be searched;
in this embodiment, when the information to be searched is in the binary mode, the search type is binary search; when the information to be searched is byte mode, the search type is byte search.
For the information to be searched in the byte mode, the accurate search can be directly carried out in the byte search mode, and for the information to be searched in the binary mode, the sub-search information in the plurality of byte modes can be generated on the basis of the original information to be searched, and then the accurate search is carried out in the byte search mode.
S203, respectively adopting the plurality of sub-search information to search, and obtaining a search result matched with each sub-search information;
in this embodiment, each piece of sub-search information is byte-pattern search information generated by pattern expansion on the basis of the information to be searched. Therefore, when searching, each piece of sub-search information can be searched respectively according to the byte searching mode to obtain the corresponding search result.
And S204, outputting the search result.
After the search of all the sub-search information is completed in the byte search mode, the result obtained by the search can be output to the user.
It should be noted that, because each piece of sub-search information is generated by means of pattern expansion, and there may be duplication in the corresponding search result, when outputting the search result, it is also possible to deduplicate all the search results, and then output the search result after deduplication to the user.
In the embodiment of the application, when the information to be searched is received, the search type of the information to be searched is identified, so that the search or the processing can be respectively carried out according to different search types. Specifically, if the search type is binary search, a plurality of pieces of sub-search information may be generated according to the information to be searched, the information to be searched is expanded into a byte mode, and then the plurality of pieces of sub-search information in the byte mode are respectively used for searching to obtain a search result matched with each piece of sub-search information; and for the information to be searched with the search type of byte search, the information can be directly searched in a byte search mode. According to the method and the device, the binary search problem of any type of data can be solved by adopting the mode expansion and suffix index technology, and the efficiency and performance of binary search are effectively improved.
Referring to fig. 3, a schematic step flow diagram of another search method according to an embodiment of the present application is shown, which may specifically include the following steps:
s301, when receiving information to be searched, identifying the search type of the information to be searched;
in this embodiment, the information to be searched may refer to search contents input by the user in one search task. The search content may have a corresponding search pattern, such as a byte pattern, a binary pattern, and the like.
S302, if the search type is binary search, expanding the information to be searched into complete bytes to obtain a plurality of pieces of sub-search information;
in this embodiment, when the information to be searched is in the binary mode, the search type is binary search; when the information to be searched is byte mode, the search type is byte search.
For the binary mode to-be-searched information, which contains at least one bit, the binary mode to-be-searched information can be expanded into a complete byte in a mode of mode expansion, and a plurality of pieces of sub-search information are obtained. Each sub search information may be one complete byte.
In a specific implementation, a binary sign symbol may be filled before and/or after bits included in the information to be searched, and the information to be searched is expanded into a complete byte to obtain a plurality of pieces of sub-search information, where the complete byte includes a preset number of bits. That is, one sub search information contains 8 bits.
Fig. 4 is a schematic diagram illustrating an embodiment of the present application, in which information to be searched is expanded into complete bytes. Taking the information to be searched of the current search task as "01" as an example, the search type of the search task is binary search, which indicates that all matching results with binary bits of "01" in the original data need to be searched.
According to the expansion mode shown in fig. 4, binary notation symbols "0" and "1" may be filled before and after "01", respectively, and expanded into a complete byte, such as "01000000", "01000001", and so on.
The number of bits of the sub search information obtained by expansion is set to be an integer multiple of 8, and corresponds to one or more bytes.
In this embodiment, the number of sub search information may be determined according to the number of search bits of the information to be searched in the binary mode, where the number of search bits is the number of occurrences of the symbols "0" and "1" in the information to be searched in the binary mode. As shown in fig. 4, the number of search bits of the information to be searched "01" is n ═ 2, and the number of sub search information obtained by expanding the information is (8-n +1) × 2^ (8-n) ═ 8-2+1) × 2^ (8-2) ═ 448. Wherein the symbol ^ represents the square.
S303, judging whether key value pairs corresponding to the sub-search information exist in a mapping table one by one aiming at each sub-search information;
in this embodiment, for the information "01" to be searched, if all positions of the information "01" appearing in the index database need to be found, all cases after the "01" is expanded into the byte mode need to be considered, and at this time, each expanded byte mode may possibly obtain a result meeting the search condition. Therefore, the 448 sub-searches obtained by expansion need to be processed one by one.
In a specific implementation, for each piece of sub-search information, whether a key value pair corresponding to the sub-search information exists in the mapping table can be judged one by one, and then a search result corresponding to the sub-search information is obtained. The mapping table may be a key value type storage, and is implemented by a Map container in Java or C + +, where a key is search information, a value is a search result corresponding to the search information, and the search result is a coordinate of the search information in original data.
If the mapping table has a key-value pair corresponding to the sub-search information, S304 may be executed; if there is no key-value pair corresponding to the sub search information in the mapping table, S305 may be performed.
It should be noted that, if there is no mapping table, a new mapping table is created, where the content of the new mapping table is initially empty, and the new mapping table may record a plurality of key value pair information, where a key value pair may be used to record sub-search information and a search result matching the sub-search information, where the key is the sub-search information and the value is the search result matching the sub-search information.
S304, returning the key value pair, wherein the key value pair comprises sub-search information and a search result matched with the sub-search information;
in this embodiment, the mapping table is responsible for temporarily storing all search results of a search task once, before searching a plurality of pieces of sub-search information, whether corresponding results exist in the current sub-search information can be judged through the mapping table, and if the corresponding results exist in the current sub-search information, the results can be directly returned, so that the time overhead of repeatedly searching the same sub-search information is saved.
S305, searching an offset position corresponding to the sub-search information in a preset suffix index, and acquiring a search result matched with the sub-search information according to the offset position;
if the mapping table does not have the key value pair corresponding to the current sub-search information, that is, all keys of the mapping table are not equal to the byte mode corresponding to the current sub-search information, the sub-search information of the byte mode can be accurately searched.
When the sub-search information of the byte mode is accurately searched, the offset position corresponding to the sub-search information can be searched in the preset suffix index, and the search result matched with the sub-search information is obtained according to the offset position.
In a specific implementation, since the suffix indexes of the original data are dictionary-ordered, the offset position of a certain byte in the original data can be quickly matched in the suffix indexes by means of a binary search algorithm. If the offset position does not exist, the byte mode does not exist in the original data; if the offset position exists, the matching result can be counted according to the offset position. There may be multiple matching results, indicating that the byte pattern occurs multiple times in the original data. If the byte pattern hits in the mapping table, it indicates that the byte pattern has been searched, and the search need not be repeated.
In this embodiment, after the search result matched with the sub-search information is obtained according to the offset position, the sub-search information may be used as a key, the search result matched with the sub-search information may be used as a value, and the new key-value pair is added to the mapping table to complete the update of the mapping table, so as to reduce the time overhead of the subsequent search.
S306, removing duplication of the search results matched with the sub-search information to obtain target search results, and outputting the target search results.
In this embodiment, after the search of all the sub-search information is completed, the obtained search result may include repeated content. Therefore, the search results corresponding to all the sub-search information can be deduplicated, the deduplicated target search result is obtained, and then the target search result is output to the user.
It should be noted that, if the search type of the information to be searched is byte search, the search may be directly performed in the manner of S303 to S305. That is, firstly, judging whether a key value pair corresponding to the information to be searched in the byte mode exists in the mapping table, and if the key value pair corresponding to the information to be searched exists in the mapping table, directly returning the key value pair; if the mapping table does not have the key value pair corresponding to the information to be searched, the offset position corresponding to the information to be searched can be searched in a preset suffix index, and the search result matched with the information to be searched is obtained according to the offset position.
In the embodiment of the application, a suffix index is created for original data by taking bytes as a unit, in order to realize binary search, on the index by taking bytes as a unit, an original binary bit search mode is expanded into a plurality of byte modes in a mode expansion manner, so that binary search is realized, and the efficiency and the performance of data search can be improved; the data search of the embodiment is realized by using suffix index, thereby avoiding the traversal search of the data and realizing the recall ratio of any type of data by 100 percent.
For the convenience of understanding, the search method of the embodiment of the present application is described below with reference to a specific example.
Fig. 5 is a schematic diagram of a system architecture to which the search method according to an embodiment of the present application is applied. The system architecture shown in fig. 5 includes a data indexing module, a data searching module, and a pattern expanding module. The data indexing module is responsible for creating a suffix index for original data and maintaining the original data and suffix index information thereof, and the index information is stored by taking bytes as a unit; the data search module carries out a data search task in a self-adaptive mode according to a search mode by receiving and analyzing a data search request, wherein the search mode can be divided into a byte mode and a non-byte mode, and the non-byte mode realizes binary search through mode expansion; the mode expansion module is responsible for expanding the binary search mode into a plurality of byte modes, and the data search module searches the search information of all the expanded byte modes one by one.
On the basis of the architecture shown in fig. 5, referring to fig. 6, a search process diagram of a search method according to an embodiment of the present application is shown, where the search process may include the following steps:
s601, inputting search information '01' by a user, and designating the search type as binary search;
s602, judging whether the search type is binary search. If the search type is binary search, go to S603; if the search type is byte search, turning to S605;
and S603, performing mode expansion on the search information. For example, 0 and 1 are respectively filled before and after the search information to expand the search information into a plurality of sub-search information in byte units, such as the search information "01" can be expanded into a plurality of sub-search information such as "01000000" and "01000001";
s604, if the search information "01" indicates that the number of search bits n is 2 (the number of search bits is equal to 0 or 1), the number of scalable sub-search information is (8-n +1) × 2^ (8-n) ═ 8-2+1) × 2^ (8-2) ═ 448;
s605 processes 448 sub-search information items one by one. For the search information "01", if all positions of the search information appearing in the index library need to be found, all conditions after the "01" is expanded into the byte mode need to be considered, and at this time, the sub-search information of each expanded byte mode can possibly obtain a result meeting the search condition;
s606, searching all sub-search information (byte mode) and judging whether the mapping table exists or not. If yes, go to S607; otherwise, go to S608;
s607, judging whether the mapping table hits the current sub-search information, if yes, turning to S611; otherwise, turning to S609;
and S608, creating a mapping table, wherein the mapping table is a key value type storage and is realized by a Map container in Java or C + + language and the like, keys are search information, and values are search results corresponding to the search information. The mapping table is used for temporarily storing all search results of a search task, before searching a plurality of pieces of sub-search information, whether the current sub-search information has a corresponding result can be judged through the mapping table, if so, the result can be directly returned, so that the time overhead of repeatedly searching the same sub-search information is saved;
s609, if the sub-search information (byte mode) is not hit in the mapping table (namely all keys of the mapping table are not equal to the sub-search information), accurately searching the sub-search information of the byte mode; since the suffix index of the original data is dictionary-ordered, the offset position of a certain byte in the original data can be quickly matched in the suffix index by means of a binary search algorithm. If the offset position does not exist, the byte mode does not exist in the original data; and if the offset position exists, counting the matching result according to the offset position. There may be multiple matching results, indicating that the sub-search information appears multiple times in the original data. If the sub-search information is hit in the mapping table, it indicates that the sub-search information has already been searched, and the search is not repeated, turning to S611;
s610, updating a mapping table, adding currently searched sub-search information and one or more corresponding matching results thereof to the mapping table, wherein keys are the sub-search information, values are all the matching results corresponding to the sub-search information, and the values are stored in a List container form;
s611, obtaining all matching results of the sub-search information in the original data, namely all positions of the sub-search information in the original data;
s612, judging whether the searching of all the sub-searching information is finished, if so, turning to S613; otherwise, go to S605 until all the sub search information searches are finished.
And S613, if all the sub-search information is searched, removing the duplication of all the search results and adding the search results to a search result set to obtain a binary search result of the original search information.
It should be noted that, the sequence numbers of the steps in the foregoing embodiments do not mean the execution sequence, and the execution sequence of each process should be determined by the function and the inherent logic of the process, and should not constitute any limitation on the implementation process of the embodiments of the present application.
Referring to fig. 7, a schematic diagram of a search apparatus according to an embodiment of the present application is shown, which may specifically include the following modules:
a search type identification module 701, configured to identify a search type of information to be searched when the information to be searched is received;
a sub-search information generating module 702, configured to generate multiple pieces of sub-search information according to the information to be searched if the search type is binary search;
a sub-search information search module 703, configured to search by using the plurality of pieces of sub-search information respectively, to obtain a search result matched with each piece of sub-search information;
and a search result output module 704, configured to output the search result.
In this embodiment of the present application, the sub-search information generating module 702 may specifically include the following sub-modules:
and the information to be searched expansion submodule is used for expanding the information to be searched into complete bytes and obtaining a plurality of sub-search information with the bytes as units.
In this embodiment of the present application, the information to be searched includes at least one bit, and the information to be searched expansion submodule may specifically include the following units:
and the information to be searched expansion unit is used for filling binary notation symbols before and/or after the bits contained in the information to be searched respectively, expanding the information to be searched into complete bytes and obtaining a plurality of pieces of sub-search information, wherein the complete bytes contain a preset number of bits.
In this embodiment, the sub-search information searching module 703 may specifically include the following sub-modules:
a mapping table judging submodule, configured to judge, one by one, whether a key-value pair corresponding to the sub-search information exists in a mapping table for each piece of sub-search information;
a mapping table returning submodule, configured to return a key value pair including the sub-search information and a search result matched with the sub-search information if the key value pair corresponding to the sub-search information exists in the mapping table;
the sub-search information searching submodule is used for searching an offset position corresponding to the sub-search information in a preset suffix index if the mapping table does not have a key value pair corresponding to the sub-search information, and acquiring a search result matched with the sub-search information according to the offset position;
and the new mapping table creating submodule is used for creating a new mapping table comprising a plurality of key value pairs if the mapping table does not exist, the content of the mapping table is empty initially, and the key value pairs in the new mapping table are used for recording the sub-search information and the search result matched with the sub-search information, wherein the key is the sub-search information, and the value is the search result matched with the sub-search information.
In this embodiment of the present application, the sub-search information searching module 703 may further include the following sub-modules:
and the mapping table updating submodule is used for taking the sub-search information as a key and taking a search result matched with the sub-search information as a value to serve as a new key-value pair, and adding the new key-value pair to the mapping table.
In this embodiment, the search result output module 704 may specifically include the following sub-modules:
the search result duplication removing submodule is used for removing duplication of the search results matched with the plurality of pieces of sub-search information to obtain target search results;
and the target search result output submodule is used for outputting the target search result.
In this embodiment, the apparatus may further include the following modules:
a byte search mapping table judging module, configured to judge whether a key value pair corresponding to the information to be searched exists in a mapping table if the search type is byte search;
the byte searching module is used for returning a key value pair if the key value pair corresponding to the information to be searched exists in the mapping table, wherein the key value pair comprises the information to be searched and a searching result matched with the information to be searched; if the mapping table does not have the key value pair corresponding to the information to be searched, searching an offset position corresponding to the information to be searched in a preset suffix index, and acquiring a search result matched with the information to be searched according to the offset position.
For the apparatus embodiment, since it is substantially similar to the method embodiment, it is described relatively simply, and reference may be made to the description of the method embodiment section for relevant points.
Referring to fig. 8, a schematic diagram of a terminal device according to an embodiment of the present application is shown. As shown in fig. 8, the terminal device 800 of the present embodiment includes: a processor 810, a memory 820, and a computer program 821 stored in the memory 820 and operable on the processor 810. The processor 810, when executing the computer program 821, implements steps in various embodiments of the above-described search method, such as steps S201 to S204 shown in fig. 2. Alternatively, the processor 810, when executing the computer program 821, implements the functions of the modules/units in the device embodiments, such as the functions of the modules 701 to 704 shown in fig. 7.
Illustratively, the computer program 821 may be partitioned into one or more modules/units that are stored in the memory 820 and executed by the processor 810 to accomplish the present application. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which may be used to describe the execution of the computer program 821 in the terminal device 800. For example, the computer program 821 may be divided into a search type identification module, a sub-search information generation module, a sub-search information search module, and a search result output module, and the specific functions of each module are as follows:
the search type identification module is used for identifying the search type of the information to be searched when the information to be searched is received;
the sub-search information generation module is used for generating a plurality of pieces of sub-search information according to the information to be searched if the search type is binary search;
the sub-search information search module is used for respectively adopting the plurality of sub-search information to search and obtaining a search result matched with each sub-search information;
and the search result output module is used for outputting the search result.
The terminal device 800 may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices. The terminal device 800 may include, but is not limited to, a processor 810 and a memory 820. Those skilled in the art will appreciate that fig. 8 is only one example of a terminal device 800 and does not constitute a limitation of terminal device 800, and may include more or fewer components than shown, or some components may be combined, or different components, e.g., terminal device 800 may also include input-output devices, network access devices, buses, etc.
The Processor 810 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 820 may be an internal storage unit of the terminal device 800, such as a hard disk or a memory of the terminal device 800. The memory 820 may also be an external storage device of the terminal device 800, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and so on, provided on the terminal device 800. Further, the memory 820 may also include both an internal storage unit and an external storage device of the terminal apparatus 800. The memory 820 is used for storing the computer program 821 and other programs and data required by the terminal device 800. The memory 820 may also be used to temporarily store data that has been output or is to be output.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same. Although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (10)

1. A method of searching, comprising:
when receiving information to be searched, identifying the search type of the information to be searched;
if the search type is binary search, generating a plurality of pieces of sub-search information according to the information to be searched;
respectively adopting the plurality of sub-search information to search, and obtaining a search result matched with each sub-search information;
and outputting the search result.
2. The method according to claim 1, wherein the generating a plurality of sub-search information according to the information to be searched comprises:
and expanding the information to be searched into complete bytes to obtain a plurality of pieces of sub-search information.
3. The method of claim 2, wherein the information to be searched comprises at least one bit, and the expanding the information to be searched into a complete byte to obtain a plurality of sub-search information comprises:
filling binary notation symbols before and/or after the bits contained in the information to be searched respectively, and expanding the information to be searched into complete bytes to obtain a plurality of pieces of sub-search information, wherein the complete bytes contain a preset number of bits.
4. The method according to any one of claims 1 to 3, wherein the respectively performing a search using the plurality of sub-search information to obtain a search result matching each sub-search information comprises:
aiming at each piece of sub-search information, judging whether a key value pair corresponding to the sub-search information exists in a mapping table one by one;
if the mapping table has a key value pair corresponding to the sub-search information, returning the key value pair, wherein the key value pair comprises the sub-search information and a search result matched with the sub-search information;
if the mapping table does not have the key value pair corresponding to the sub-search information, searching an offset position corresponding to the sub-search information in a preset suffix index, and acquiring a search result matched with the sub-search information according to the offset position;
and if the mapping table does not exist, creating a new mapping table, wherein the content of the new mapping table is empty initially, and a plurality of key value pairs can be stored, and the key value pairs are used for recording the sub-search information and the search result matched with the sub-search information, wherein the key is the sub-search information, and the value is the search result matched with the sub-search information.
5. The method according to claim 4, further comprising, after obtaining the search result matching the sub-search information according to the offset position:
and taking the sub-search information as a key, taking a search result matched with the sub-search information as a value, taking the value as a new key-value pair, and adding the new key-value pair to the mapping table.
6. The method of claim 4, wherein outputting the search results comprises:
removing duplication of the search results matched with the sub-search information to obtain target search results;
and outputting the target search result.
7. The method of claim 1, 2, 3, 5, or 6, further comprising:
if the search type is byte search, judging whether a key value pair corresponding to the information to be searched exists in a mapping table;
if the mapping table has a key value pair corresponding to the information to be searched, returning the key value pair, wherein the key value pair comprises the information to be searched and a search result matched with the information to be searched;
if the mapping table does not have the key value pair corresponding to the information to be searched, searching an offset position corresponding to the information to be searched in a preset suffix index, and acquiring a search result matched with the information to be searched according to the offset position.
8. A search apparatus, comprising:
the search type identification module is used for identifying the search type of the information to be searched when the information to be searched is received;
the sub-search information generation module is used for generating a plurality of pieces of sub-search information according to the information to be searched if the search type is binary search;
the sub-search information search module is used for respectively adopting the plurality of sub-search information to search and obtaining a search result matched with each sub-search information;
and the search result output module is used for outputting the search result.
9. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the search method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the search method according to any one of claims 1 to 7.
CN202010322885.2A 2020-04-22 2020-04-22 Searching method, searching device, terminal equipment and storage medium Active CN113535710B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010322885.2A CN113535710B (en) 2020-04-22 2020-04-22 Searching method, searching device, terminal equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010322885.2A CN113535710B (en) 2020-04-22 2020-04-22 Searching method, searching device, terminal equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113535710A true CN113535710A (en) 2021-10-22
CN113535710B CN113535710B (en) 2023-12-15

Family

ID=78124056

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010322885.2A Active CN113535710B (en) 2020-04-22 2020-04-22 Searching method, searching device, terminal equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113535710B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1890662A (en) * 2003-09-29 2007-01-03 千兆科技(深圳)有限公司 Content oriented index and search method and system
CN102945242A (en) * 2006-11-01 2013-02-27 起元技术有限责任公司 Managing storage method, system, and computer system
US20150006577A1 (en) * 2013-06-28 2015-01-01 Khalifa University of Science, Technology, and Research Method and system for searching and storing data
CN106354746A (en) * 2015-07-13 2017-01-25 富士通株式会社 Searching method, and searching device
CN107567621A (en) * 2015-05-06 2018-01-09 厄尔扬·韦斯特哥特科技公司 For performing the method, system and computer program product of numeric search
CN107977458A (en) * 2017-12-19 2018-05-01 深圳马可孛罗科技有限公司 A kind of Airport information filter method and system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1890662A (en) * 2003-09-29 2007-01-03 千兆科技(深圳)有限公司 Content oriented index and search method and system
CN102945242A (en) * 2006-11-01 2013-02-27 起元技术有限责任公司 Managing storage method, system, and computer system
US20150006577A1 (en) * 2013-06-28 2015-01-01 Khalifa University of Science, Technology, and Research Method and system for searching and storing data
CN107567621A (en) * 2015-05-06 2018-01-09 厄尔扬·韦斯特哥特科技公司 For performing the method, system and computer program product of numeric search
CN106354746A (en) * 2015-07-13 2017-01-25 富士通株式会社 Searching method, and searching device
CN107977458A (en) * 2017-12-19 2018-05-01 深圳马可孛罗科技有限公司 A kind of Airport information filter method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
贾 浩: "改进的二进制搜索防碰撞算法", 《微型机与应用》, vol. 36, no. 16, pages 23 - 29 *

Also Published As

Publication number Publication date
CN113535710B (en) 2023-12-15

Similar Documents

Publication Publication Date Title
JP6998928B2 (en) Methods, appliances, equipment, and media for storing and querying data
US11249999B2 (en) Memory efficient searching
CN107729371B (en) Data indexing and querying method, device, equipment and storage medium of block chain
CN107368527B (en) Multi-attribute index method based on data stream
CN110597855B (en) Data query method, terminal device and computer readable storage medium
CN107704202B (en) Method and device for quickly reading and writing data
CN107357843B (en) Massive network data searching method based on data stream structure
CN111475105B (en) Monitoring data storage method, monitoring data storage device, monitoring data server and storage medium
WO2018097846A1 (en) Edge store designs for graph databases
CN111159329A (en) Sensitive word detection method and device, terminal equipment and computer-readable storage medium
JP2888188B2 (en) Information retrieval device
WO2021174836A1 (en) Differential package generation method and apparatus, computer device, and storage medium
CN105760418B (en) Method and system for performing cross-column search on relational database table
CN110888981A (en) Title-based document clustering method and device, terminal equipment and medium
CN114840487A (en) Metadata management method and device for distributed file system
CN111045994B (en) File classification retrieval method and system based on KV database
CN113535710B (en) Searching method, searching device, terminal equipment and storage medium
CN114547086B (en) Data processing method, device, equipment and computer readable storage medium
KR101828466B1 (en) Method and apparatus for providing an object-based storage interface on the storage device based on file system
CN111813769B (en) Data processing method and device
CN113760237A (en) Compiling address updating method and device, terminal equipment and readable storage medium
US8136064B2 (en) Bijectively mapping character string to integer values in integrated circuit design data
CN111078671A (en) Method, device, equipment and medium for modifying data table field
JPH08190571A (en) Document retrieval method
CN110888870A (en) Data storage table query method, partition server and electronic equipment

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