Search engine optimization method and device, electronic equipment and storage medium
By merging and parsing search statements through Karnaugh maps, target search statements are generated, which solves the technical problem that search engines cannot detect abnormality in time, realizes active optimization and resource management of search engines, and improves search efficiency and accuracy.
Patent Information
- Application Number
- CN202410840809.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-09-13
AI Technical Summary
The existing technology cannot detect problems in the search cluster in time during the data search process of the search engine. It is not until the search is completed that the server resource consumption is serious and the memory usage is soaring, and the search abnormality cannot be proactively discovered.
By obtaining the initial search statement, using the Karnaugh map to merge clauses with the same meaning, perform data analysis and delete invalid features, and generate the target search statement to achieve search engine optimization.
Actively optimize the search engine's data search process to reduce server resource consumption, improve search efficiency and accuracy, and avoid serious server resource consumption and memory usage spikes.
Smart Images

Figure CN118643205A
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of search engine optimization, and in particular to a search engine optimization method, device, electronic device and storage medium. Background Art
[0002] With the popularization of network technology, technicians store data on network servers and search for data through search engines to improve the security of data storage and the convenience of data search. However, the relevant technology cannot promptly discover problems with the search cluster during the data search process based on the search engine. Only after the search engine completes the search for multiple data can it discover problems such as serious server resource consumption and soaring server memory usage. At this time, the optimization of the search engine can be completed by checking and analyzing the logs generated by the search engine during the data search process, that is, the search anomaly problems that occur during the data search process of the search engine can be discovered, but the search anomaly problems cannot be actively discovered during the data search process of the search engine. Therefore, how to better implement search engine optimization is a key issue that technicians in this field are concerned about. Summary of the invention
[0003] Based on the above problems, the present application provides a search engine optimization method, device, electronic device and storage medium to better implement search engine optimization. The present application embodiment discloses the following technical solutions:
[0004] In a first aspect, the present application discloses a search engine optimization method, comprising:
[0005] Get the initial search statement of the search engine;
[0006] If there are multiple clauses with the same meaning in the initial search statement, the multiple clauses with the same meaning are merged and simplified using the Karnaugh map to obtain a search merge statement;
[0007] Performing data parsing on the search merge statement to obtain a plurality of data features in the search merge statement and feature types corresponding to the plurality of data features;
[0008] Deleting invalid data features and invalid feature types corresponding to the invalid data features from the multiple data features, obtaining a target data feature from the multiple data features, and a target feature type corresponding to the target data feature from feature types corresponding to the multiple data features;
[0009] A target search statement is obtained according to the target data feature and a target feature type corresponding to the target data feature.
[0010] Optionally, after deleting the invalid data features from the multiple data features and the invalid feature types corresponding to the invalid data features, obtaining the target data features from the multiple data features, and the target feature types corresponding to the target data features from the feature types corresponding to the multiple data features, the method further includes:
[0011] Adding a specific feature corresponding to the target data feature and a specific feature type corresponding to the specific feature;
[0012] The obtaining a target search statement according to the target data feature and a target feature type corresponding to the target data feature includes:
[0013] The target data feature, the target feature type corresponding to the target data feature, the specific feature corresponding to the target data feature and the specific feature type corresponding to the specific feature are added to obtain a target search statement.
[0014] Optionally, obtaining an initial search statement of the search engine includes:
[0015] Obtaining the slow log generated by the search engine during use, and obtaining abnormal search statements in the slow log;
[0016] If the content in the abnormal search statement satisfies the content integrity rule, determining the abnormal search statement as the initial search statement of the search engine;
[0017] If the content in the abnormal search statement does not meet the content integrity rule, a search statement log is obtained according to the abnormal search log, and an initial search statement of the search engine is obtained according to the search statement log.
[0018] Optionally, after obtaining the initial search statement of the search engine, the method further includes:
[0019] Perform keyword parsing on the initial search statement to obtain multiple keywords in the initial search statement;
[0020] If the number of keywords including the first keyword among the multiple keywords is greater than the preset number of keywords, a keyword sentence corresponding to the first keyword is determined according to the first keyword, and multiple clauses with the same meaning are determined in the initial search sentence according to the keyword sentence.
[0021] Optionally, after performing keyword parsing on the initial search statement to obtain multiple keywords in the initial search statement, the method further includes:
[0022] If the second keyword and the third keyword exist in the multiple keywords, then if there are multiple clauses with the same meaning in the initial search statement, the step of merging and simplifying the multiple clauses with the same meaning using the Karnaugh map to obtain a search merge statement is not performed;
[0023] Parsing the second keyword and the third keyword to obtain a value range corresponding to the second keyword and a value range corresponding to the third keyword;
[0024] The sum of the value range corresponding to the second keyword and the value range corresponding to the third keyword is used as the target value range;
[0025] The initial search statement is processed according to the target value range to obtain a target search statement.
[0026] Optionally, after the initial search statement is processed according to the target value range to obtain a target search statement, the method further includes:
[0027] Acquire a target keyword, wherein the target keyword is used to support the search engine to perform a jump search operation;
[0028] The processing of the initial search statement according to the target value range to obtain a target search statement includes:
[0029] If the target value range is greater than the preset value range, the second keyword and the third keyword in the initial search statement are replaced with the target keyword to obtain a target search statement containing the target keyword.
[0030] Optionally, after obtaining the initial search statement of the search engine, the method further includes:
[0031] If there are no multiple clauses with the same meaning in the initial search statement, the initial search statement is parsed to obtain multiple search statements in the initial search statement;
[0032] Calculating the multiple search statements to obtain search costs corresponding to the multiple search statements respectively;
[0033] The multiple search statements are sorted based on the search costs respectively corresponding to the multiple search statements to obtain sorted search statements, and the sorted search statements are used as target search statements.
[0034] In a second aspect, the present application discloses a search engine optimization device, comprising:
[0035] An initial search statement acquisition unit, used to acquire an initial search statement of a search engine;
[0036] A search merge statement obtaining unit, configured to, if there are multiple clauses with the same meaning in the initial search statement, merge and simplify the multiple clauses with the same meaning using a Karnaugh map to obtain a search merge statement;
[0037] A search merge statement parsing unit, configured to perform data parsing on the search merge statement to obtain a plurality of data features in the search merge statement and feature types corresponding to the plurality of data features;
[0038] A data feature type deletion unit is used to delete invalid data features from the multiple data features and invalid feature types corresponding to the invalid data features, and obtain a target data feature from the multiple data features and a target feature type corresponding to the target data feature from the feature types corresponding to the multiple data features respectively; a first search statement acquisition unit is used to obtain a target search statement based on the target data feature and the target feature type corresponding to the target data feature.
[0039] Optionally, the device further comprises:
[0040] A specific feature type adding unit, used for adding a specific feature corresponding to the target data feature and a specific feature type corresponding to the specific feature;
[0041] The first search statement optimization unit is specifically used to:
[0042] A target search statement is obtained by combining the target data feature, the target feature type corresponding to the target data feature, the specific feature corresponding to the target data feature, and the specific feature type corresponding to the specific feature.
[0043] Optionally, the initial search statement acquiring unit is specifically used to:
[0044] Obtaining the slow log generated by the search engine during use, and obtaining abnormal search statements in the slow log;
[0045] If the content in the abnormal search statement satisfies the content integrity rule, determining the abnormal search statement as the initial search statement of the search engine;
[0046] If the content in the abnormal search statement does not meet the content integrity rule, a search statement log is obtained according to the abnormal search log, and an initial search statement of the search engine is obtained according to the search statement log.
[0047] Optionally, the device further comprises:
[0048] A plurality of keyword obtaining units, used for performing keyword parsing on the initial search statement to obtain a plurality of keywords in the initial search statement;
[0049] The unit for determining clauses with the same meaning is used to determine the keyword sentence corresponding to the first keyword according to the first keyword if the number of keywords of the first keyword among the multiple keywords is greater than the preset number of keywords, and to determine whether there are multiple clauses with the same meaning in the initial search sentence according to the keyword sentence.
[0050] Optionally, the device further comprises:
[0051] a keyword determination unit, configured to, if the second keyword and the third keyword exist in the plurality of keywords, not execute the step of merging and simplifying the plurality of clauses with the same meaning by using a Karnaugh map to obtain a search merge statement if the plurality of clauses with the same meaning exist in the initial search statement;
[0052] A keyword parsing unit, used to parse the second keyword and the third keyword to obtain a value range corresponding to the second keyword and a value range corresponding to the third keyword;
[0053] a target value range obtaining unit, configured to take the sum of the value range corresponding to the second keyword and the value range corresponding to the third keyword as the target value range;
[0054] The second search statement obtaining unit is used to process the initial search statement according to the target value range to obtain a target search statement.
[0055] Optionally, the device further comprises:
[0056] A target keyword acquisition unit, used to acquire a target keyword, wherein the target keyword is used to support the search engine to perform a jump search operation;
[0057] The second search statement obtaining unit is specifically used for:
[0058] If the target value range is greater than the preset value range, the second keyword and the third keyword in the initial search statement are replaced with the target keyword to obtain a target search statement containing the target keyword.
[0059] Optionally, the device further comprises:
[0060] A plurality of search statement optimization units, configured to perform statement parsing on the initial search statement to obtain a plurality of search statements in the initial search statement if there are no multiple clauses with the same meaning in the initial search statement;
[0061] A search cost obtaining unit, configured to calculate the multiple search statements to obtain search costs respectively corresponding to the multiple search statements;
[0062] The third search statement obtaining unit is used to obtain sorted search statements for the multiple search statements based on the search costs respectively corresponding to the multiple search statements, and use the sorted search statements as target search statements.
[0063] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0064] Memory for storing computer programs;
[0065] A processor is used to implement the steps of the above-mentioned search engine optimization method when executing the computer program.
[0066] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned search engine optimization method are implemented.
[0067] Compared with the prior art, this application has the following beneficial effects:
[0068] In the present application, an initial search statement of a search engine is first obtained; thereafter, if there are multiple clauses with the same meaning in the initial search statement, the multiple clauses with the same meaning are merged and simplified using a Karnaugh map to obtain a search merge statement, and data is parsed on the search merge statement to obtain multiple data features in the search merge statement and feature types corresponding to the multiple data features; finally, invalid data features among the multiple data features and invalid feature types corresponding to the invalid data features are deleted to obtain target data features among the multiple data features and target feature types corresponding to the target data features among the feature types corresponding to the multiple data features, and a target search statement is obtained based on the target data features and the target feature types corresponding to the target data features.
[0069] It can be seen that in the present application, the clauses with the same meaning are first merged and simplified based on the Karnaugh map to obtain a search merge statement, and then invalid data features and invalid feature types that are irrelevant to the target data features are deleted based on the data features and feature types in the search merge statement, and finally the target search statement is obtained based on the target data features and target feature types to complete the optimization of the search engine. In this way, the search engine is actively optimized during the data search process of the search engine, and the simplified adjustment of the initial search statement is achieved, thereby better realizing the optimization of the search engine. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0071] Figure 1 A flowchart of a search engine optimization method provided in an embodiment of the present application;
[0072] Figure 2 A schematic diagram of a Karnaugh map proposed in a search engine optimization method provided in an embodiment of the present application;
[0073] Figure 3 A schematic diagram of multiple clauses with the same meaning in a search engine optimization method provided in an embodiment of the present application;
[0074] Figure 4 A schematic diagram of a Karnaugh map proposed in another search engine optimization method provided in an embodiment of the present application;
[0075] Figure 5 A schematic diagram of a Karnaugh map proposed in another search engine optimization method provided in an embodiment of the present application;
[0076] Figure 6 A full flow chart of search engine optimization in a search engine optimization method provided in an embodiment of the present application;
[0077] Figure 7 A schematic diagram of the structure of a search engine optimization device provided in an embodiment of the present application;
[0078] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0079] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0080] It should be noted that the search engine optimization method, device, electronic device and storage medium provided in the present application are used in the field of search engine optimization technology. The above are only examples and do not limit the application fields of the method and device names provided in the present application.
[0081] As described above, with the popularization of network technology, technicians store data on network servers and search for data through search engines to improve the security of data storage and the convenience of data search. However, the relevant technology cannot promptly discover problems with the search cluster during the search engine-based data search process. Only after the search engine completes the search for multiple data can it discover problems such as serious server resource consumption and soaring server memory usage. At this time, the search engine can be optimized only by checking and analyzing the logs generated by the search engine during the data search process, that is, to discover search anomalies that occur during the search engine's data search process, but not to actively discover search anomalies during the search engine's data search process. Therefore, how to better implement search engine optimization is a key issue that technicians in this field are concerned about.
[0082] Therefore, the inventor proposed the technical solution of the present application. The present application first obtains the initial search statement of the search engine. Thereafter, if there are multiple clauses with the same meaning in the initial search statement, the multiple clauses with the same meaning are merged and simplified using the Karnaugh map to obtain a search merge statement, and the search merge statement is parsed to obtain multiple data features in the search merge statement and feature types corresponding to the multiple data features. Finally, invalid data features among the multiple data features and invalid feature types corresponding to the invalid data features are deleted to obtain target data features among the multiple data features and target feature types corresponding to the target data features among the feature types corresponding to the multiple data features, and a target search statement is obtained based on the target data features and the target feature types corresponding to the target data features.
[0083] It can be seen that in this application, firstly, the clauses with the same meaning are merged and simplified based on the Karnaugh map to obtain the search merge statement, and then the invalid data features and invalid feature types that are irrelevant to the target data features in the search merge statement are deleted, and finally the target search statement is obtained based on the target data features and the target feature type to complete the optimization of the search engine. In this way, the search engine is actively optimized during the data search process of the search engine, and the simplified adjustment of the initial search statement is achieved, thereby achieving better optimization of the search engine.
[0084] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0085] Next, the technical terms that may appear in this application are explained.
[0086] Slow Log: Slow Log is used to record the logs generated by command requests or search statements whose execution time exceeds the preset threshold.
[0087] Karnaugh map: Karnaugh map is a graphical representation of logic function. The basic principle of using Karnaugh map to simplify logic function is to combine logical basis and graphical features, and to merge adjacent small squares representing adjacent minimum terms on the Karnaugh map by "circling" them together to achieve the purpose of replacing several minimum terms with a simple "AND" term.
[0088] The following is an example of an embodiment to illustrate a search engine optimization method provided by the present application. Figure 1 , which is a flow chart of a search engine optimization method provided by an embodiment of the present application, such as Figure 1 As shown, the method includes:
[0089] S101: Obtaining an initial search statement of a search engine.
[0090] In the present application, the initial search statement includes the search statement generated for the first time by the search engine based on the search request submitted by the searcher, so that in the subsequent process, the search engine can be optimized based on the initial search statement, thereby avoiding problems such as serious consumption of server resources and soaring server memory usage.
[0091] In an achievable implementation, in this application, the slow log generated by the search engine during use (i.e., during the data search process) can first be obtained, wherein the slow log includes abnormal search statements, search dates, and search time generated when the search engine performs a search operation. It should be noted that the slow log can also include search indexes and shard serial numbers, etc., which are not specifically limited here. It can be understood that if the search time in the slow log is greater than the preset search time, the slow log generated by the search engine during the data search process can be obtained. After that, the slow log is parsed to obtain abnormal search statements in the slow log. The abnormal search statement is a statement that causes serious server resource consumption and a surge in server memory usage during the data search process.
[0092] It should also be noted that the abnormal search statement (i.e., json statement) in the slow log may be an incomplete search statement. At this time, it is also necessary to determine whether the content in the abnormal search statement meets the content integrity rule. If the content in the abnormal search statement meets the content integrity rule, the abnormal search statement can be directly determined as the initial search statement of the search engine; if the content in the abnormal search statement does not meet the content integrity rule, it is necessary to obtain the search statement log based on the abnormal search log, and obtain the initial search statement of the search engine based on the search statement log.
[0093] It is understandable that the present application can locate the log (i.e., search statement log) corresponding to the search time in the application log according to the search time in the slow log, and then perform log parsing on the search statement log to obtain the search statement that meets the content integrity rule, and then the search statement can be determined as the initial search statement of the search engine. In this way, the search statement that may cause search anomalies is determined in the present application by parsing the log, so that the optimization of the search engine can be realized in advance in the future.
[0094] It should be further explained that in the present application, the time taken for slow search can also be analyzed in chronological order to determine the search statements whose time taken has increased dramatically based on the time taken, and to identify the search statements whose time taken has increased dramatically as the search statements that may cause search abnormality problems (i.e., the initial search statements).
[0095] In another achievable implementation, the present application can also determine the slow log according to the load index, search performance index and thread pool index, wherein the load index includes CPU utilization, memory utilization and disk utilization, the search performance index includes response time and search error rate, and the thread pool index includes thread pool queue length and thread pool rejected request number. It can be understood that if any one of the load index, search performance index and thread pool index meets the abnormal index (wherein the abnormal index includes excessive CPU utilization, excessive memory utilization, excessive disk utilization, increased response time, increased search error rate, increased thread pool queue length and increased number of thread pool rejected requests), the slow log can be determined, so that in the subsequent process, the initial search statement can be determined based on the log that may have search abnormality problems.
[0096] In some examples, after obtaining the initial search statement of the search engine, the present application may also perform keyword parsing on the initial search statement to obtain multiple keywords in the initial search statement, wherein the keywords include the execution flow of the code in the control statement, and the multiple keywords may include keywords of different data types, such as bool, query, fields, boost, from, size, etc. After that, it can be determined whether the first keyword exists in the multiple keywords, and whether the number of keywords of the first keyword is greater than the preset number of keywords. If the first keyword exists in the multiple keywords, and the number of keywords of the first keyword is greater than the preset number of keywords, then the keyword statement corresponding to the first keyword is determined according to the first keyword, and it is determined according to the keyword statement that there are multiple clauses with the same meaning in the initial search statement.
[0097] It should be noted that the first keyword can be bool. When the number of bools in the initial search statement is greater than the number of preset keywords, multiple keyword statements based on bool in the initial search statement are determined, and multiple clauses with the same meaning in the multiple keyword statements are determined, wherein the clauses with the same meaning can be understood as clauses based on must and clauses based on should, etc., or can be understood as two or more clauses based on must, etc., so as to facilitate subsequent simplification of the initial search statement. It should also be noted that if the first keyword exists among multiple keywords, and the number of keywords of the first keyword is not greater than the number of preset keywords, or if the first keyword does not exist among multiple keywords, then a subsequent operation of determining whether the second keyword and the third keyword exist among the multiple keywords can be performed, so that the optimization of the search engine can be achieved from another keyword detection aspect.
[0098] S102: If there are multiple clauses with the same meaning in the initial search statement, the multiple clauses with the same meaning are merged and simplified using a Karnaugh map to obtain a search merge statement.
[0099] It should be noted that in the present application, the Karnaugh map can also be used to merge and simplify the statements corresponding to the complex logical expressions with a deep nesting level in the initial search statement, which can reduce the length and complexity of the initial search statement to a certain extent, thereby achieving optimization of the search engine.
[0100] like Figure 2 As shown, Figure 2 A schematic diagram of a Karnaugh map proposed in a search engine optimization method provided in an embodiment of the present application, Figure 2 An initial Karnaugh map constructed based on logical expressions corresponding to multiple clauses with the same meaning is shown, so that multiple clauses with the same meaning can be merged and simplified based on the initial Karnaugh map, where true represents a clause based on the must keyword or the should keyword, and false represents a clause based on the must not keyword.
[0101] like Figure 3 As shown, Figure 3 A schematic diagram of multiple clauses with the same meaning in a search engine optimization method provided in an embodiment of the present application, in Figure 3The statements shown in lines 5 to 7 include three clauses based on must not, the statements shown in lines 8 to 9 include one clause based on must not and one clause based on must, the statements shown in lines 10 to 11 include one clause based on must not and one clause based on must, and the statements shown in lines 12 to 14 include three clauses based on must. Accordingly, the four statements can be transformed into logical expressions (!A&!B&!C)||(!B&C)||(!A&B)||(A&B&C), so that the merging and simplification between clauses can be realized later according to the Karnaugh map.
[0102] like Figure 4 As shown, Figure 4 A schematic diagram of a Karnaugh map proposed in another search engine optimization method provided in an embodiment of the present application, Figure 4 The expression Karnaugh map obtained according to the logical expression is shown, and the above logical expression is reflected in the expression Karnaugh map in the form of "checking" to simplify the subsequent merging of clauses. The "√" from left to right in the first row can be understood as (!A&!B&!C), (!B&C), (!A&B), (!A&B) in the logical expression, and the "√" from left to right in the second row can be understood as (!B&C), (A&B&C) in the logical expression.
[0103] like Figure 5 As shown, Figure 5 A schematic diagram of a Karnaugh map proposed in another search engine optimization method provided in an embodiment of the present application, Figure 5 The schematic diagram of merging and simplifying multiple clauses with the same meaning according to the expression Karnaugh map is shown. It can be understood that according to the principle of the Karnaugh map, the largest adjacent boxes that meet the conditions can be framed, and finally two intersecting boxes can be obtained. Figure 5 The horizontal combo box in the , that is, the area where A is false, can be represented by !A; Figure 5 The vertical combo box in , that is, the area where C is true, can be represented by C. At this time, the logical expression (!A&!B&!C)||(!B&C)||(!A&B)||(A&B&C) can be simplified to the logical expression (!A||C), thereby using the Karnaugh map to merge and simplify multiple clauses with the same meaning in the initial search statement.
[0104] Combination Figure 3, in the logical expression, condition A is true, corresponding to: binganshouye.pat_info.sex_name = male, condition B is true, corresponding to: binganshouye.pat_info.hospital_name = xx hospital, condition C is true, corresponding to: ruyuanjilu.chief_complaint.symptom.symptom_name = headache. In the logical expression, condition A is false, corresponding to: binganshouye.pat_info.sex_name≠male, condition B is false, corresponding to: binganshouye.pat_info.hospital_name≠xx hospital, condition C is false, corresponding to: ruyuanjilu.chief_complaint.symptom.symptom_name≠headache. At this time, according to the clause merging and simplification, multiple clauses with the same meaning can be simplified to only include clauses with condition A being false and clauses with condition C being true, so as to improve data search efficiency and reduce server memory consumption.
[0105] S103: performing data analysis on the search merge statement to obtain a plurality of data features in the search merge statement and feature types corresponding to the plurality of data features.
[0106] It can be understood that the search merge statement includes multiple data features and feature types corresponding to the multiple data features. At this time, data parsing is performed on the search merge statement, so that invalid data features and feature types can be eliminated based on the multiple data features and feature types corresponding to the multiple data features, so as to further optimize the search engine.
[0107] S104: Deleting invalid data features from the multiple data features and invalid feature types corresponding to the invalid data features, obtaining target data features from the multiple data features, and target feature types corresponding to the target data features from feature types corresponding to the multiple data features.
[0108] In this step, invalid data features can be understood as the existence of invalid data features is meaningless to the search of target data features, which may cause serious server resource consumption. Correspondingly, invalid feature types of target feature types can also be understood as the existence of invalid feature types is meaningless to the search of target feature types, which may cause serious server resource consumption.
[0109] In a feasible implementation, the multiple data features include a first data feature and a second data feature, and a feature relationship between the first data feature and the second data feature can be determined based on the first data feature and the second data feature. If the feature relationship is an exclusive relationship (i.e., the existence of the first data feature will affect the search for the second data feature), the second data feature can be used as a target data feature among the multiple data features, and the first data feature can be used as an invalid data feature of the target data feature.
[0110] At this time, the invalid data features for the target data features among the multiple data features can be deleted, and the target data features among the multiple data features can be retained, and the invalid feature types corresponding to the invalid data features among the feature types corresponding to the multiple data features can be deleted, and the target feature types corresponding to the target data features among the feature types corresponding to the multiple data features can be retained, so as to improve the search efficiency and accuracy.
[0111] As an example, if the search merge statement is "Gender equals male & department equals gynecology & disease equals gynecological disease related", "male" can be the target data feature, "gynecology" and "gynecological disease related" can be invalid data features of the target data feature, then the invalid data features and the invalid feature types corresponding to the invalid data features can be deleted, that is, "Department equals gynecology & disease equals gynecological disease related".
[0112] It should be noted that if the feature relationship between the first data feature and the second data feature is a necessary relationship (i.e., the existence of the first data feature must lead to the existence of the second data feature), the first data feature can be used as the target data feature among multiple data features, and the second data feature can be used as an invalid data feature of the target data feature, so as to facilitate the subsequent deletion of the invalid data features and the retention of the target data features.
[0113] As another example, if the search merge statement is "Disease equals hypertension & visit time is less than today's date", where "hypertension" can be the target data feature and "less than today's date" can be an invalid data feature of the target data feature, since "visit time is less than today's date" is an inevitable event, "visit time is less than today's date" can be deleted and "disease equals hypertension" can be retained.
[0114] It should also be explained that after executing the operation of deleting invalid data features and invalid feature types corresponding to the invalid data features from multiple data features, obtaining target data features from multiple data features, and target feature types corresponding to the target data features from feature types corresponding to multiple data features, the present application can also add specific features corresponding to the target data features and specific feature types corresponding to the specific features, wherein the specific features and their specific feature types can be understood as that the existence of specific features and their specific feature types can further improve the search accuracy and improve the search performance for the target data features and their target feature types.
[0115] In one example, if the target data feature and the target feature type corresponding to the target data feature are "disease equals uterine fibroids", then the specific feature corresponding to the target data feature and the specific feature type corresponding to the specific feature can be added, that is, "gender = female"; or, if the target data feature and the target feature type corresponding to the target data feature are "disease equals neonatal jaundice", then the specific feature corresponding to the target data feature and the specific feature type corresponding to the specific feature can be added, that is, "date of birth is less than 42 days", so as to achieve further optimization of the search engine.
[0116] S105: Obtain a target search statement according to the target data feature and the target feature type corresponding to the target data feature.
[0117] In this step, the target data features, the target feature types corresponding to the target data features, the specific features corresponding to the target data features, and the specific feature types corresponding to the specific features can be combined to obtain a target search statement, so that the search engine can perform data search based on the target search statement, thereby achieving optimization of the search engine.
[0118] In an achievable implementation, the present application performs keyword parsing on the initial search statement in step S101, and after obtaining multiple keyword operations in the initial search statement, it can also determine whether the second keyword and the third keyword exist in the multiple keywords. If the second keyword and the third keyword do not exist in the multiple keywords, step S102 is executed; if the second keyword and the third keyword exist in the multiple keywords, step S102 may not be executed, that is, the process of optimizing the search engine from the aspects of Karnaugh map simplification and data feature optimization is not executed, but the optimization of the search engine is implemented from the aspect of keyword detection.
[0119] Next, the keyword detection aspect is introduced. Specifically, the second keyword and the third keyword can be parsed to obtain the value domain corresponding to the second keyword and the value domain corresponding to the third keyword, and the value domain corresponding to the second keyword and the value domain corresponding to the third keyword are added to obtain the sum of the value domain corresponding to the second keyword and the value domain corresponding to the third keyword, and the sum is used as the target value domain. After that, the initial search statement can be processed according to the target value domain to obtain the target search statement, so as to achieve the optimization of the search engine in terms of keyword detection. It should be noted that the second keyword can be from, and the third keyword can be size, and from and size are used to realize search page turning, that is, each page turns from the first page.
[0120] Furthermore, before the application processes the initial search statement according to the target value domain to obtain the target search statement operation, it can also obtain the target keyword, wherein the target keyword is used to support the search engine to perform a jump search operation. After this, it can be determined whether the target value domain is greater than the preset value domain. If the target value domain is not greater than the preset value domain, the subsequent keyword replacement operation can be omitted; if the target value domain is greater than the preset value domain, the second keyword and the third keyword in the initial search statement can be replaced with the target keyword to obtain the target search statement with the target keyword to complete the optimization of the search engine. It should be noted that the target keyword can be scroll or search_after. At this time, if the target value domain of from+size is greater than 10000, that is, it exceeds the maximum page turning threshold, from and size can be replaced with scroll or search_after, so as to achieve fast search and page turning and complete the optimization of the search engine.
[0121] In another achievable implementation, after executing the operation of obtaining the initial search statement of the search engine, if there are no multiple clauses with the same meaning in the initial search statement, step S102 may not be executed. Further, the initial search statement may be parsed to obtain multiple search statements in the initial search statement, and the multiple search statements may be calculated to obtain the search costs corresponding to the multiple search statements, wherein the application may calculate the number of keywords corresponding to the multiple search statements to obtain the search cost, and the fewer the number of keywords, the smaller the search cost; the application may also calculate the number of expected query results corresponding to the multiple search statements to obtain the search cost, and the fewer the number of expected query results, the smaller the search cost. It should be noted that the calculation process for obtaining the search cost is not limited here, and it can also be applied according to actual conditions in practical applications.
[0122] Finally, the multiple search statements can be sorted based on the search costs corresponding to the multiple search statements to obtain sorted search statements, wherein the search statement with the lowest search cost can be placed first in the sorted search statements, so that the search statement with the lowest search cost can be processed first in the subsequent process. And the sorted search statements are used as target search statements to complete the optimization of the search engine. In this way, the search statements with lower consumption costs are placed at the front of the search, which can reduce the search time and improve the overall performance.
[0123] It should be noted that in the present application, the search statement can also be evaluated based on the short-circuit Boolean search of the search engine. If a search statement in the clause based on must has a search anomaly problem, then the entire must clause will be judged to have a search anomaly problem, and the subsequent search will no longer be performed. It should also be noted that, since the schema of the search engine in the related art is actively modified by the technicians and cannot be adjusted automatically, the schema of the search engine can be understood as a data tag (i.e., search field), which can enable the search engine to better implement data search. Therefore, in the present application, the fields with high reuse rate / usage rate in N search statements can be merged, and the search statement can reduce the dimension from N to 1, or a new derivative field can be added after N synonym fields with high reuse rate to realize the normalization of all entries, so as to realize the automatic optimization of the search engine schema.
[0124] It should be further explained that if there are aggregations in multiple keywords, that is, keywords of aggregation statements, and aggregation fields containing highly unique values (such as patient ID, medical order number, test number, etc.), that is, aggregation runs on high cardinality fields, a large amount of resources are required to extract many storage buckets, then the search statement is intercepted and subsequent search operations are not performed; or, there are match_all, "from":null,"to":null in multiple keywords, that is, keywords belonging to full database search, which will occupy a large amount of memory during search, then the search statement is intercepted and subsequent search operations are not performed; or, if the key and value structures in multiple keywords can be matched as [az\\.\\_], then it can be considered as a specific field. If the field path does not match the field in the index, it is considered to be an abnormal field, then the search statement is intercepted and subsequent search operations are not performed. Further, fields such as "Please simplify the search request" can also be returned to remind the search personnel that the search request submitted needs to be modified.
[0125] like Figure 6 As shown, Figure 6 A full flow chart of search engine optimization in a search engine optimization method provided in an embodiment of the present application, in Figure 6 First, the slow log of the search engine during the data search process and the abnormal search statements in the slow log are obtained. If the content in the abnormal search statement meets the content integrity rule, the abnormal search statement is determined as the initial search statement of the search engine; or, if the content in the abnormal search statement does not meet the content integrity rule, the search statement log in the application end is obtained according to the abnormal search log, and the initial search statement of the search engine is obtained according to the search statement log. After that, the initial search statement in the slow log / search statement log can be optimized by using the Karnaugh map to merge statements and delete invalid data features, or by replacing keywords in the initial search statement, or by sorting search statements for multiple search statements in the initial search statement. It should be noted that in the present application, the search engine optimization scheme mentioned in the above process can also be used to achieve search engine optimization.
[0126] In summary, in this embodiment, firstly, the clauses with the same meaning are merged and simplified based on the Karnaugh map to obtain the search merge statement, and then the invalid data features and invalid feature types that are irrelevant to the target data features in the search merge statement are deleted, and finally the target search statement is obtained based on the target data features and the target feature types to complete the optimization of the search engine. In this way, the search engine is actively optimized during the data search process of the search engine, and the simplified adjustment of the initial search statement is achieved, thereby achieving better optimization of the search engine.
[0127] The following is an introduction to a search engine optimization device provided in an embodiment of the present application. The search engine optimization device described below and the search engine optimization method described above can be referred to in correspondence with each other. Figure 7 , which is a schematic diagram of the structure of a search engine optimization device provided in an embodiment of the present application, such as Figure 7 As shown, the search engine optimization device includes:
[0128] An initial search statement acquisition unit 701 is used to acquire an initial search statement of a search engine;
[0129] A search merge statement obtaining unit 702 is used to combine and simplify the multiple clauses with the same meaning by using a Karnaugh map to obtain a search merge statement if there are multiple clauses with the same meaning in the initial search statement;
[0130] A search merge statement parsing unit 703, configured to perform data parsing on the search merge statement to obtain a plurality of data features in the search merge statement and feature types corresponding to the plurality of data features;
[0131] The data feature type deleting unit 704 is used to delete the invalid data features and the invalid feature types corresponding to the invalid data features from the multiple data features, and obtain the target data feature from the multiple data features and the target feature type corresponding to the target data feature from the feature types corresponding to the multiple data features respectively;
[0132] The first search statement obtaining unit 705 is configured to obtain a target search statement according to the target data feature and a target feature type corresponding to the target data feature.
[0133] Optionally, the device further comprises:
[0134] A specific feature type adding unit, used for adding a specific feature corresponding to the target data feature and a specific feature type corresponding to the specific feature;
[0135] The first search statement optimization unit 705 is specifically used to:
[0136] A target search statement is obtained by combining the target data feature, the target feature type corresponding to the target data feature, the specific feature corresponding to the target data feature, and the specific feature type corresponding to the specific feature.
[0137] Optionally, the initial search statement acquiring unit 701 is specifically configured to:
[0138] Obtaining the slow log generated by the search engine during use, and obtaining abnormal search statements in the slow log;
[0139] If the content in the abnormal search statement satisfies the content integrity rule, determining the abnormal search statement as the initial search statement of the search engine;
[0140] If the content in the abnormal search statement does not meet the content integrity rule, a search statement log is obtained according to the abnormal search log, and an initial search statement of the search engine is obtained according to the search statement log.
[0141] Optionally, the device further comprises:
[0142] A plurality of keyword obtaining units, used for performing keyword parsing on the initial search statement to obtain a plurality of keywords in the initial search statement;
[0143] The unit for determining clauses with the same meaning is used to determine the keyword sentence corresponding to the first keyword according to the first keyword if the number of keywords of the first keyword among the multiple keywords is greater than the preset number of keywords, and to determine whether there are multiple clauses with the same meaning in the initial search sentence according to the keyword sentence.
[0144] Optionally, the device further comprises:
[0145] a keyword determination unit, configured to, if the second keyword and the third keyword exist in the plurality of keywords, not execute the step of merging and simplifying the plurality of clauses with the same meaning by using a Karnaugh map to obtain a search merge statement if the plurality of clauses with the same meaning exist in the initial search statement;
[0146] A keyword parsing unit, used to parse the second keyword and the third keyword to obtain a value range corresponding to the second keyword and a value range corresponding to the third keyword;
[0147] a target value range obtaining unit, configured to take the sum of the value range corresponding to the second keyword and the value range corresponding to the third keyword as the target value range;
[0148] The second search statement obtaining unit is used to process the initial search statement according to the target value range to obtain a target search statement.
[0149] Optionally, the device further comprises:
[0150] A target keyword acquisition unit, used to acquire a target keyword, wherein the target keyword is used to support the search engine to perform a jump search operation;
[0151] The second search statement obtaining unit is specifically used for:
[0152] If the target value range is greater than the preset value range, the second keyword and the third keyword in the initial search statement are replaced with the target keyword to obtain a target search statement containing the target keyword.
[0153] Optionally, the device further comprises:
[0154] A plurality of search statement optimization units, configured to perform statement parsing on the initial search statement if there are no multiple clauses with the same meaning in the initial search statement, to obtain multiple search statements in the initial search statement;
[0155] A search cost obtaining unit, configured to calculate the multiple search statements to obtain search costs respectively corresponding to the multiple search statements;
[0156] The third search statement obtaining unit is used to sort the multiple search statements based on the search costs respectively corresponding to the multiple search statements, obtain sorted search statements, and use the sorted search statements as target search statements.
[0157] The search engine optimization device provided in the embodiment of the present application has the same beneficial effects as the search engine optimization method provided in the above embodiment, and therefore will not be described in detail.
[0158] Electronic device embodiment
[0159] See also Figure 8 , which is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, such as Figure 8 As shown, including:
[0160] A memory 11, used for storing computer programs;
[0161] The processor 12 is configured to implement the steps of the search engine optimization method described in any of the above method embodiments when executing the computer program.
[0162] In this embodiment, the device may be a vehicle-mounted computer, a PC (Personal Computer), or a terminal device such as a smart phone, a tablet computer, a PDA, or a portable computer.
[0163] The device may include a memory 11, a processor 12 and a bus 13. The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. The memory 11 may be an internal storage unit of the device in some embodiments, such as a hard disk of the device. The memory 11 may also be an external storage device of the device in other embodiments, such as a plug-in hard disk equipped on the device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Further, the memory 11 may also include both an internal storage unit of the device and an external storage device. The memory 11 may not only be used to store application software and various types of data installed on the device, such as program codes for executing a search engine optimization method, but may also be used to temporarily store data that has been output or is to be output.
[0164] In some embodiments, the processor 12 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor or other data processing chip, and is used to run program codes or process data stored in the memory 11, such as program codes for executing search engine optimization methods.
[0165] The bus 13 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0166] Furthermore, the device may also include a network interface 14, which may optionally include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the device and other electronic devices.
[0167] Optionally, the device may further include a user interface 15, which may include a display (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 15 may also include a standard wired interface and a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch device, etc. The display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the device and to display a visual user interface.
[0168] Figure 8 Only the device with components 11-15 is shown, and it can be understood by those skilled in the art that Figure 8 The structure shown does not constitute a limitation of the device, and may include fewer or more components than shown, or combine certain components, or arrange the components differently.
[0169] Readable storage medium embodiment
[0170] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the search engine optimization method described in any of the above method embodiments are implemented. The storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0171] It should also be noted that the "first" and "second" (if any) in the names such as "first" and "second" mentioned in the embodiments of the present application are only used as name identifiers and do not represent the first or second in order.
[0172] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0173] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0174] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0175] The above is a detailed introduction to a search engine optimization method, device, electronic device and storage medium provided by the present application. This article uses specific examples to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core ideas of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
Claims
1. A search engine optimization method, characterized in that: include: Get the initial search statement of the search engine; If there are multiple clauses with the same meaning in the initial search statement, the multiple clauses with the same meaning are merged and simplified using the Karnaugh map to obtain a search merge statement; Performing data parsing on the search merge statement to obtain a plurality of data features in the search merge statement and feature types corresponding to the plurality of data features; Deleting invalid data features and invalid feature types corresponding to the invalid data features from the multiple data features, obtaining a target data feature from the multiple data features, and a target feature type corresponding to the target data feature from feature types corresponding to the multiple data features; A target search statement is obtained according to the target data feature and a target feature type corresponding to the target data feature.
2. The method according to claim 1, characterized in that After deleting the invalid data features from the multiple data features and the invalid feature types corresponding to the invalid data features, obtaining the target data features from the multiple data features, and the target feature types corresponding to the target data features from the feature types corresponding to the multiple data features, the method further includes: Adding a specific feature corresponding to the target data feature and a specific feature type corresponding to the specific feature; The obtaining a target search statement according to the target data feature and a target feature type corresponding to the target data feature includes: A target search statement is obtained by combining the target data feature, the target feature type corresponding to the target data feature, the specific feature corresponding to the target data feature, and the specific feature type corresponding to the specific feature.
3. The method according to claim 1, characterized in that: The step of obtaining the initial search statement of the search engine includes: Obtaining the slow log generated by the search engine during use, and obtaining abnormal search statements in the slow log; If the content in the abnormal search statement satisfies the content integrity rule, determining the abnormal search statement as the initial search statement of the search engine; If the content in the abnormal search statement does not meet the content integrity rule, a search statement log is obtained according to the abnormal search log, and an initial search statement of the search engine is obtained according to the search statement log.
4. The method according to claim 1, characterized in that: After obtaining the initial search statement of the search engine, the method further includes: Perform keyword parsing on the initial search statement to obtain multiple keywords in the initial search statement; If the number of keywords including the first keyword among the multiple keywords is greater than the preset number of keywords, a keyword sentence corresponding to the first keyword is determined according to the first keyword, and multiple clauses with the same meaning are determined in the initial search sentence according to the keyword sentence.
5. The method according to claim 4, characterized in that After performing keyword parsing on the initial search statement to obtain a plurality of keywords in the initial search statement, the method further includes: If the second keyword and the third keyword exist in the multiple keywords, then if there are multiple clauses with the same meaning in the initial search statement, the step of merging and simplifying the multiple clauses with the same meaning using the Karnaugh map to obtain a search merge statement is not performed; Parsing the second keyword and the third keyword to obtain a value range corresponding to the second keyword and a value range corresponding to the third keyword; The sum of the value range corresponding to the second keyword and the value range corresponding to the third keyword is used as the target value range; The initial search statement is processed according to the target value range to obtain a target search statement.
6. The method according to claim 5, characterized in that Before the initial search statement is processed according to the target value range to obtain a target search statement, the method further includes: Acquire a target keyword, wherein the target keyword is used to support the search engine to perform a jump search operation; The processing of the initial search statement according to the target value range to obtain a target search statement includes: If the target value range is greater than the preset value range, the second keyword and the third keyword in the initial search statement are replaced with the target keyword to obtain a target search statement containing the target keyword.
7. The method according to claim 1, characterized in that After obtaining the initial search statement of the search engine, the method further includes: If there are no multiple clauses with the same meaning in the initial search statement, parsing the initial search statement to obtain multiple search statements in the initial search statement; Calculating the multiple search statements to obtain search costs corresponding to the multiple search statements respectively; The multiple search statements are sorted based on the search costs respectively corresponding to the multiple search statements to obtain sorted search statements, and the sorted search statements are used as target search statements.
8. A search engine optimization device, characterized in that: include: An initial search statement acquisition unit, used to acquire an initial search statement of a search engine; A search merge statement obtaining unit, configured to, if there are multiple clauses with the same meaning in the initial search statement, merge and simplify the multiple clauses with the same meaning using a Karnaugh map to obtain a search merge statement; A search merge statement parsing unit, configured to perform data parsing on the search merge statement to obtain a plurality of data features in the search merge statement and feature types corresponding to the plurality of data features; a data feature type deleting unit, configured to delete invalid data features and invalid feature types corresponding to the invalid data features from among the multiple data features, and obtain a target data feature from among the multiple data features, and a target feature type corresponding to the target data feature from among the feature types corresponding to the multiple data features; The first search statement obtaining unit is used to obtain a target search statement according to the target data feature and a target feature type corresponding to the target data feature.
9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the search engine optimization method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the search engine optimization method according to any one of claims 1 to 7 are implemented.
