CN107025265B - Search method, device, system and generation method of command converter - Google Patents

Search method, device, system and generation method of command converter Download PDF

Info

Publication number
CN107025265B
CN107025265B CN201710086905.9A CN201710086905A CN107025265B CN 107025265 B CN107025265 B CN 107025265B CN 201710086905 A CN201710086905 A CN 201710086905A CN 107025265 B CN107025265 B CN 107025265B
Authority
CN
China
Prior art keywords
search
application
search engine
command
result
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710086905.9A
Other languages
Chinese (zh)
Other versions
CN107025265A (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.)
Advanced New Technologies Co Ltd
Advantageous New Technologies Co Ltd
Original Assignee
Advanced New Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Advanced New Technologies Co Ltd filed Critical Advanced New Technologies Co Ltd
Priority to CN201710086905.9A priority Critical patent/CN107025265B/en
Publication of CN107025265A publication Critical patent/CN107025265A/en
Application granted granted Critical
Publication of CN107025265B publication Critical patent/CN107025265B/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/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • G06F16/24534Query rewriting; Transformation
    • 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/245Query processing
    • G06F16/2452Query translation
    • G06F16/24526Internal representations for queries

Landscapes

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

Abstract

The application discloses a search method, a device and a system and a generation method of a command converter, wherein the search method comprises the following steps: receiving a search request which is sent by an application and meets a preset specification; converting the search request into a search command recognizable by a search engine matching the requirements of the application; searching according to the search command and the search engine and generating a search result, and converting the search result into an application result which can be identified by application according to a preset format; and returning the application result to the application. By using the embodiment of the application, the search function can be ensured to be available after the application or the search engine is changed, and the waste of development resources is reduced.

Description

Search method, device, system and generation method of command converter
Technical Field
The present application relates to the field of computer technologies, and in particular, to a search method, apparatus, system, and method for generating a command converter.
Background
The amount of information in the internet is extremely large, and the search function can conveniently and quickly acquire needed information from the internet, so that a search engine (hereinafter referred to as an engine) is generated. The information search is completed by sending a specific search command (hereinafter, referred to as a command) to a corresponding engine. Through different development languages or different development ideas, developers develop various engines, such as Sol and elastic search, which are Lucene-based search engines, and distributed real-time search engines HA3, and the like, which are different engines and have different advantages and disadvantages. The application developer will select the appropriate engine as desired.
In the prior art, after a developer of an application program (hereinafter referred to as an application) selects a suitable search engine, a converter is configured between the application and the engine, so that a search request (hereinafter referred to as a request) sent by the application can be converted into a command which can be recognized by the engine, and a search result is converted into an application result which can be recognized by the application according to a preset format, thereby completing search.
However, in practical applications, applications may change the search engine according to changes in demand, for example, the processing efficiency of the existing search engine cannot meet the increase of traffic, so the search engine with higher processing efficiency needs to be changed; or the output format of the search request is modified when optimization improvement is performed on the application, and the like. This requires the developer to re-adapt the request output format or the changed search engine interface according to the modified request, and if the request format is modified or the search engine is changed many times, the re-adaptation needs to be performed many times, which is a waste of development resources (including manpower and material resources).
Disclosure of Invention
The embodiment of the application provides a search method, so that after an application or a search engine is changed, the search function is enabled to be available, and meanwhile, the waste of development resources is reduced.
The embodiment of the application provides a search device, so that after an application or a search engine is changed, the search function is enabled to be available, and meanwhile, the waste of development resources is reduced.
The embodiment of the application provides a search system, so that after an application or a search engine is changed, the search function is enabled to be available, and meanwhile, the waste of development resources is reduced.
The embodiment of the application provides a method for generating a command converter, so that after an application or a search engine is changed, the search function is enabled, and meanwhile, the waste of development resources is reduced.
In order to solve the above technical problem, the embodiment of the present application is implemented as follows:
the embodiment of the application adopts the following technical scheme:
a search method, comprising:
receiving a search request which is sent by an application and meets a preset specification;
converting the search request into a search command recognizable by a search engine matching the requirements of the application;
searching according to the search command and the search engine and generating a search result, and converting the search result into an application result which can be identified by application according to a preset format;
and returning the application result to the application.
Preferably, converting the search request into a search command recognizable by a search engine matching the requirements of the application comprises:
determining a search engine that matches the requirements of the application;
analyzing the search request;
and converting the analyzed search request through a command converter corresponding to the search engine to generate a search command which can be identified by the search engine.
Preferably, determining a search engine that matches the requirements of the application comprises:
and determining a search engine according to the specified information of the application.
Preferably, determining a search engine that matches the requirements of the application comprises:
and determining a search engine according to the application requirement and the search engine performance.
Preferably, the method comprises:
parsing the grammar of the search request to generate a grammar tree;
and converting the information in the syntax tree through a command converter corresponding to the search engine to generate a search command which can be identified by the search engine.
A search apparatus, comprising: a receiving unit, a first converting unit, a second converting unit, a returning unit, wherein,
the receiving unit receives a search request which is sent by an application and meets a preset specification;
the first conversion unit is used for converting the search request into a search command which can be identified by a search engine and is matched with the requirement of the application;
the second conversion unit is used for carrying out searching according to the searching command and the searching engine and generating a searching result, and then converting the searching result into an application result which can be identified by application according to a preset format;
and the return unit returns the application result to the application.
Preferably, the first conversion unit is provided with a first conversion unit,
determining a search engine that matches the requirements of the application;
analyzing the search request;
and converting the analyzed search request through a command converter corresponding to the search engine to generate a search command which can be identified by the search engine.
Preferably, the first conversion unit is provided with a first conversion unit,
and determining a search engine according to the specified information of the application.
Preferably, the first conversion unit is provided with a first conversion unit,
and determining a search engine according to the application requirement and the search engine performance.
Preferably, the first conversion unit is provided with a first conversion unit,
parsing the grammar of the search request to generate a grammar tree;
and converting the information in the syntax tree through a command converter corresponding to the search engine to generate a search command which can be identified by the search engine.
A search system, comprising: an application, a search module, and a search engine, wherein,
in the application of the method, the application,
sending a search request meeting a preset specification, wherein the specification is preset by a search module;
receiving an application result which can be identified by an application;
a search module for searching for a search result,
converting the search request into a search command recognizable by a search engine matched with the requirement of the application;
sending the search command to a corresponding search engine;
converting the search result into an application result which can be identified by the application according to a preset format, and then sending the application result to the application;
a search engine is provided for searching for a search query,
and searching according to the received search command and generating a search result.
A method of generating a command converter, comprising:
analyzing the search request meeting the preset specification to generate a syntax tree;
and generating a command converter aiming at the search engine according to the corresponding relation between the syntax tree and the search engine on the index structure.
According to the technical scheme provided by the embodiment of the application, the specification of the search request is preset, after the search request which is sent by the application and meets the preset specification is received, the search engine matched with the requirement of the application can be determined, the search request is converted into the search command which can be identified by the search engine, after the search result is generated according to the search command and the search engine, the search result can be converted into the application result which can be identified by the application according to the preset format, and finally the application result is returned to the application to complete the search. Compared with the prior art that adaptation needs to be carried out again only by changing or changing the search engine output by the application, so that excessive waste of development resources is caused, the method presets the specification of the receivable search request, all applications can send the search request according to the specification, the search function can be realized without considering how to adapt the search engine, the search engine can be used as a search engine, the application does not need to be considered, the search service can be provided only by considering how to butt joint with the preset specification, and the waste of development resources is greatly reduced for both sides.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only some embodiments described in the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without any creative effort.
FIG. 1 is a schematic diagram of a prior art configuration converter between an application and a search engine;
FIG. 2 is a schematic diagram of a prior art configuration converter between an application and a search engine;
fig. 3 is a schematic flowchart of a searching method provided in embodiment 1 of the present application;
fig. 4 is a schematic diagram of a search method provided in embodiment 1 of the present application;
fig. 5 is a schematic flowchart of a method for generating a command converter according to embodiment 2 of the present application;
FIG. 6 is a diagram illustrating syntax tree generation in embodiment 2 of the present application;
fig. 7 is a structural diagram of a search system provided in embodiment 3 of the present application;
fig. 8 is a structural diagram of a search device according to embodiment 4 of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be described in detail and completely with reference to the following specific embodiments of the present application and the accompanying drawings. It should be apparent that the described embodiments are only some of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
Example 1
As described above, in the prior art, a developer of an application needs to select an appropriate search engine according to the age, performance, or data size of a database searchable by the search engine, and after the selection, a converter needs to be configured between the application and the search engine, for example, as shown in fig. 1, a format of a search request output by an interface of an application program is "a", a format of a search command recognizable by the search engine "1" is "a", so a converter "aA 1" needs to be configured between the format "a" and the format "a", so that the search request in the "a" format is converted into the search command in the "a" format by the converter "aA 1". However, in practical applications, the application may change the search engine according to the change of the requirement, for example, as shown in fig. 2, the format of the search request output by the interface of the application is modified to "b", and if it needs to be adapted to the search engine "1", a converter "bA 1" needs to be configured. For another example, as shown in fig. 2, the developer of the application needs to change the search engine "1" to the search engine "2" for the sake of time efficiency and performance, and then re-adapt the search engine again. As can be seen from the figure, the format of the search request or the search engine needs to be adapted again as soon as there is a change sent, which is a serious waste for developing resources. Based on the above defects, the embodiments of the present application provide a search method to reduce waste of development resources while ensuring that a search function is available after an application or a search engine is changed. The flow diagram of the method is shown in fig. 3, and comprises the following steps:
step 11: and receiving a search request which is sent by an application and meets a preset specification.
Since the applications are various and the generated search requests are different from each other, the prior art does not unify the format, sentence, etc. of the search requests, which leads to the problem that the converter between the search engine and the application needs to be reconfigured as long as the search request changes.
In this step, a specification may be preset for the search request, for example, the specification may include requirements such as a format and a statement. When an application sends a search request, the application needs to meet the preset specification to execute the search. That is, the search requests are unified, and no matter how the application program changes, the search can be executed only by sending the search request meeting the preset specification. In practical applications, such a specification may be named as FSQL (Free Structured query language), i.e., if an application needs to implement a search function, a search request needs to be output according to the FSQL specification.
It should be noted that, in practical applications, especially for application programs with human-computer interaction functions, it is necessary to set a search entry in a user interface for receiving a search keyword and the like input by a user, and how to convert the keyword input by the user into a search request meeting a preset specification may be included in this step as an implicit technical feature, but this is not a key point of the method, and is not discussed here too much. That is, in the development process, the developer of the application program only needs to consider how to convert the search keyword input by the user into the search request meeting the FSQL specification to execute the search.
Step 12: the search request is converted into a search command corresponding to a search engine that matches the requirements of the application.
In the previous step, having received a search request that satisfies the preset specification (FSQL specification) transmitted by the application, this step may convert the search request into a search command recognizable by the search engine. In the prior art, an application program only has one converter with a selected search engine and can be used for converting a received keyword input by a user into a search command which can be identified by the selected search engine. This step can convert the search request into a search command corresponding to a search engine that matches the requirements of the application.
In particular, it can be subdivided into the following sub-steps:
substep 121: a search engine is determined that matches the requirements of the application.
Since there are many applications and the selected search engines are different, e.g., 1 hundred million applications, there are n search engines, and any one or more of the n search engines can be selected by different applications, the search engine matching the application's requirements can be determined before conversion. This sub-step may include: according to the specified information of the application, a search engine is determined. Specifically, the application may generate a piece of specifying information in advance, and the specifying information may indicate a search engine required by the application, for example, the search engine "Sol", and then the search engine matching the requirement of the application may be determined to be the search engine "Sol".
In practical application, the search platform may include a plurality of search engines, the performance of each search engine is different, and the load of each search engine is also greatly different during the working process, so the sub-steps may further include: the search engine is determined based on the requirements of the application and the search engine performance. Specifically, the performance of each search engine may be obtained in real time, and the performance may include a load rate, an idle rate, a response speed, a data amount, a search manner (full-text index, directory index, etc.), and the like. The application may be accompanied by the requirement of the request when sending the search request, for example, the maximum data amount, the response speed, or the full-text index search mode may be the main requirement. After receiving the requirements of the user, the performance of each search engine can be mastered in real time and matched with the requirements of the application, so that the search engine is determined.
In practical applications, search engines can be classified, and search engines in the same category are specially responsible for processing search requests in the category, for example, the category can be divided according to keyword categories (sports category, digital category, music category, video category, etc.), and also can be divided according to search modes (full-text index category, directory index category, etc.). After the search request is received, the application requirement can be determined according to the category to which the keyword belongs in the analyzed search request, so that the search engine matched with the application requirement can be determined more accurately.
Substep 122: the search request is parsed.
As described above, the search request satisfies the FSQL specification, and can be parsed to find keywords, such as titles, contents, dates, etc., for the search articles. For subsequent conversion into search commands recognizable by the search engine.
In practical applications, for a search request satisfying the FSQL specification, the search request may be parsed, a syntax tree may be generated, for example, the syntax tree may be parsed by a parser, and a syntax tree may be generated, for example, an abstract syntax tree may be generated by an ANTLR parser, or a syntax tree may be generated by a LALR parser, so as to be converted into a search command recognizable by a search engine.
Substep 123: the analyzed search request is converted by a command converter corresponding to the search engine, and a search command recognizable by the search engine is generated.
In the former sub-step, the keyword is parsed out, or a syntax tree is generated, in this sub-step, the parsed search request can be converted according to the corresponding command converter, so as to generate a search command recognizable by the search engine, for example, the conversion from the search request specified by the FSQL to the search command recognizable by the search engine "Sol" can be performed through the command converter "FSQL → Sol", so as to generate a search command recognizable by the search engine "Sol".
In the previous sub-step, it is mentioned that the syntax parsing can be performed on the search request to generate the syntax tree, so the sub-step can include: and converting the information in the syntax tree through a command converter corresponding to the search engine to generate a search command which can be recognized by the search engine.
It should be noted that step 121 and step 122 are both preparation works of step 123, there is no fixed sequence, and in practical application, step 122 and then step 121 may be completely executed, or step 121 and step 122 may be executed together.
Step 13: and after searching and generating a search result according to the search command and the search engine, converting the search result into an application result which can be identified by the application according to a preset format.
As a search engine, after receiving a search command, a search task can be executed and a search result can be generated, but the format of the search result is only recognizable by the search engine, and the format of the search result generated by each search engine is different mostly. As described above, when receiving the search request sent by the application, the search request is received according to the preset specification, and in this step, the search request needs to be converted into an application result that is recognizable by the application according to the predetermined format. Specifically, the database recognizable by the search engine may be formatted data, for example, the application may have a database, and if a search function is to be implemented by the search engine, the database needs to be formatted and stored as a database recognizable and queryable by the search engine. Since the generated search result is still recognizable only by the search engine but the application is not necessarily recognizable, the search result needs to be converted into an application result recognizable by the application in a predetermined format. The conversion according to a predetermined format is a reverse formatting of the database of applications (recognizable to the search engine). In practical applications, the above-mentioned function of converting the format may be integrated in the corresponding converter, or may exist separately.
Step 14: and returning the application result to the application.
After the previous step determines that the application result is recognizable to the application, the step may return the application result to the application, thereby completing the search.
As shown in fig. 4, the schematic diagram of the search method provided in this embodiment may be regarded as a search platform, and as shown in the drawing, a search request meeting the FSQL specification may be received first, and then the FSQL executor is started, and an Abstract Syntax Tree (AST) may be generated through parsing by the ANTLR parser. Meanwhile, a search engine matching the application requirement may also be determined, as shown in the figure, the search engine may be determined from an HA3 search engine, a Lucene search engine, or another search engine, after the syntax tree is generated and the search engine is determined, a converter configured in advance and corresponding to the determined search engine is called, the parsed search request is converted, and a search command recognizable to the search engine is generated, as shown in the figure, the HA3 search command, the Lucene search command, or another search command may be generated according to an HA3 converter, a Lucene converter, or another converter, respectively. Then, the search engine can search according to the recognizable search command and generate a search result, but the search result is not recognizable by the application at the moment, and the search result can be converted by the corresponding converter according to a preset format to generate an application result recognizable by the application, and finally the application result is returned to the application to complete the search task.
By adopting the method provided by embodiment 1, the specification of the search request is preset, after the search request meeting the preset specification sent by the application is received, the search engine matched with the requirement of the application can be determined, the search request is converted into the search command which can be recognized by the search engine, after the search result is generated according to the search command and the search engine, the search command can be converted into the application result which can be recognized by the application according to the preset format, and finally, the application result is returned to the application to complete the search. Compared with the prior art that adaptation needs to be carried out again only by changing the search request output by the application or changing the search engine, so that excessive waste of development resources is caused, the method presets the specification of the receivable search request, all applications can send the search request according to the specification, the search function can be realized without considering how to adapt the search engine, and the waste of development resources is greatly reduced. In addition, the application may also implement search functionality by specifying a desired search engine.
Example 2
In embodiment 1, how to perform the search is described, and as can be seen from fig. 4, the converter plays a very important role as a middleware for connecting the search request and the search engine, and different converters can convert the search request meeting the predetermined specification into the search command recognizable by the respective corresponding search engine. Based on the same inventive concept as in example 1. The embodiment of the application provides a generation method of a command converter, so that after an application or a search engine is changed, the search function is enabled, and meanwhile, the waste of development resources is reduced. The flow of the method is shown in fig. 5, and comprises the following steps:
step 21: and analyzing the search request meeting the preset specification to generate a syntax tree.
As already mentioned above, the search request may be parsed to generate a syntax tree, such as an abstract syntax tree generated by an ANTLR parser.
Step 22: and generating a command converter aiming at the search engine according to the corresponding relation between the syntax tree and the search engine on the index structure.
Each search engine has respective characteristics on the index structure, and the syntax tree generated in the previous step has its own characteristics on the index structure, like the difference of formats or the difference of statements, so that the corresponding relation between the syntax tree satisfying the search request of the preset specification and the search engine on the index structure can be determined through analysis, and the command converter for the search engine can be generated.
The generation process of the "FSQL → HA 3" command converter is specifically explained by the following example.
For example, there are search requests that meet the FSQL specification: foo: "hello" AND bar: "world" & & filter > "2012-12-12" & & sort ═ createTime.
The abstract syntax tree is generated by the ANTLR parser to determine a schematic diagram of the abstract syntax tree as shown in fig. 6.
The HA3 search engine HAs two important indexing structures, reverse index and forward index. The inverted index can quickly position the position, word frequency and the like of the document where the keywords are located; forward indexing, which may be used for filtering, statistics, sorting, etc.
As shown in FIG. 6, it can be determined from the analysis that the FSQL search request needs to quickly locate the reverse clause (query _ close) of the keyword and sort the filtered forward clauses (sort _ close, filter _ close). A command converter for the HA3 search engine can be generated based on this correspondence in the index structure. When a search request which is sent by an application and meets the FSQL specification is received, and the search engine which is matched with the requirement of the application is determined to be the HA3 search engine, the search request which meets the FSQL specification can be converted into a search command which can be recognized by the HA3 search engine according to the command converter of 'FSQL → HA 3' generated by the method.
The method provided in embodiment 2 is adopted to parse the search request meeting the preset specification to generate a syntax tree, and then a command converter for the search engine is generated according to the corresponding relationship between the syntax tree and the search engine in the index structure. Compared with the prior art that the search service can be provided for the plurality of applications only by respectively adapting the plurality of applications, the search engine can provide the search service for the plurality of applications at the same time only by once adapting the search request with the preset specification, and on the basis of the embodiment 1, application developers do not need to pay attention to how to adapt the search engine, and can realize the search function through the plurality of search engines only by sending the search request meeting the preset specification, thereby greatly reducing the waste of development resources.
Example 3
Based on the same inventive concept, embodiment 3 provides a search system to reduce waste of development resources while ensuring that a search function is available after an application or a search engine is changed. As shown in fig. 7, the system is a structural diagram, and includes: an application 31, a search module 32, and a search engine 33, wherein,
application 31, may
Sending a search request meeting a preset specification, wherein the specification is preset by a search module; an application result recognizable by the application is received.
In the research and development process, research and development personnel of the application program only need to consider how to convert the received keywords input by the user into the search requests meeting the preset specifications, and do not need to pay attention to how to interface with the search engine. The specification is preset by the search module, such as the FSQL specification mentioned above. In the system, the searching function can be realized as long as the preset specification is met.
A search module 32, can
Converting the search request into a search command recognizable by a search engine matched with the requirement of the application;
sending the search command to a corresponding search engine;
and after converting the search result into an application result which can be identified by the application according to a preset format, sending the application result to the application.
How to determine the search engine and how to translate the search commands has been described above. The search module may include several command converters, i.e. a set of command converters, generated by the method described in embodiment 2, and the command converters may be configured by developers of the search module and developers of the search engine, so as to provide search services for applications. The method only needs to pay attention to how to convert the search request meeting the preset specification into the search command which can be recognized by each search engine, and does not need to pay attention to the application docking.
A search engine 33, can
And searching according to the received search command and generating a search result.
This is the basic function of a search engine.
In practical applications, an application may store its own database in a format recognizable and queryable by a search engine, for example, an application HAs a large amount of user data, and if a search function is to be implemented by a HA3 search engine, the large amount of user data needs to be formatted and converted into a format queryable by a HA3 search engine. After the HA3 search engine searches according to the search command and generates a search result, the search module may perform inverse formatting on the search result, restore the search result to an application result that can be recognized by the application, and return the application result to the application.
In one embodiment, the search module 32 may
Determining a search engine matching the requirements of the application;
analyzing the search request;
and converting the analyzed search request through a command converter corresponding to the search engine to generate a search command which can be identified by the search engine.
In one embodiment, the search module 32 may
And determining a search engine according to the specified information of the application.
In one embodiment, the search module 32 may
And determining the search engine according to the application requirement and the search engine performance.
In one embodiment, the search module 32 may
Parsing the grammar of the search request to generate a grammar tree;
and converting the information in the syntax tree through a command converter corresponding to the search engine to generate a search command which can be identified by the search engine.
By adopting the system provided in embodiment 3, the search module sets the specification of the search request in advance, and after receiving the search request which is sent by the application and meets the preset specification, the search module can determine the search engine matched with the requirement of the application, convert the search request into the search command which can be recognized by the search engine, and after generating the search result according to the search command and the search engine, can also convert the search result into the application result which can be recognized by the application according to the preset format, and finally return the application result to the application to complete the search. Compared with the prior art that adaptation needs to be carried out again only by changing or changing the search engine output by the application, so that excessive waste of development resources is caused, the method presets the specification of the receivable search request, all applications can send the search request according to the specification, the search function can be realized without considering how to adapt the application with the adaptive search engine, the search engine can be used as a search engine, the search service can be provided only by considering how to butt joint the application with the preset specification, and the waste of development resources is greatly reduced for both the applications.
Example 4
Based on the inventive idea of the foregoing embodiments, the embodiments of the present application provide a search apparatus to reduce waste of development resources while ensuring that a search function is available after an application or a search engine is changed. As shown in fig. 8, the apparatus includes: a receiving unit 41, a first conversion unit 42, a second conversion unit 43, a return unit 44, wherein,
the receiving unit 41 may receive a search request that satisfies a preset specification and is sent by an application;
the first conversion unit 42 may convert the search request into a search command recognizable by a search engine matching the requirement of the application;
the second conversion unit 43 may perform a search according to the search command and the search engine to generate a search result, and then convert the search result into an application result that is recognizable to the application according to a predetermined format;
the returning unit 44 may return the application result to the application.
In one embodiment, the first conversion unit 42 may be provided
Determining a search engine that matches the requirements of the application;
analyzing the search request;
and converting the analyzed search request through a command converter corresponding to the search engine to generate a search command which can be identified by the search engine.
In one embodiment, the first conversion unit 42 may be provided
And determining a search engine according to the specified information of the application.
In one embodiment, the first conversion unit 42 may be provided
And determining a search engine according to the application requirement and the search engine performance.
In one embodiment, the first conversion unit 42 may be provided
Parsing the grammar of the search request to generate a grammar tree;
and converting the information in the syntax tree through a command converter corresponding to the search engine to generate a search command which can be identified by the search engine.
By using the apparatus provided in embodiment 4, the specification of the search request is preset, and after a search request that meets the preset specification and is sent by an application is received, a search engine that matches the requirement of the application can be determined, and the search request is converted into a search command that can be recognized by the search engine, and after a search result is generated according to the search command and the search engine, the search result can also be converted into an application result that can be recognized by the application according to a predetermined format, and finally, the application result is returned to the application, thereby completing the search. Compared with the prior art that adaptation needs to be carried out again only by changing or changing the search engine output by the application, so that excessive waste of development resources is caused, the method presets the specification of the receivable search request, all applications can send the search request according to the specification, the search function can be realized without considering how to adapt the application with the adaptive search engine, the search engine can be used as a search engine, the search service can be provided only by considering how to butt joint the application with the preset specification, and the waste of development resources is greatly reduced for both the applications. In addition, the application may also implement search functionality by specifying a desired search engine.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Furthermore, nowadays, instead of manually making an integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as abel (advanced Boolean Expression Language), ahdl (alternate Language Description Language), traffic, pl (core unified Programming Language), HDCal, JHDL (Java Hardware Description Language), langue, Lola, HDL, laspam, hardsradware (Hardware Description Language), vhjhd (Hardware Description Language), and vhigh-Language, which are currently used in most common. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be considered a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (9)

1. A method of searching, comprising:
receiving a search request which is sent by an application and meets a preset specification, wherein the preset specification comprises a format specification and a statement specification;
converting the search request into a search command recognizable by a search engine matching the requirements of the application;
searching according to the search command and the search engine and generating a search result, and converting the search result into an application result which can be identified by application according to a preset format;
returning the application result to the application;
wherein converting the search request into a search command recognizable by a search engine matching the requirements of the application comprises:
determining a search engine that matches the requirements of the application;
parsing the grammar of the search request to generate a grammar tree;
and converting the information in the syntax tree through a command converter corresponding to the search engine to generate a search command which can be identified by the search engine.
2. The method of claim 1, wherein determining a search engine that matches requirements of the application comprises:
and determining a search engine according to the specified information of the application.
3. The method of claim 1, wherein determining a search engine that matches requirements of the application comprises:
and determining a search engine according to the application requirement and the search engine performance.
4. The method of claim 1, wherein the method comprises:
parsing the grammar of the search request to generate a grammar tree;
and converting the information in the syntax tree through a command converter corresponding to the search engine to generate a search command which can be identified by the search engine.
5. A search apparatus, comprising: a receiving unit, a first converting unit, a second converting unit, a returning unit, wherein,
the receiving unit receives a search request which is sent by an application and meets a preset specification, wherein the preset specification comprises a format specification and a statement specification;
the first conversion unit is used for converting the search request into a search command which can be identified by a search engine and is matched with the requirement of the application;
the second conversion unit is used for carrying out searching according to the searching command and the searching engine and generating a searching result, and then converting the searching result into an application result which can be identified by application according to a preset format;
the return unit returns the application result to the application;
wherein the first conversion unit is used for converting the first signal into the second signal,
determining a search engine that matches the requirements of the application;
parsing the grammar of the search request to generate a grammar tree;
and converting the information in the syntax tree through a command converter corresponding to the search engine to generate a search command which can be identified by the search engine.
6. The apparatus of claim 5, wherein the first conversion unit,
and determining a search engine according to the specified information of the application.
7. The apparatus of claim 5, wherein the first conversion unit,
and determining a search engine according to the application requirement and the search engine performance.
8. The apparatus of claim 5, wherein the first conversion unit,
parsing the grammar of the search request to generate a grammar tree;
and converting the information in the syntax tree through a command converter corresponding to the search engine to generate a search command which can be identified by the search engine.
9. A search system, comprising: an application, a search module, and a search engine, wherein,
in the application of the method, the application,
sending a search request meeting preset specifications, wherein the preset specifications are preset by a search module and comprise format specifications and statement specifications;
receiving an application result which can be identified by an application;
a search module for searching for a search result,
converting the search request into a search command recognizable by a search engine matched with the requirement of the application;
sending the search command to a corresponding search engine;
converting the search result into an application result which can be identified by the application according to a preset format, and then sending the application result to the application;
a search engine is provided for searching for a search query,
searching according to the received search command and generating a search result;
wherein the search module is configured to, in response to the search,
determining a search engine that matches the requirements of the application;
parsing the grammar of the search request to generate a grammar tree;
and converting the information in the syntax tree through a command converter corresponding to the search engine to generate a search command which can be identified by the search engine.
CN201710086905.9A 2017-02-17 2017-02-17 Search method, device, system and generation method of command converter Active CN107025265B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710086905.9A CN107025265B (en) 2017-02-17 2017-02-17 Search method, device, system and generation method of command converter

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710086905.9A CN107025265B (en) 2017-02-17 2017-02-17 Search method, device, system and generation method of command converter

Publications (2)

Publication Number Publication Date
CN107025265A CN107025265A (en) 2017-08-08
CN107025265B true CN107025265B (en) 2020-11-06

Family

ID=59525911

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710086905.9A Active CN107025265B (en) 2017-02-17 2017-02-17 Search method, device, system and generation method of command converter

Country Status (1)

Country Link
CN (1) CN107025265B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109710569B (en) * 2018-12-26 2021-05-25 上海百事通信息技术股份有限公司 File online browsing method
CN113190215B (en) * 2021-05-24 2024-06-25 上海万物新生环保科技集团有限公司 Query method and device based on search component
CN113434625B (en) * 2021-08-27 2021-12-07 中汽信息科技(天津)有限公司 Patent retrieval type coding method, device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101393567A (en) * 2008-10-13 2009-03-25 魏新成 Method for displaying intelligent search result web page in intelligent search windows
CN102043833A (en) * 2010-11-25 2011-05-04 北京搜狗科技发展有限公司 Search method and device based on query word
CN102651022A (en) * 2012-03-31 2012-08-29 奇智软件(北京)有限公司 Searching method and device
CN103020074A (en) * 2011-09-23 2013-04-03 倪毅 Object-level search technique based on main body
CN105224633A (en) * 2015-09-24 2016-01-06 北京锐安科技有限公司 Based on solr querying method and the device of sql like language

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101393567A (en) * 2008-10-13 2009-03-25 魏新成 Method for displaying intelligent search result web page in intelligent search windows
CN102043833A (en) * 2010-11-25 2011-05-04 北京搜狗科技发展有限公司 Search method and device based on query word
CN103020074A (en) * 2011-09-23 2013-04-03 倪毅 Object-level search technique based on main body
CN102651022A (en) * 2012-03-31 2012-08-29 奇智软件(北京)有限公司 Searching method and device
CN105224633A (en) * 2015-09-24 2016-01-06 北京锐安科技有限公司 Based on solr querying method and the device of sql like language

Also Published As

Publication number Publication date
CN107025265A (en) 2017-08-08

Similar Documents

Publication Publication Date Title
KR102258437B1 (en) Blockchain-based data storage and query method and device
US8661023B1 (en) Optimizing search query logic to speed retrieval
CN106611044B (en) SQL optimization method and equipment
CN107025265B (en) Search method, device, system and generation method of command converter
CN110245002B (en) System interaction method, device, equipment and storage medium
CN108848244B (en) Page display method and device
CN106933869B (en) Method and device for operating database
CN110457449B (en) Method, device, equipment and storage medium for training model online
CN103123590A (en) Compiling method from intermediate language (IL) program to C language program of instruction list
US20240184543A1 (en) Page multiplexing method, page multiplexing device, storage medium and electronic apparatus
CN112015739A (en) Data verification and data query method and device
CN114625732A (en) Query method and system based on Structured Query Language (SQL)
CN113434533A (en) Data tracing tool construction method, data processing method, device and equipment
CN112860730A (en) SQL statement processing method and device, electronic equipment and readable storage medium
CN116483859A (en) Data query method and device
CN108959330B (en) Database processing and data query method and device
CN106681781B (en) Method and system for realizing real-time computing service
WO2024041301A1 (en) Method and apparatus for generating unified abstract syntax tree, and program analysis method and apparatus
CN117828360A (en) Model training method, model training device, model code generating device, storage medium and storage medium
CN115878654A (en) Data query method, device, equipment and storage medium
CN116521705A (en) Data query method and device, storage medium and electronic equipment
CN116010419A (en) Method and device for creating unique index and optimizing logic deletion
CN111221841A (en) Real-time processing method and device based on big data
Eddy et al. Using structured queries for source code search
CN109614082B (en) Translation method, device and equipment for data query script

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
TA01 Transfer of patent application right

Effective date of registration: 20200921

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman, British Islands

Applicant after: Innovative advanced technology Co.,Ltd.

Address before: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman, British Islands

Applicant before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20200921

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman, British Islands

Applicant after: Advanced innovation technology Co.,Ltd.

Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands

Applicant before: Alibaba Group Holding Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant