Search conversion method

By building a general syntax tree, the problems of low retrieval conversion efficiency and poor compatibility in the existing technology are solved, and an efficient and general retrieval conversion method is realized, which is suitable for a variety of search engines.

CN115391383BActive Publication Date: 2024-12-10MAGIC CUBE (BEIJING) MEDICAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210827586.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-13
Publication Date
2024-12-10
Estimated Expiration
2042-07-13

AI Technical Summary

Technical Problem

The existing search-based conversion methods are not compatible with most underlying search engines, and the conversion efficiency is low, so they cannot effectively handle complex search-based syntax, resulting in inefficient conversion efficiency.

Method used

By obtaining the search-type character sequence to be converted, updating the recognition pattern based on the current recognition pattern and character type, and building a common syntax tree until the character sequence traversal is completed, retrieval code conversion is realized, supporting compatibility and efficient conversion of different underlying search engines. .

Benefits of technology

Improves the efficiency and compatibility of retrieval conversion, generates a completely abstract universal syntax tree, does not rely on specific domain-specific languages, supports search statements from different search engines, and enhances the universality and performance of conversions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115391383B_ABST
    Figure CN115391383B_ABST
Patent Text Reader

Abstract

The present invention provides a search formula conversion method, which includes: obtaining a character sequence of a search formula to be converted; recording the current character in the character sequence into a character string, and based on the current recognition mode and the character type of the current character, updating the current recognition mode and / or performing element recognition on the character string, and determining the next character in the character sequence as the current character; based on the search formula element obtained by the current element recognition and the type of the search formula element, updating a general syntax tree until the character traversal in the character sequence is completed; and performing search formula code conversion based on the general syntax tree. In the search formula conversion method provided by the embodiment of the present invention, the characters in the character sequence only need to be traversed once, and do not need to be read back, thereby improving the efficiency of search formula conversion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a search-based conversion method. Background Art

[0002] The patent search formula-based search method allows users to enter a search formula that describes the search scope in a specific syntax to perform a search, instead of complex field settings. Search formula conversion refers to converting the patent search formula entered by the user into a query expression supported by the search engine.

[0003] The search formula conversion method in the prior art can only be applied to a specific search engine and is not compatible with most underlying search engines. In addition, during the conversion process, the read characters are continuously converted and replaced with set characters, and the original search formula is inevitably read back in the algorithm, resulting in low conversion efficiency. Summary of the invention

[0004] The present invention provides a search formula conversion method, which is used to solve the defects of the prior art that it is not compatible with most underlying search engines and has low conversion efficiency.

[0005] The present invention provides a search formula conversion method, comprising:

[0006] Obtain the character sequence of the search expression to be converted;

[0007] Recording a current character in the character sequence into a character string, and based on a current recognition mode and a character type of the current character, updating the current recognition mode and / or performing element recognition on the character string, and determining the next character in the character sequence as the current character;

[0008] Based on the search formula element obtained by the current sub-element recognition and the type of the search formula element, the universal syntax tree is updated until the character traversal in the character sequence is completed;

[0009] Based on the universal syntax tree, search formula code conversion is performed.

[0010] According to a search formula conversion method provided by the present invention, the updating of the current recognition mode based on the current recognition mode and the character type of the current character includes:

[0011] When the current character is a quotation mark and the current recognition mode is not a phrase mode, updating the current recognition mode to a phrase mode;

[0012] When the current character is a quotation mark and the current recognition mode is a phrase mode, exit the phrase mode;

[0013] When the current character is a left square bracket and the current recognition mode is not a time mode, updating the current recognition mode to a time mode;

[0014] When the current character is a right square bracket and the current recognition mode is not a phrase mode, the time mode is exited.

[0015] According to a search formula conversion method provided by the present invention, the element recognition of the character string based on the current recognition mode and the character type of the current character includes:

[0016] When the current character is a separator and the character string conforms to the operator, perform element recognition on the character string to obtain the operator element; the separator includes a space, a quotation mark, a left square bracket, a right square bracket, a left round bracket or a right round bracket;

[0017] When the current character is the separator and the character string does not conform to the operator, performing element recognition on the character string based on the current recognition mode to obtain a keyword element or a bracket element;

[0018] Delete the string in question.

[0019] According to a search formula conversion method provided by the present invention, the step of performing element recognition on the character string based on the current recognition mode to obtain a keyword element includes:

[0020] When the current recognition mode is a phrase mode, performing element recognition on the character string to obtain a phrase element in the keyword element;

[0021] When the current recognition mode is the time mode, performing element recognition on the character string to obtain a time element in the keyword element;

[0022] When the current recognition mode is neither a phrase mode nor a time mode, element recognition is performed on the character string to obtain word elements in the keyword element.

[0023] A search formula conversion method provided by the present invention further includes:

[0024] When the current character is a colon and the current recognition mode is not a phrase mode, field name recognition is performed on the character string to obtain a current field name, and the current field name is used to identify the attribute of the keyword element.

[0025] According to a search expression conversion method provided by the present invention, the step of recording the current character in the character sequence into a character string comprises:

[0026] When the current character is not a colon and the current recognition mode is not a phrase mode, the current character in the character sequence is recorded into a character string.

[0027] A search formula conversion method provided by the present invention further includes:

[0028] When the current character is a quotation mark and the current recognition mode is a time mode, adding an exception record;

[0029] When the current character is a colon and the current recognition mode is not a phrase mode, adding an abnormal record based on the current field name;

[0030] When the current character is a left square bracket, a right square bracket, a left round bracket or a right round bracket, and the brackets do not match, adding an exception record;

[0031] When the current character is a left square bracket and the current recognition mode is not a time mode, adding an exception record;

[0032] When the current character is empty and the current recognition mode is the time mode or the phrase mode, an exception record is added.

[0033] A search formula conversion method provided by the present invention further includes:

[0034] Providing an abnormality prompt based on the abnormality record; and / or,

[0035] The abnormal record is automatically corrected, and the universal syntax tree is updated based on the corrected search formula elements and the types of the search formula elements.

[0036] According to a search formula conversion method provided by the present invention, the search formula element obtained based on the current sub-element recognition and the type of the search formula element, updating the universal syntax tree, comprises:

[0037] Adjust the result list and / or process the elements in the list based on the search query elements identified by the current sub-element and the type of the search query elements;

[0038] When a new operator is detected in the result list, the new operator is taken out from the result list, and n elements before the new operator are taken out from the result list according to the number n of elements responding to the new operator;

[0039] The newly added operator is used as a root node and the n elements are used as child nodes to form a tree element in the universal syntax tree;

[0040] In the case that all the child nodes are keyword elements, the tree element is put back into the processing list, and waits for the search formula element obtained by the next element recognition until the search formula element traversal is completed.

[0041] According to a search formula conversion method provided by the present invention, the search formula element obtained based on the current sub-element identification and the type of the search formula element, adjusting the result list and / or processing the elements in the list, includes:

[0042] In the case where the type of the search formula element is a keyword element, adding the search formula element to a result list;

[0043] In the case where the type of the search formula element is a left bracket element, adding the search formula element to a processing list;

[0044] In the case where the type of the search expression element is a right bracket element, the operator elements in the processing list are taken out in reverse order and added to the result list until the left bracket is taken out;

[0045] When the type of the search formula element is an operator element, based on the operation priority relationship between the operator element and the operator elements in the processing list, the operator element in the processing list is taken out and added to the result list, and the operator element is added to the processing list.

[0046] According to a search formula conversion method provided by the present invention, the tree elements constituting the universal syntax tree further include:

[0047] In the case where the root node operator of the child node is the same as the root node of the tree element, the child node is merged.

[0048] The present invention also provides a search-based conversion device, comprising:

[0049] A character sequence acquisition unit, used to acquire a character sequence of a search expression to be converted;

[0050] an element recognition unit, configured to record a current character in the character sequence into a character string, and based on a current recognition mode and a character type of the current character, update the current recognition mode and / or perform element recognition on the character string, and determine the next character in the character sequence as the current character;

[0051] A syntax tree updating unit, used for updating a universal syntax tree based on a search formula element obtained by identifying a current sub-element and a type of the search formula element, until the character traversal in the character sequence is completed;

[0052] The search formula conversion unit is used to perform search formula conversion based on the universal syntax tree.

[0053] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any of the above-mentioned search formula conversion methods is implemented.

[0054] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the search formula conversion method described in any one of the above is implemented.

[0055] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned search formula conversion methods.

[0056] The search formula conversion method provided by the present invention records the current character in the character sequence into a character string, and based on the current recognition mode and the character type of the current character, updates the current recognition mode and / or performs element recognition on the character string, and determines the next character in the character sequence as the current character; based on the search formula element obtained by the current element recognition and the type of the search formula element, updates the universal syntax tree until the character traversal in the character sequence is completed. The characters in the character sequence only need to be traversed once, and do not need to be read back, thereby improving the efficiency of the search formula conversion. While identifying the elements, a completely abstract and universal syntax tree is generated. The syntax tree generation does not rely on a specific domain-specific language, and can support different search statements of different underlying search engines, thereby improving the universality and compatibility of the search formula conversion. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0058] Figure 1 It is one of the flow charts of the search formula conversion method provided by the present invention;

[0059] Figure 2 This is the second flow chart of the search formula conversion method provided by the present invention;

[0060] Figure 3 It is a flow chart of the search-type element identification method provided by the present invention;

[0061] Figure 4 It is a structural schematic diagram of the search-based conversion device provided by the present invention;

[0062] Figure 5It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0063] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0064] In order to search for relevant patents, in addition to providing searches for titles and patent numbers, most mainstream patent search platforms also provide combined search functions based on various patent attribute fields (such as inventors, application date ranges), allowing users to find target patents more accurately. However, there are many attribute fields for patents, and filling them out one by one cannot quickly input, repeatedly input, or share search conditions. For this reason, many patent search platforms provide search methods based on patent search formulas, which allow users to input (including paste) a sentence string that describes the search scope in accordance with specific syntax for search, instead of complex field settings.

[0065] The emergence of patent search formulas has simplified the difficulty of inputting, saving and sharing patent search conditions. However, the syntax of the search formula itself is relatively demanding and not very friendly to beginners. Even those with some experience may make input errors due to negligence or input method problems.

[0066] Currently, there is a method for converting patent search expressions into query expressions supported by the Elasticsearch search engine (database). The method first maps the Boolean operation relationship of the patent search expression to the general syntax tree of Elasticsearch, embeds the fields and values ​​in the patent search expression into specific nodes of the syntax tree, and finally generates a domain-specific language supported by Elasticsearch.

[0067] This method directly parses the search expression into a Boolean search statement format applicable to Elasticsearch, which reduces its versatility. As a result, this technical method can only be applied to Elasticsearch. If the data is migrated to other search engines, this technical method may not be applicable or may need to be re-engineered. At the same time, this method constantly converts and replaces the read characters with the set characters. In terms of algorithm, it will inevitably read back the original expression, which will lead to low conversion efficiency.

[0068] Based on this, the embodiment of the present invention provides a search formula conversion method that is compatible with an unspecified majority of underlying search engines, has high conversion efficiency, and has good performance. The search formula can be used for patent search, and can also be used for the search of various types of text information such as papers, journals, and books, which is not specifically limited in the embodiment of the present invention.

[0069] Figure 1 This is one of the flow charts of the search formula conversion method provided by the embodiment of the present invention. The method can be applied to the scene where the search formula conversion is required. The execution subject of the method can be a search formula conversion device. The device can be implemented by software and / or hardware. The device can be integrated in an electronic device. The electronic device can be a personal computer, a cloud device, a smart phone, a tablet computer, etc. Figure 1 As shown, the search formula conversion method provided by the embodiment of the present invention includes the following steps:

[0070] Step 110, obtaining a character sequence of the search expression to be converted.

[0071] Specifically, the search expression to be converted needs to be converted into a search expression in a query language supported by the search engine. Here, the search expression can be represented as a character sequence consisting of multiple characters, and the character sequence can include various types of characters such as letters, Chinese characters, and punctuation marks.

[0072] Taking patent search formulas as an example, patent search formulas usually include various characters or character strings such as brackets, colons, field names, operators, keywords, etc.

[0073] Among them, "operator" usually refers to the logical operator in the search formula (such as "AND", "OR", "NOT", "and", "or", "non", etc.);

[0074] "Keywords" refers to the text to be searched that is input by the user. Keywords can be divided into words, phrases and time strings according to their functions. Words refer to the text to be searched that can be searched after being segmented; phrases cannot be segmented and must be accurately matched with the text to be searched when searching; time strings refer to the character strings in the date or time format input by the user, which can be converted into the corresponding standard time format when searching;

[0075] "Field Name" refers to the name of the patent attribute field that the user is allowed to search (such as "title", "abstract", "title", "abstract", etc.).

[0076] Users can construct search formulas according to search requirements. For example, the character sequence of a patent search formula can be expressed as follows: ti:((A)OR(B)NOT(C))AND clm:((D))AND pa:((E))AND(ad:[20220606TO 20220610]), where A, B, C, D and E are the keywords to be searched.

[0077] Step 120, record the current character in the character sequence into the character string, and based on the current recognition mode and the character type of the current character, update the current recognition mode and / or perform element recognition on the character string, and determine the next character in the character sequence as the current character.

[0078] Specifically, based on the character sequence of the search formula, each character in the character sequence can be traversed from the first character in order from front to back, and the search formula elements can be identified during the traversal process.

[0079] The elements here may include operator elements, keyword elements or bracket elements. The current recognition mode may represent the recognition mode of the current character, and the current recognition mode may include a phrase mode or a time mode, which is used to recognize the keyword elements input by the user. The character type of the current character may include a character of empty, letter, text, space, quotation mark, left square bracket, right square bracket, left round bracket or right round bracket, etc.

[0080] With respect to the grammatical expression of the search formula itself, when it is detected that the character type of the current character does not match the current recognition mode, the current recognition mode may be updated to make the current recognition mode match the character type of the current character.

[0081] When it is detected that the current character is not a letter or a word, that is, the currently recorded character string may have been input, the character string may be element-recognized to identify the search formula element and the search formula element type corresponding to the character string.

[0082] After completing the recording and element recognition for the current character, the next character in the character sequence can be determined as the current character, and the recording and element recognition for the current character can continue.

[0083] Step 130 , based on the search formula element obtained by the current sub-element recognition and the type of the search formula element, the universal syntax tree is updated until the character traversal in the character sequence is completed.

[0084] Specifically, after obtaining the search formula element obtained by the current sub-element recognition, the search formula element is immediately input into the universal syntax tree construction module, and the universal syntax tree is updated according to the type of the search formula element.

[0085] It is understandable that each time a search formula element is identified, it is immediately input into the universal syntax tree construction module, and step 120 is still traversing backward normally until the character traversal in the character sequence is completed. In other words, step 120 and step 130 are parallel pipeline operations, and the characters in the character sequence only need to be traversed once, and do not need to be read back, thereby improving the efficiency of search formula conversion.

[0086] In addition, updating the universal syntax tree based on the search formula elements obtained by the current sub-element recognition and the types of the search formula elements does not involve parsing the search formula into a Boolean search statement format for a specific search engine. The universal syntax tree updated here is an abstract syntax tree, which has better universality and compatibility.

[0087] Step 140: Perform search formula code conversion based on the universal syntax tree.

[0088] Specifically, based on the general syntax tree, different domain-specific language conversion tools can be applied according to the specific underlying data storage environment to convert the general syntax tree into a specific domain-specific language, such as Elasticsearch query statements, MySQL query statements, MongoDB query statements, etc.

[0089] The method provided by the embodiment of the present invention records the current character in the character sequence into the character string, and based on the current recognition mode and the character type of the current character, updates the current recognition mode and / or performs element recognition on the character string, and determines the next character in the character sequence as the current character; based on the search formula element obtained by the current element recognition, and the type of the search formula element, updates the universal syntax tree until the character traversal in the character sequence is completed. The characters in the character sequence only need to be traversed once, and do not need to be read back, thereby improving the efficiency of the search formula conversion. While identifying the elements, a completely abstract and universal syntax tree is generated. The syntax tree generation does not rely on a specific domain-specific language, and can support different search statements of different underlying search engines, thereby improving the universality and compatibility of the search formula conversion.

[0090] Based on any of the above embodiments, updating the current recognition mode based on the current recognition mode and the character type of the current character includes:

[0091] When the current character is a quotation mark and the current recognition mode is not a phrase mode, the current recognition mode is updated to a phrase mode;

[0092] When the current character is a quotation mark and the current recognition mode is phrase mode, exit phrase mode;

[0093] When the current character is a left square bracket and the current recognition mode is not a time mode, the current recognition mode is updated to a time mode;

[0094] When the current character is a right square bracket and the current recognition mode is not phrase mode, exit the time mode.

[0095] Specifically, considering that in the search formula, the role of quotation marks is usually to use the character string contained in the quotation marks as the text to be searched, and as a phrase, it cannot be separated, and must be accurately matched with the text to be searched during the search. Therefore, when the current character is a quotation mark and the current recognition mode is not phrase mode, the quotation mark here is usually a left quotation mark, indicating that the phrase mode is about to be entered, and the current recognition mode is updated to phrase mode; when the current character is a quotation mark and the current recognition mode is phrase mode, the quotation mark here is usually a right quotation mark, and the phrase mode is exited.

[0096] Usually in the search formula, the character string in the square brackets is written in the time format. Therefore, when reading characters, when the current character is a left square bracket and the current recognition mode is not the time mode, the current recognition mode is updated to the time mode; when the current character is a right square bracket and the current recognition mode is not the phrase mode, it means that the time string reading is completed and the time mode is exited.

[0097] The method provided by the embodiment of the present invention takes into account the grammatical expression of the search formula itself, and updates the current recognition mode for the current recognition mode that does not match the current character type, thereby further improving the accuracy of element recognition.

[0098] Based on any of the above embodiments, performing element recognition on the character string based on the current recognition mode and the character type of the current character includes:

[0099] When the current character is a separator and the string meets the operator, perform element recognition on the string to obtain the operator element; separators include space, quotation mark, left square bracket, right square bracket, left round bracket or right round bracket;

[0100] When the current character is a separator and the string does not conform to the operator, the string is identified based on the current recognition mode to obtain a keyword element or a bracket element;

[0101] Delete a string.

[0102] Specifically, element recognition for a character string can be implemented by the current recognition mode and the character type of the current character. If the current character is a separator, the recorded character string can be recognized as an element, wherein the separator may include a space, a quotation mark, a left square bracket, a right square bracket, a left round bracket or a right round bracket. It is understandable that if the current character is not a separator, for example, the current character is a letter or a word, it means that the current element has not been fully input, and the next character in the character sequence is read.

[0103] When the current string meets the operator, the string is identified as an element to obtain the corresponding operator element, such as "AND", "OR", "NOT", "and", "or", "non", etc.

[0104] When the current string does not conform to the operator, the string is identified based on the current recognition mode to obtain the corresponding keyword element or bracket element. The keyword element may include a word, a phrase or a time string; the bracket element may include a left square bracket, a right square bracket, a left round bracket or a right round bracket.

[0105] After obtaining the corresponding operator element, keyword element or bracket element, the current string can be deleted and the next character in the character sequence can be read.

[0106] Based on any of the above embodiments, performing element recognition on the character string based on the current recognition mode to obtain a keyword element includes:

[0107] When the current recognition mode is the phrase mode, perform element recognition on the character string to obtain the phrase element in the keyword element;

[0108] When the current recognition mode is the time mode, perform element recognition on the character string to obtain the time element in the keyword element;

[0109] When the current recognition mode is neither a phrase mode nor a time mode, element recognition is performed on the character string to obtain word elements in the keyword element.

[0110] Specifically, considering that keyword elements can be divided into words, phrases and time strings according to their functions, element recognition can be performed on the character string based on the current recognition mode to obtain the corresponding keyword element type.

[0111] If it is phrase mode at this time, the recorded string is generated as a "phrase"; if it is time mode at this time, the recorded string is generated as a "time string" and the format is verified; if it is neither phrase mode nor time mode at this time, the recorded string is generated as a "word".

[0112] Based on any of the above embodiments, the search formula conversion method further includes:

[0113] When the current character is a colon and the current recognition mode is not a phrase mode, field name recognition is performed on the character string to obtain the current field name, which is used to identify the attribute of the keyword element.

[0114] Specifically, considering that a colon is usually immediately following a field attribute in a search formula, for example, the search formula ti:((A)) indicates that the patent attribute field corresponding to text A is "patent name"; cpa:((D)) indicates that the patent attribute field corresponding to text D is "patent holder". Therefore, when the current character is a colon and the current recognition mode is not a phrase mode, the string is recognized for field name to obtain the current field name, which is used to identify the attribute of the keyword element.

[0115] Furthermore, if a keyword element is obtained by element recognition, a current field name attribute may be added to the keyword element. If the current field name does not exist, the keyword element is marked as a default field name.

[0116] Based on any of the above embodiments, recording the current character in the character sequence into a character string includes:

[0117] When the current character is not a colon and the current recognition mode is not a phrase mode, the current character in the character sequence is recorded into the character string.

[0118] Specifically, considering that the colon is usually used after the field name in the search formula, it is generally not counted as a search formula element in the character string in non-phrase mode. Therefore, when the current character is not a colon and the current recognition mode is not a phrase mode, the current character in the character sequence is recorded in the character string.

[0119] Based on any of the above embodiments, the search formula conversion method further includes:

[0120] When the current character is a quotation mark and the current recognition mode is the time mode, an exception record is added;

[0121] When the current character is a colon and the current recognition mode is not a phrase mode, an exception record is added based on the current field name;

[0122] If the current character is a left square bracket, right square bracket, left round bracket, or right round bracket, and the brackets do not match, an exception record is added;

[0123] When the current character is a left square bracket and the current recognition mode is not a time mode, add an exception record;

[0124] When the current character is empty and the current recognition mode is time mode or phrase mode, an exception record is added.

[0125] Specifically, considering that the syntax of the search formula itself is relatively demanding and not very friendly to beginners, even people with certain usage experience may make input errors due to negligence or input method problems. However, some existing patent search platforms cannot provide real-time verification of search formulas, many cannot prompt all grammatical errors, and most cannot provide automatic correction of incorrect search formulas.

[0126] Based on this, the method provided by the embodiment of the present invention can terminate the error in the search formula with a record instead of a record, and add an abnormal record and the position of the record during the process of traversing each character of the character sequence to perform element recognition.

[0127] The exception record here refers to the syntax of the search expression itself. If the current character is a quotation mark and the current recognition mode is the time mode, an exception record is added; if the current character is a bracket, but the bracket is detected to be mismatched, an exception record is added; if the current character is a left square bracket and the current recognition mode is not the time mode, an exception record is added; if the current character is empty, indicating that the character reading has ended, if the current recognition mode is the time mode or phrase mode, an exception record is added.

[0128] Based on any of the above embodiments, the search formula conversion method further includes:

[0129] Prompt abnormality based on abnormal records; and / or,

[0130] Automatically correct the abnormal records, and update the universal syntax tree based on the corrected search query elements and the types of the search query elements.

[0131] Specifically, if there are abnormal records, all abnormalities can be prompted to the user, that is, all abnormal records obtained by the search formula recognition process.

[0132] If the user needs to automatically correct the search formula, the error is input into the search formula correction unit, and the error is corrected from the front to the back according to the different error types and the recorded positions, and then the corrected error is input into the syntax tree update unit.

[0133] At the same time, since the retrieval correction unit is a separate functional module and is not coupled with the element recognition unit, different repair strategies can be implemented through strategy patterns or inheritance relationships for different error types to cope with correction tasks in different scenarios and realize dynamic or static evolution of repair strategies.

[0134] It is understandable that if no exception is recorded during the element recognition process, the generated element is passed to the syntax tree updating unit.

[0135] The method provided by the embodiment of the present invention repairs errors in the search formula input by the user in a dynamic and evolvable mode, supports real-time verification, dynamic error prompts, and automatic correction functions, thereby improving the user experience.

[0136] Based on any of the above embodiments, based on the search formula element obtained by the current sub-element recognition and the type of the search formula element, updating the universal syntax tree includes:

[0137] Adjust the result list and / or process the elements in the list based on the search query elements identified by the current sub-element and the type of the search query elements;

[0138] When a new operator is detected in the result list, the new operator is taken out from the result list, and n elements before the new operator are taken out from the result list according to the number n of elements corresponding to the new operator;

[0139] The newly added operator is used as the root node and n elements are used as child nodes to form the tree element in the general syntax tree;

[0140] When all child nodes are keyword elements, the tree element is put back into the processing list and waits for the search formula element obtained by the next element recognition until the search formula element traversal is completed.

[0141] Specifically, the updating of the universal syntax tree can be achieved by processing the search formula element based on the type of the search formula element obtained by the current sub-element recognition.

[0142] First, according to the search elements obtained by the current element recognition and the type of the search elements, the elements are added to the result list or the processing list respectively. The processing list can be considered as a first-in-last-out stack, that is, the first inserted element can only be taken out after the later inserted elements are taken out.

[0143] Then, when a new operator is detected in the result list, the new operator is taken out from the result list, and according to the number n of elements corresponding to the new operator, the n elements before the new operator are taken out from the result list.

[0144] Here, the number of elements n corresponding to the newly added operator refers to the number of operation elements supported by the newly added operator, and the operator can also be treated as an n-ary operator. For example, "5+7" means "the sum of 5 and 7", so the operand number of the plus sign "+" is 2, that is, "+" is a 2-ary operator; "5!" means "the factorial of 5", so the operand number of the factorial sign "!" is 1; for many patent search syntaxes, some functions are usually supported, and these functions may require n parameters to be passed in, so these functions can be treated as n-ary operators. For example, the function PRE(a,b,k) means searching for a that appears no more than k words before b, then PRE can be considered as a ternary operator.

[0145] After taking out the newly added operator and n elements from the result list, the newly added operator can be used as the root node and the n elements as child nodes to form a tree element in the general syntax tree;

[0146] When all child nodes are keyword elements, the tree element is put back into the processing list and waits for the search formula element obtained by the next element recognition until the search formula element traversal is completed.

[0147] The method provided by the embodiment of the present invention processes the search expression elements obtained each time by using a result list and a processing list, thereby forming tree elements in a universal syntax tree until the search expression elements are traversed.

[0148] Based on any of the above embodiments, adjusting the result list and / or processing the elements in the list based on the search query element obtained by the current sub-element identification and the type of the search query element includes:

[0149] When the type of the search formula element is a keyword element, the search formula element is added to the result list;

[0150] When the type of the search query element is a left bracket element, the search query element is added to the processing list;

[0151] When the type of the search expression element is a right bracket element, the operator elements in the processing list are taken out in reverse order and added to the result list until the left bracket is taken out;

[0152] When the type of the search expression element is an operator element, based on the operation priority relationship between the operator element and the operator elements in the processing list, the operator element in the processing list is taken out and added to the result list, and the operator element is added to the processing list.

[0153] Specifically, for an input keyword element, the keyword element may be directly added to the result list.

[0154] For an input left bracket element, the left bracket element may be added to a processing list.

[0155] For the right bracket element input, the operator elements in the processing list are taken out in reverse order and added to the result list until the left bracket is taken out, and the left bracket is not added to the result list.

[0156] It is understandable that the above steps deal with the change in the order of operations of operators caused by brackets. For operators that do not contain brackets, the order of operations is determined based on the order of operations of the operators.

[0157] The operation priority relationship between operator elements and operator elements in the processing list can be determined by the specific syntax, and the priority is usually specified as NOT>AND>OR. That is, a OR b AND c NOT d is equivalent to (a OR(b AND(c NOT d))).

[0158] It is understandable that, when the type of the search formula element is an operator element, the operator elements in the processing list whose priority is not higher than that of the operator element are taken out in turn, and added to the result list after being taken out, until the element to be taken out in the processing list has a higher priority than that of the operator or is a bracket or the processing list is empty, and then the operator is added to the processing list.

[0159] Based on any of the above embodiments, a tree element in a universal syntax tree is formed, and then further includes:

[0160] Merge child nodes if their root node operator is the same as the root node of the tree element.

[0161] Specifically, the root node operator of the child node is the same as the root node of the tree element, that is, the two root node operators are the same operator at the same level, and the child nodes can be merged.

[0162] Since the universal syntax tree has merged the same operators at the same level, it is compatible with domain-specific languages ​​that support multiple operators, such as Elasticsearch query statements. For domain-specific languages ​​that do not support multiple operators, such as MySQL SQL statements, the same-level elements can be nested in order to obtain binary operation elements.

[0163] Based on any of the above embodiments, a search-based conversion method is provided. Figure 2 FIG. 2 is a flow chart of the search formula conversion method provided by an embodiment of the present invention. Figure 2 As shown, the method includes the following 4 steps:

[0164] Step 210, search formula element recognition: obtain a character sequence of the search formula to be converted; record the current character in the character sequence into a character string, and based on the current recognition mode and the character type of the current character, update the current recognition mode and / or perform element recognition on the character string, and determine the next character in the character sequence as the current character.

[0165] Step 220, search formula correction: when there are abnormal records, the abnormal records are automatically corrected, and the universal syntax tree is updated based on the search formula elements obtained after the correction and the types of the search formula elements.

[0166] Step 230, constructing a universal syntax tree for the search formula: based on the search formula elements obtained by the current sub-element recognition and the types of the search formula elements, updating the universal syntax tree until the character traversal in the character sequence is completed.

[0167] Step 240, domain-specific language generation: performing search-style code conversion based on the universal syntax tree.

[0168] The patent search formula input by the user is traversed backwards in step 210 (search formula element identification), and the character string is continuously converted into patent search formula elements. Each time a search formula element is converted, it is handed over to step 230 (search formula universal syntax tree construction). At this time, step 210 is still traversing backwards normally, that is, step 210 and step 230 are parallel flow operations; if an error in the search formula is found during the processing of step 210, it is handed over to step 220 (search formula correction), and after correction, it is passed to step 230. After the universal syntax tree of step 230 is constructed, the universal syntax tree as a whole is handed over to step 240 (domain-specific language generation), and the query language of the specified search engine (database) is generated by the unspecified language generator.

[0169] in, Figure 3 is a flow chart of the search element identification method provided by the present invention, such as Figure 3 As shown, step 210 specifically includes steps 211-2111:

[0170] Step 211: read a character. If a space is read and it is not in phrase mode, execute step 212 and then return to step 211. If a quotation mark is read, if it is not in phrase mode, execute step 212 and then step 213, otherwise execute step 212 and then step 214. If a colon is read and it is not in phrase mode, execute step 215. If a left square bracket is read and it is not in phrase mode, execute step 212 and then step 216. If a right square bracket is read and it is not in phrase mode, execute step 212 and then step 217.

[0171] If a left parenthesis is read and it is not a phrase mode, then execute step 212 and then execute step 218. If a right parenthesis is read, then execute step 212 and then execute step 219. If no character is read, then execute step 212 and then execute step 2110. Otherwise, execute step 2111.

[0172] Step 212: record the character. If the saved character combination conforms to the "operator", generate the corresponding "operator" element; if it is in phrase mode, generate the recorded string as a "phrase"; if it is in time mode, generate the recorded string as a "time string" and verify the format; otherwise, generate the recorded string as a "word". If the element obtained in this step is a "keyword", add the current field name attribute to it. If the current field name does not exist, mark it as the default field name. Clear the recorded characters. Return to step 211.

[0173] Step 213: Enter phrase mode. If it is in time mode at this time, add abnormal record E1. Return to step 211.

[0174] Step 214: Exit the phrase mode and return to step 211.

[0175] Step 215: If there is a current field name, then add an exception record E2. If the saved character combination matches the "field name", then set it as the current field name; otherwise, add an exception record E3. Return to step 211.

[0176] Step 216: If the brackets do not match, add exception E4. If it is not time mode at this time, enter time mode; otherwise, add exception E5. Generate element left bracket. Return to step 211.

[0177] Step 217: If the brackets do not match, add exception E4. Exit time mode. Generate element right bracket. Return to step 211.

[0178] Step 218: If the brackets do not match, add exception E4. Increase the bracket level by 1. Generate an element left parenthesis. Return to step 211.

[0179] Step 219: If the brackets do not match, add exception E4. Decrease the bracket level by 1. Generate an element right bracket. If the bracket level is reset to zero, clear the current field name. Return to step 211.

[0180] Step 2110: If the time mode or bracket level is not zeroed, add exception E4. If it is phrase mode, add exception E6. End.

[0181] Step 2111: Record the current character. Return to step 211.

[0182] Combination Figure 3 As can be seen from the above description, through the design of the process of traversing and processing the search expression string, although there are many branches, the process of each branch is very simple, so that the execution efficiency of the search expression element identification in step 210 is very high.

[0183] Regarding the description and explanation of steps 220-240, reference may be made to the description and explanation of steps 220-240 in the above embodiment, and the same technical effect can be achieved. To avoid repetition, they will not be repeated here.

[0184] Furthermore, the method provided in this embodiment can achieve the following beneficial effects:

[0185] From the perspective of memory space complexity. The space consumed by step 210 is mainly the characters stored in step 2111. The space consumed in the extreme case is the same as the length of the character sequence of the search formula. The other space occupied is at a constant level. Therefore, the worst space complexity of step 210 is O(n). The worst space complexity of step 220 is O(1); if each character in step 230 is converted into an element and nested with the worst brackets, the worst space complexity is O(n). The space complexity of step 240 is O(n). Therefore, the worst space complexity of the entire solution is O(n).

[0186] From the perspective of time complexity. Step 210 only needs to traverse the patent search formula once, so the worst time complexity is O(n); Step 220 has a worst time complexity of O(1); Step 230 only needs to traverse all generated elements once, so the worst time complexity is O(n); Step 240 also only needs to traverse the general syntax tree once, so the worst time complexity is O(n). Therefore, the worst time complexity of the entire solution is O(n).

[0187] From a perceptual point of view, in terms of space, due to the nesting of brackets, in the worst case, only all search terms need to be stored without repeated storage, so the storage space is linearly related to the search term length (a constant difference). In terms of time, only the expression needs to be scanned from beginning to end without rereading, so the time consumption is linearly related to the search term length (a constant difference). Due to the structure and nesting involved, and the inability to directly apply O(1) mathematical functions, the optimal or ideal values ​​have been reached in terms of space complexity and time complexity.

[0188] The search formula conversion device provided by the present invention is described below. The search formula conversion device described below and the search formula conversion method described above can be referenced to each other.

[0189] Based on any of the above embodiments, Figure 4 is a schematic diagram of the structure of the search-based conversion device provided by the present invention. Figure 4 As shown, the device comprises:

[0190] A character sequence acquisition unit 410 is used to acquire a character sequence of a search expression to be converted;

[0191] An element recognition unit 420, configured to record a current character in the character sequence into a character string, and based on a current recognition mode and a character type of the current character, update the current recognition mode and / or perform element recognition on the character string, and determine the next character in the character sequence as the current character;

[0192] A syntax tree updating unit 430, configured to update a universal syntax tree based on the search formula element obtained by the current sub-element recognition and the type of the search formula element until the character traversal in the character sequence is completed;

[0193] The search formula conversion unit 440 is used to perform search formula conversion based on the universal syntax tree.

[0194] The search formula conversion device provided by the embodiment of the present invention records the current character in the character sequence into the character string, and based on the current recognition mode and the character type of the current character, updates the current recognition mode and / or performs element recognition on the character string, and determines the next character in the character sequence as the current character; based on the search formula element obtained by the current element recognition, and the type of the search formula element, updates the universal syntax tree until the character traversal in the character sequence is completed. The characters in the character sequence only need to be traversed once, and do not need to be read back, thereby improving the efficiency of the search formula conversion. While identifying the elements, a completely abstract and universal syntax tree is generated. The syntax tree generation does not rely on a specific domain-specific language, and can support different search statements of different underlying search engines, thereby improving the universality and compatibility of the search formula conversion.

[0195] Based on any of the above embodiments, the element identification unit 420 is further configured to:

[0196] When the current character is a quotation mark and the current recognition mode is not a phrase mode, updating the current recognition mode to a phrase mode;

[0197] When the current character is a quotation mark and the current recognition mode is a phrase mode, exit the phrase mode;

[0198] When the current character is a left square bracket and the current recognition mode is not a time mode, updating the current recognition mode to a time mode;

[0199] When the current character is a right square bracket and the current recognition mode is not a phrase mode, the time mode is exited.

[0200] Based on any of the above embodiments, the element identification unit 420 is further configured to:

[0201] When the current character is a separator and the character string conforms to the operator, perform element recognition on the character string to obtain the operator element; the separator includes a space, a quotation mark, a left square bracket, a right square bracket, a left round bracket or a right round bracket;

[0202] When the current character is the separator and the character string does not conform to the operator, performing element recognition on the character string based on the current recognition mode to obtain a keyword element or a bracket element;

[0203] Delete the string in question.

[0204] Based on any of the above embodiments, the element identification unit 420 is further configured to:

[0205] When the current recognition mode is a phrase mode, performing element recognition on the character string to obtain a phrase element in the keyword element;

[0206] When the current recognition mode is the time mode, performing element recognition on the character string to obtain a time element in the keyword element;

[0207] When the current recognition mode is neither a phrase mode nor a time mode, element recognition is performed on the character string to obtain word elements in the keyword element.

[0208] Based on any of the above embodiments, the search formula conversion device provided by the embodiment of the present invention further includes a field name recognition unit, which is used to:

[0209] When the current character is a colon and the current recognition mode is not a phrase mode, field name recognition is performed on the character string to obtain a current field name, and the current field name is used to identify the attribute of the keyword element.

[0210] Based on any of the above embodiments, the element identification unit 420 is further configured to:

[0211] When the current character is not a colon and the current recognition mode is not a phrase mode, the current character in the character sequence is recorded into a character string.

[0212] Based on any of the above embodiments, the search-based conversion device provided in the embodiment of the present invention further includes an exception recording unit, which is used to:

[0213] When the current character is a quotation mark and the current recognition mode is a time mode, adding an exception record;

[0214] When the current character is a colon and the current recognition mode is not a phrase mode, adding an abnormal record based on the current field name;

[0215] When the current character is a left square bracket, a right square bracket, a left round bracket or a right round bracket, and the brackets do not match, adding an exception record;

[0216] When the current character is a left square bracket and the current recognition mode is not a time mode, adding an exception record;

[0217] When the current character is empty and the current recognition mode is the time mode or the phrase mode, an exception record is added.

[0218] Based on any of the above embodiments, the search-based conversion device provided in the embodiment of the present invention further includes an abnormality correction unit, which is used to:

[0219] Providing an abnormality prompt based on the abnormality record; and / or,

[0220] The abnormal record is automatically corrected, and the universal syntax tree is updated based on the corrected search formula elements and the types of the search formula elements.

[0221] Based on any of the above embodiments, the syntax tree updating unit 430 is further configured to:

[0222] Adjust the result list and / or process the elements in the list based on the search query elements identified by the current sub-element and the type of the search query elements;

[0223] When a new operator is detected in the result list, the new operator is taken out from the result list, and n elements before the new operator are taken out from the result list according to the number n of elements responding to the new operator;

[0224] The newly added operator is used as a root node and the n elements are used as child nodes to form a tree element in the universal syntax tree;

[0225] In the case that all the child nodes are keyword elements, the tree element is put back into the processing list, and waits for the search formula element obtained by the next element recognition until the search formula element traversal is completed.

[0226] Based on any of the above embodiments, the syntax tree updating unit 430 is further configured to:

[0227] In the case where the type of the search formula element is a keyword element, adding the search formula element to a result list;

[0228] In the case where the type of the search formula element is a left bracket element, adding the search formula element to a processing list;

[0229] In the case where the type of the search expression element is a right bracket element, the operator elements in the processing list are taken out in reverse order and added to the result list until the left bracket is taken out;

[0230] When the type of the search formula element is an operator element, based on the operation priority relationship between the operator element and the operator elements in the processing list, the operator element in the processing list is taken out and added to the result list, and the operator element is added to the processing list.

[0231] Based on any of the above embodiments, the syntax tree updating unit 430 is further configured to:

[0232] In the case where the root node operator of the child node is the same as the root node of the tree element, the child node is merged.

[0233] Figure 5 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 5 As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530 and a communication bus 540, wherein the processor 510, the communication interface 520 and the memory 530 communicate with each other via the communication bus 540. The processor 510 may call the logic instructions in the memory 530 to execute the search formula conversion method, which includes:

[0234] Obtain the character sequence of the search expression to be converted;

[0235] Recording a current character in the character sequence into a character string, and based on a current recognition mode and a character type of the current character, updating the current recognition mode and / or performing element recognition on the character string, and determining the next character in the character sequence as the current character;

[0236] Based on the search formula element obtained by the current sub-element recognition and the type of the search formula element, the universal syntax tree is updated until the character traversal in the character sequence is completed;

[0237] Based on the universal syntax tree, search formula code conversion is performed.

[0238] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0239] On the other hand, the present invention further provides a computer program product, the computer program product comprising a computer program, the computer program can be stored in a non-transitory computer-readable storage medium, when the computer program is executed by a processor, the computer can execute the search formula conversion method provided by the above methods, the method comprising:

[0240] Obtain the character sequence of the search expression to be converted;

[0241] Recording a current character in the character sequence into a character string, and based on a current recognition mode and a character type of the current character, updating the current recognition mode and / or performing element recognition on the character string, and determining the next character in the character sequence as the current character;

[0242] Based on the search formula element obtained by the current sub-element recognition and the type of the search formula element, the universal syntax tree is updated until the character traversal in the character sequence is completed;

[0243] Based on the universal syntax tree, search formula code conversion is performed.

[0244] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method for converting a search formula provided by the above methods is implemented, and the method comprises:

[0245] Obtain the character sequence of the search expression to be converted;

[0246] Recording a current character in the character sequence into a character string, and based on a current recognition mode and a character type of the current character, updating the current recognition mode and / or performing element recognition on the character string, and determining the next character in the character sequence as the current character;

[0247] Based on the search formula element obtained by the current sub-element recognition and the type of the search formula element, the universal syntax tree is updated until the character traversal in the character sequence is completed;

[0248] Based on the universal syntax tree, search formula code conversion is performed.

[0249] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0250] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0251] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A search-type conversion method, characterized in that: include: Obtain the character sequence of the search expression to be converted; Recording a current character in the character sequence into a character string, and based on a current recognition mode and a character type of the current character, updating the current recognition mode and / or performing element recognition on the character string, and determining the next character in the character sequence as the current character; Based on the search formula element obtained by the current sub-element recognition and the type of the search formula element, the universal syntax tree is updated until the character traversal in the character sequence is completed; Based on the universal syntax tree, performing search formula code conversion; The updating of the current recognition mode based on the current recognition mode and the character type of the current character comprises: When the current character is a quotation mark and the current recognition mode is not a phrase mode, updating the current recognition mode to a phrase mode; When the current character is a quotation mark and the current recognition mode is a phrase mode, exit the phrase mode; When the current character is a left square bracket and the current recognition mode is not a time mode, updating the current recognition mode to a time mode; When the current character is a right square bracket and the current recognition mode is not a phrase mode, exit the time mode; The performing element recognition on the character string based on the current recognition mode and the character type of the current character includes: When the current character is a separator and the character string conforms to the operator, perform element recognition on the character string to obtain the operator element; the separator includes a space, a quotation mark, a left square bracket, a right square bracket, a left round bracket or a right round bracket; When the current character is the separator and the character string does not conform to the operator, performing element recognition on the character string based on the current recognition mode to obtain a keyword element or a bracket element; deleting said string; The updating of the universal syntax tree based on the search formula element obtained by identifying the current sub-element and the type of the search formula element includes: Adjust the result list and / or process the elements in the list based on the search query elements identified by the current sub-element and the type of the search query elements; When a new operator is detected in the result list, the new operator is taken out from the result list, and n elements before the new operator are taken out from the result list according to the number n of elements responding to the new operator; The newly added operator is used as a root node and the n elements are used as child nodes to form a tree element in the universal syntax tree; In the case that all the child nodes are keyword elements, the tree element is put back into the processing list, and waits for the search formula element obtained by the next element recognition until the search formula element traversal is completed.

2. The search formula conversion method according to claim 1, characterized in that: The performing element recognition on the character string based on the current recognition mode to obtain a keyword element includes: When the current recognition mode is a phrase mode, performing element recognition on the character string to obtain a phrase element in the keyword element; When the current recognition mode is the time mode, performing element recognition on the character string to obtain a time element in the keyword element; When the current recognition mode is neither a phrase mode nor a time mode, element recognition is performed on the character string to obtain word elements in the keyword element.

3. The search formula conversion method according to claim 1, characterized in that: Also includes: When the current character is a colon and the current recognition mode is not a phrase mode, field name recognition is performed on the character string to obtain a current field name, and the current field name is used to identify the attribute of the keyword element.

4. The search formula conversion method according to claim 1, characterized in that: The step of recording the current character in the character sequence into a character string comprises: When the current character is not a colon and the current recognition mode is not a phrase mode, the current character in the character sequence is recorded into a character string.

5. The search formula conversion method according to claim 1, characterized in that: Also includes: When the current character is a quotation mark and the current recognition mode is a time mode, adding an exception record; When the current character is a colon and the current recognition mode is not a phrase mode, adding an abnormal record based on the current field name; When the current character is a left square bracket, a right square bracket, a left round bracket or a right round bracket, and the brackets do not match, adding an exception record; When the current character is a left square bracket and the current recognition mode is not a time mode, adding an exception record; When the current character is empty and the current recognition mode is the time mode or the phrase mode, an exception record is added.

6. The search formula conversion method according to claim 5, characterized in that: Also includes: Providing an abnormality prompt based on the abnormal record; and / or, The abnormal record is automatically corrected, and the universal syntax tree is updated based on the corrected search formula elements and the types of the search formula elements.

7. The search formula conversion method according to claim 1, characterized in that: The step of adjusting the result list and / or processing the elements in the list based on the search formula elements obtained by identifying the current sub-element and the type of the search formula elements includes: In the case where the type of the search formula element is a keyword element, adding the search formula element to a result list; In the case where the type of the search formula element is a left bracket element, adding the search formula element to a processing list; In the case where the type of the search expression element is a right bracket element, the operator elements in the processing list are taken out in reverse order and added to the result list until the left bracket is taken out; When the type of the search formula element is an operator element, based on the operation priority relationship between the operator element and the operator elements in the processing list, the operator element in the processing list is taken out and added to the result list, and the operator element is added to the processing list.

8. A search-based conversion device, characterized in that: include: A character sequence acquisition unit, used to acquire a character sequence of a search expression to be converted; an element recognition unit, configured to record a current character in the character sequence into a character string, and based on a current recognition mode and a character type of the current character, update the current recognition mode and / or perform element recognition on the character string, and determine the next character in the character sequence as the current character; A syntax tree updating unit, used for updating a universal syntax tree based on a search formula element obtained by identifying a current sub-element and a type of the search formula element, until the character traversal in the character sequence is completed; A search formula conversion unit, used for performing search formula code conversion based on the universal syntax tree; The element identification unit is further used for: When the current character is a quotation mark and the current recognition mode is not a phrase mode, updating the current recognition mode to a phrase mode; When the current character is a quotation mark and the current recognition mode is a phrase mode, exit the phrase mode; When the current character is a left square bracket and the current recognition mode is not a time mode, updating the current recognition mode to a time mode; When the current character is a right square bracket and the current recognition mode is not a phrase mode, exit the time mode; The element identification unit is further used for: When the current character is a separator and the character string conforms to the operator, perform element recognition on the character string to obtain the operator element; the separator includes a space, a quotation mark, a left square bracket, a right square bracket, a left round bracket or a right round bracket; When the current character is the separator and the character string does not conform to the operator, performing element recognition on the character string based on the current recognition mode to obtain a keyword element or a bracket element; deleting said string; The syntax tree updating unit is further used for: Adjust the result list and / or process the elements in the list based on the search query elements identified by the current sub-element and the type of the search query elements; When a new operator is detected in the result list, the new operator is taken out from the result list, and n elements before the new operator are taken out from the result list according to the number n of elements responding to the new operator; The newly added operator is used as a root node and the n elements are used as child nodes to form a tree element in the universal syntax tree; In the case that all the child nodes are keyword elements, the tree element is put back into the processing list, and waits for the search formula element obtained by the next element recognition until the search formula element traversal is completed.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the search formula conversion method according to any one of claims 1 to 7 is implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the search formula conversion method according to any one of claims 1 to 7 is implemented.