Data search method, device, equipment and storage medium

By grading search sentences with word segmentation and candidate files, the problem of unreasonable search results in the prior art is solved, and more accurate and efficient search results return is achieved, improving user experience.

CN112182405BActive Publication Date: 2025-02-11NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011152902.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-23
Publication Date
2025-02-11
Estimated Expiration
2040-10-23

AI Technical Summary

Technical Problem

In the prior art, searching each document directly based on the problem leads to unreasonable search results and affecting the user experience.

Method used

By performing word segmentation on search statements, obtain search keywords, and obtain candidate files from the database based on these keywords. Then, the score of the file is calculated based on the data content of the preset function field in the candidate file, and finally the search result is returned to the client based on the score.

Benefits of technology

Through the unified format processing of preset function fields, we ensure that the candidate files of different data sources are consistent, avoiding the weight definition problem caused by different formats, and improving the accuracy and user experience of search results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112182405B_ABST
    Figure CN112182405B_ABST
Patent Text Reader

Abstract

The present application provides a data search method, device, equipment and storage medium, which relates to the field of data search technology. The method includes: segmenting the search statement to obtain search keywords; obtaining at least one candidate file including the search keywords from a database according to the search keywords; calculating the score of the candidate file according to the data content corresponding to the preset function field in the candidate file; and returning the search result corresponding to the search statement to the client according to the score of at least one candidate file. Compared with the prior art, it avoids the problem of searching for each document directly according to the question, resulting in unreasonable sorting of search results and affecting user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data search technology, and in particular to a data search method, device, equipment and storage medium. Background Art

[0002] When using search engines, how to rank content that can answer users' questions higher has always been a topic without a standard answer.

[0003] In the existing technology, after obtaining the user's search statement, the search statement is generally segmented, and then each answer document is scored according to the combination of each segmentation of the search statement and the segmentation of each answer document. Based on the scoring results, the answer documents are sorted and fed back to the user.

[0004] However, due to the different file formats, each data source has its own corresponding fields. If you search for each document directly based on the question, the search results will be unreasonable and affect the user experience. Summary of the invention

[0005] The purpose of this application is to provide a data search method, device, equipment and storage medium to address the deficiencies in the above-mentioned prior art, so as to solve the problem in the prior art of directly searching for documents based on questions, resulting in unreasonable search results and affecting user experience.

[0006] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:

[0007] In a first aspect, an embodiment of the present application provides a data search method, the method comprising:

[0008] Segment the search statement to obtain the search keywords;

[0009] According to the search keyword, obtaining at least one candidate file including the search keyword from a database;

[0010] Calculate the score of the candidate file according to the data content corresponding to the preset function field in the candidate file;

[0011] According to the score of at least one of the candidate files, the search result corresponding to the search statement is returned to the client.

[0012] Optionally, the preset function field includes: a plurality of function fields, and the calculating the score of the candidate file according to the data content corresponding to the preset function field in the candidate file includes:

[0013] Calculating a content score of the candidate file according to the data content corresponding to each function field in the candidate file;

[0014] The score of the candidate file is calculated according to the multiple content scores of the candidate file.

[0015] Optionally, calculating a content score of the candidate file according to the data content corresponding to each function field in the candidate file includes:

[0016] Obtaining the data content length corresponding to each function field and the average length of the data content corresponding to all function fields in the candidate file;

[0017] Determine, according to the search keyword and the data content corresponding to each function field, the frequency of occurrence of the search keyword in the content corresponding to each function field;

[0018] Determining a weight of the search keyword according to a frequency of the search keyword in the at least one candidate file;

[0019] A content score of the candidate file is calculated according to the data content length corresponding to each function field, the average length, the number of occurrences and the weight of the search keyword.

[0020] Optionally, the candidate file is a non-updatable file; before calculating the score of the candidate file according to the data content corresponding to the preset function field in the candidate file, the method further includes:

[0021] According to the name index of the preset functional field, the first field mapping relationship corresponding to the candidate file is adopted to determine from the candidate file that the data content of the initial field is the data content corresponding to the preset functional field; the first field mapping relationship is: a mapping relationship between the data content of the functional field and the initial field.

[0022] Optionally, the candidate file is an updateable file, and before calculating the score of the candidate file according to the data content corresponding to the preset function field in the candidate file, the method further includes:

[0023] According to the name index of the preset function field, the initial field corresponding to the name index is determined by using the second field mapping relationship corresponding to the candidate file, wherein the second field mapping relationship is: a mapping relationship between a function field and an initial field, and in the second field mapping relationship, the type of the function field is pre-declared as: an alias of the initial field;

[0024] According to the initial field, the data content corresponding to the initial field is determined from the candidate file as the data content corresponding to the preset function field.

[0025] Optionally, before acquiring at least one candidate file including the search keyword from a database according to the search keyword, the method further includes:

[0026] Determine the first field mapping relationship corresponding to the candidate file;

[0027] The first field mapping relationship and the candidate file are stored in the database.

[0028] Optionally, before acquiring at least one candidate file including the search keyword from a database according to the search keyword, the method further includes:

[0029] Determine the second field mapping relationship corresponding to the candidate file;

[0030] The second field mapping relationship and the candidate file are stored in the database.

[0031] Optionally, the candidate file is: a table in a table file, and the multiple functional fields include: a title field and a content field;

[0032] The data content corresponding to the title field includes: the data content of the entry name in the table;

[0033] The data content corresponding to the content field includes: the data content of other fields in the table except the entry name.

[0034] Optionally, the candidate file is: a web page file, and the multiple functional fields include: a title field and a content field;

[0035] The data content corresponding to the title field includes: the data content of the title field in the web page file;

[0036] The data content corresponding to the content field includes: the data content of the body field in the web page file.

[0037] Optionally, the candidate file is: a non-text file, and the multiple functional fields include: a title field and a content field;

[0038] The data content corresponding to the title field includes: the data content of the file name field in the non-text file;

[0039] The data content corresponding to the content field includes: the data content of the node content field in the non-text file.

[0040] Optionally, the plurality of function fields further include: a canvas field, an author field, a modification date field, and a node field;

[0041] The data content corresponding to the canvas field includes: the data content of the canvas name field in the non-text file;

[0042] The data content corresponding to the author field includes: the data content of the creator field in the non-text file;

[0043] The data content corresponding to the modification date field includes: the data content of the last modification date field in the non-text file;

[0044] The data content corresponding to the node field includes: the data content of the node segment in the non-text file.

[0045] In a second aspect, another embodiment of the present application provides a data search device, the device comprising: a word segmentation module, an acquisition module, a calculation module and a return module, wherein:

[0046] The word segmentation module is used to segment the search sentence to obtain the search keywords;

[0047] The acquisition module is used to acquire at least one candidate file including the search keyword from a database according to the search keyword;

[0048] The calculation module is used to calculate the score of the candidate file according to the data content corresponding to the preset function field in the candidate file;

[0049] The returning module is used to return the search result corresponding to the search statement to the client according to the score of at least one of the candidate files.

[0050] Optionally, the calculation module is specifically configured to calculate a content score of the candidate file according to data content corresponding to each functional field in the candidate file; and calculate a score of the candidate file according to multiple content scores of the candidate file.

[0051] Optionally, the device further comprises: a determination module, wherein:

[0052] The acquisition module is specifically used to acquire the data content length corresponding to each function field and the average length of the data content corresponding to all function fields in the candidate file;

[0053] The determination module is used to determine the frequency of occurrence of the search keyword in the content corresponding to each functional field according to the search keyword and the data content corresponding to each functional field; and determine the weight of the search keyword according to the frequency of the search keyword in the at least one candidate file;

[0054] The calculation module is specifically used to calculate a content score of the candidate file according to the data content length corresponding to each functional field, the average length, the number of occurrences and the weight of the search keyword.

[0055] Optionally, the determination module is specifically used to determine, based on the name index of the preset functional field and using the first field mapping relationship corresponding to the candidate file, that the data content of the initial field is the data content corresponding to the preset functional field from the candidate file; the first field mapping relationship is: a mapping relationship between the data content of the functional field and the initial field.

[0056] Optionally, the determination module is specifically used to determine the initial field corresponding to the name index according to the name index of the preset functional field and using the second field mapping relationship corresponding to the candidate file, wherein the second field mapping relationship is: a mapping relationship between a functional field and an initial field, and in the second field mapping relationship, the type of the functional field is pre-declared as: an alias of the initial field; based on the initial field, determine from the candidate file that the data content corresponding to the initial field is the data content corresponding to the preset functional field.

[0057] Optionally, the device further comprises: a storage module, wherein:

[0058] The determination module is specifically used to determine the first field mapping relationship corresponding to the candidate file;

[0059] The storage module is used to store the first field mapping relationship and the candidate file in the database.

[0060] Optionally, the determination module is specifically used to determine the second field mapping relationship corresponding to the candidate file;

[0061] The storage module is specifically used to store the second field mapping relationship and the candidate file in the database.

[0062] In the third aspect, another embodiment of the present application provides a data search device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the data search device is running, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of any method described in the first aspect above.

[0063] In a fourth aspect, another embodiment of the present application provides a storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of any method described in the first aspect are executed.

[0064] The beneficial effect of the present application is as follows: using the data search method provided by the present application, after determining at least one candidate file in the database according to the search keyword after word segmentation, the score of each candidate file is calculated according to the data content corresponding to the preset function field in the candidate file, and then the search result corresponding to the search statement is fed back to the client according to the score of at least one candidate file. Since the candidate file includes the preset function field, the format of the candidate files from different data sources is unified, so that even if the types of the candidate files are different or the data source formats are different, the weight of the same word in the same preset function field of each candidate file can be guaranteed to remain unchanged, so that the function fields with similar functions in different data sources share the score for the same query keyword. In this way, the score of the candidate file is calculated according to the data content corresponding to the preset function field in the candidate file, and then the search results returned based on the score of the candidate file are more reasonable, which improves the search accuracy and thus improves the user's search experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0066] Figure 1 A flowchart of a data search method provided in one embodiment of the present application;

[0067] Figure 2 A flowchart of a data search method provided by another embodiment of the present application;

[0068] Figure 3 A flowchart of a data search method provided by another embodiment of the present application;

[0069] Figure 4 A flowchart of a data search method provided by another embodiment of the present application;

[0070] Figure 5 A schematic diagram of the structure of a data search device provided in one embodiment of the present application;

[0071] Figure 6 A schematic diagram of the structure of a data search device provided by another embodiment of the present application;

[0072] Figure 7 A schematic diagram of the structure of a data search device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0073] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in combination with the drawings 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.

[0074] The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0075] In addition, the flowchart used in this application shows the operations implemented according to some embodiments of the application. It should be understood that the operations of the flowchart can be implemented out of order, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of this application, and can also remove one or more operations from the flowchart.

[0076] To facilitate understanding of this application, some terms involved in this application are explained as follows:

[0077] Elasticsearch: A search server based on Lucene. It provides a distributed, multi-user, full-text search engine and is a popular enterprise-level search engine. Elasticsearch is used in cloud computing and can achieve real-time search. It is stable, reliable, fast, and easy to install and use.

[0078] Index: Elasticsearch stores similar documents in a unit, which is equivalent to a table. The operation of enabling a new unit to store documents of a certain category is called creating a new index.

[0079] Document: In search engines, a unit of data that contains all the information needed to complete a piece of data. It is equivalent to a row in a table.

[0080] Field: The name of the information contained in the document, equivalent to the name of the column in the table.

[0081] Field type: The format of the data stored in the field, such as numbers, dates, strings, etc. Each field has one and only one field type. For a field that has not been set to a type, its corresponding field type can be set when creating an index, or let elasticsearch automatically identify and set it when storing a document. Once a field is set, it cannot be changed. A field with a set type cannot store data in other formats. For example, if the current field type is a number, text cannot be stored in the field.

[0082] Alias: A type of field that corresponds to another specific field. When referencing the alias field of the document, you can reference the value of the corresponding field. You need to declare it when creating an index and indicate which field the alias type is mapped to.

[0083] The following is an explanation of a data search method provided in an embodiment of the present application in combination with a number of specific application examples. Figure 1 A flow chart of a data search method provided in an embodiment of the present application is shown in FIG. 1 . The method provided in the present application is applied to a server on which the search engine Elasticsearch is installed. Figure 1 As shown, the method includes:

[0084] S101: Segment the search sentence to obtain search keywords.

[0085] Among them, after obtaining the search statement entered by the client through the search box of the Elasticsearch search engine, the server performs word segmentation processing on the received search statement, thereby changing the search statement problem from the granularity of keywords, splitting the search statement into at least one query keyword, thereby achieving the effect of keyword decoupling. For example, the search statement can be "top order strategy", and after word segmentation processing, the search statement can be split into two search keywords "top order" and "strategy". The client can be a search client, that is, a client that has a preset search engine installed and running.

[0086] S102: According to the search keyword, obtaining at least one candidate file including the search keyword from a database.

[0087] Each candidate file is a file including search keywords. The number of search keywords can be one or more. If there are more than one, each candidate file is a file including all or part of the search keywords.

[0088] For example, in one embodiment of the present application, the candidate file may be any type of candidate file of a plurality of preset types, that is, the types of different candidate files in the at least one candidate file may be the same or may be the same. The plurality of preset types may include, for example, at least two types of tables in a table file, web page files, or non-text files (such as mind map files, etc.). The type of the specific candidate file may be flexibly adjusted according to the needs of the user and is not limited to the above embodiments.

[0089] In the process of searching for candidate files, all search keywords can be searched in each candidate file. If a search keyword is missing in a candidate file, Elasticsearch defaults the keyword field content in the candidate file to an empty string.

[0090] S103: Calculate the score of the candidate file according to the data content corresponding to the preset function field in the candidate file.

[0091] For example, in some possible embodiments, the score of the candidate document corresponding to the preset functional field can be obtained based on the data content corresponding to the preset functional field, and the score of the candidate document can be calculated based on the score of the preset functional field and the preset weight of the preset functional field.

[0092] S104: Returning search results corresponding to the search statement to the client according to the score of at least one candidate file.

[0093] For example, in some possible embodiments, for example, the candidate files can be sorted according to the target score of at least one candidate file, a preset number of candidate files with a high ranking can be obtained, and the candidate files with a high ranking can be returned to the client through the search results. After obtaining the search results, the client displays the search results on the display interface. Alternatively, the sorting of all candidate files can be returned to the client through the search results, and after receiving the search results, the client only directly displays the preset number of candidate files with a high ranking to the user in order to save the space of the display interface, and the other candidate files are folded. After viewing the displayed candidate files, the user needs to click the view button on the interface, such as "View More", to expand the other candidate files for the user to view. It should be understood that the above-mentioned method of returning search results is only an exemplary description, and the specific method of returning search results can be flexibly adjusted according to user needs, and is not limited to the above-mentioned embodiment.

[0094] According to the data search method provided by the present application, after determining at least one candidate file in the database according to the search keyword after word segmentation, the score of each candidate file is calculated according to the data content corresponding to the preset function field in the candidate file, and then the search result corresponding to the search statement is fed back to the client according to the score of at least one candidate file. Since the candidate file includes the preset function field, the format of the candidate files from different data sources is unified, so that even if the candidate files are of different types or the data source formats are different, the weight of the same word in the same preset function field of each candidate file can be guaranteed to remain unchanged, so that the function fields with similar functions in different data sources share the score for the same query keyword. In this way, the score of the candidate file is calculated according to the data content corresponding to the preset function field in the candidate file, and then the search results returned based on the score of the candidate file are more reasonable, which improves the search accuracy and thus improves the user's search experience.

[0095] Furthermore, in this solution, when calculating the score of each candidate file, the score is calculated based on the granularity of keywords, which can make the calculation of the target score of the candidate file more accurate and improve the accuracy of each file in the search result.

[0096] Optionally, based on the above embodiment, the embodiment of the present application may further provide a data search method. The scoring process of candidate files in the above method is illustrated below with reference to the accompanying drawings. Figure 2 A flowchart of a data search method provided by another embodiment of the present application is shown as follows: Figure 2 As shown, S103 may include:

[0097] S105: Calculate a content score of the candidate file according to the data content corresponding to each functional field in the candidate file.

[0098] Optionally, in one embodiment of the present application, a content score for each candidate file can be calculated based on, for example, at least one of the following conditions: the content score is positively correlated with the frequency of the search keyword appearing in the data content corresponding to each functional field, negatively correlated with the length of the data content corresponding to each functional field, and negatively correlated with the probability of the search keyword appearing in all files, etc.

[0099] Among them, the first two are to ensure the proportion of search keywords in the data content corresponding to each functional field, so as to ensure the relevance of the data content corresponding to each functional field in the candidate file with the search sentence, and the frequency of the search keyword in all files is negatively correlated to reduce the weight of insignificant words. For example, take the search sentence "Single's strategy" as an example. After the search sentence is segmented, the search sentence is segmented into three search keywords "Single", "of", and "Strategy". Among them, due to the high frequency of the search keyword "of" in the data content corresponding to all functional fields, the score of the data content corresponding to the functional field containing only the search keyword "of" will be much lower than the data content corresponding to the functional field containing the search keyword "Single" or the search keyword "Strategy".

[0100] Among them, a content score of a candidate file is used to represent the relevance between the data content corresponding to a function field in the candidate file and the search keyword. In this way, for multiple function fields, multiple content scores of the candidate file can be obtained by executing S105. The higher the content score, the higher the relevance between the data content corresponding to the corresponding function field and the search keyword; conversely, the lower the score, the lower the relevance between the data content corresponding to the corresponding function field and the search keyword.

[0101] For example, the candidate files are respectively taken as: a table in a table file, a web page file or a non-text file as examples for explanation.

[0102] If the candidate file is a table in a table file, the multiple functional fields include: a title field and a content field; wherein the data content corresponding to the title field includes: the data content of the entry name in the table; the data content corresponding to the content field includes: the data content of other fields other than the entry name in the table.

[0103] If the candidate file is a web page file, the multiple functional fields include: a title field and a content field; wherein the data content corresponding to the title field includes: the data content of the title field in the web page file; the data content corresponding to the content field includes: the data content of the body field in the web page file.

[0104] If the candidate file is a non-text file, the multiple functional fields include: a title field and a content field; wherein the data content corresponding to the title field includes: the data content of the file name field in the non-text file; the data content corresponding to the content field includes: the data content of the node content field in the non-text file.

[0105] For example, a non-text file is taken as a mind map file. At this time, the multiple functional fields also include: canvas field, author field, modification date field, and node field; among them, the data content corresponding to the canvas field includes: the data content of the canvas name field in the non-text file; the data content corresponding to the author field includes: the data content of the creator field in the non-text file; the data content corresponding to the modification date field includes: the data content of the last modification date field in the non-text file; the data content corresponding to the node field includes: the data content of the node segment in the non-text file.

[0106] Optionally, in one embodiment of the present application, a method for calculating a content score of a candidate file may be, for example: obtaining the data content length corresponding to each functional field, and the average length of the data content corresponding to all functional fields in the candidate file; determining the frequency of occurrence of the search keyword in the content corresponding to each functional field based on the search keyword and the data content corresponding to each functional field; determining the weight of the search keyword based on the frequency of the search keyword in at least one candidate file; and calculating a content score of the candidate file based on the data content length corresponding to each functional field, the average length, the number of occurrences and the weight of the search keyword.

[0107] S106: Calculate the score of the candidate file according to the multiple content scores of the candidate file.

[0108] By adopting the method provided by the present application, since each candidate file includes a preset function field, the weight of the same search keyword in the function field with similar functions in each candidate file is guaranteed to remain unchanged, thereby avoiding the problem that the weights between the fields cannot be defined due to different formats and field names of the candidate files, and the subsequent problem of low accuracy in sorting the relevance of the search results due to the inability to define the weights.

[0109] Optionally, based on the above embodiment, the embodiment of the present application may further provide a data search method, and the implementation process of the above method is illustrated below in conjunction with the accompanying drawings. Figure 3 A flowchart of a data search method provided by another embodiment of the present application is shown below. If the candidate file is a non-updatable file; Figure 3 As shown, before S103, the method may further include:

[0110] S107: According to the name index of the preset function field, using the first field mapping relationship corresponding to the candidate file, determine from the candidate file that the data content of the initial field is the data content corresponding to the preset function field.

[0111] Among them, the first field mapping relationship is: the mapping relationship between the function field and the data content of the initial field; for example, if the initial field is "file name - file name", it means that the current initial field is named "file name" and the field content is "file name"; the first field mapping relationship is "title - file name", which means that there is a mapping relationship between the current function field "title" and the data content "file name" of the initial field. During the search process, if the search keyword is "title", the file name that has a mapping relationship with the search keyword can be directly searched based on the search keyword; this search method improves the search speed because the corresponding data content can be directly obtained based on the first field mapping relationship.

[0112] Optionally, in an embodiment of the present application, the first field mapping relationship may be stored in a preset document, which is used to store the first field mapping relationship, and the mapping of the initial field-functional field is added to the preset document.

[0113] For example, in one embodiment of the present application, before storing each candidate file, it is first necessary to determine whether there is an update requirement for the content in the candidate file to be stored, and determine whether the update type of the candidate file is an updateable file or a non-updatable file based on the determination result of the update requirement. If it is determined that the candidate file to be stored is a non-updatable file, the first field mapping relationship corresponding to the candidate file is determined based on the file type of the candidate file to be stored; the first field mapping relationship and the candidate file are stored in the database.

[0114] Optionally, based on the above embodiment, the embodiment of the present application may further provide a data search method, and the implementation process of the above method is illustrated below in conjunction with the accompanying drawings. Figure 4 A flowchart of a data search method provided by another embodiment of the present application is shown below. If the candidate file is an updateable file; Figure 4 As shown, before S103, the method may further include:

[0115] S108: According to the name index of the preset function field, the second field mapping relationship corresponding to the candidate file is adopted to determine the initial field corresponding to the name index.

[0116] The second field mapping relationship is a mapping relationship between a functional field and an initial field. In the second field mapping relationship, the type of the functional field is pre-declared as an alias of the initial field.

[0117] S109: According to the initial field, determine from the candidate file that the data content corresponding to the initial field is the data content corresponding to the preset function field.

[0118] The alias is equivalent to the nickname of the initial field. In the process of searching for problems, the alias can be used as a transfer station to first search for the functional field, and then map the functional field to the initial field through the second field mapping relationship, so that the field content in the initial field can be found. For example: still taking the initial field as "file name - file name" as an example, it means that the current initial field is named "file name" and the field content is "file name"; the second field mapping relationship is "title - "file name" - "file name", which means that if you need to search for the title at present, you can use the mapping relationship between the functional field "title" and the second field to map the search to the "file name" field that has a mapping relationship with the functional field, and then complete the search by obtaining the field content in the "file name" field.

[0119] For example, in one embodiment of the present application, the format of the declaration statement of the alias field (i.e., the functional field in the second field mapping relationship) can be, for example, {Title: {Type: Alias, Target: Entry Name}}, wherein the entry name can be, for example, content or file name. Taking the entry name as content as an example, after the content is updated, the title field of the document obtained according to the alias field will also be the updated content.

[0120] For example, in one embodiment of the present application, before acquiring each candidate file, it can be determined whether there is an update requirement for the content of the candidate file to be stored, and based on the determination result of the update requirement, it is determined whether the update type of the candidate file is an updateable file or a non-updateable file. If the candidate file to be stored is an updateable file, the second field mapping relationship corresponding to the candidate file is determined based on the update type of the candidate file; the second field mapping relationship and the candidate file are stored in the database.

[0121] pass Figure 3 and Figure 4 The provided method can move different fields in each candidate file to the same functional field, that is, the fields with similar functions in each candidate file are finally unified into the same functional field. In the same functional field, the weight of the same search keyword is the same, so these different fields from different data sources and with similar functions have the same weight after being unified into the same functional field.

[0122] For example, in one embodiment of the present application, before storing each candidate file in the database, fields with similar functions in each candidate file to be stored are finally unified into the same functional field by performing data preprocessing on each candidate file to be stored. For example:

[0123] If the current candidate file to be stored is a table in a table file, then after removing the format and image of the table, the fields of the table in the table file can be retained, for example, the fields may include: entry name field, background technology field, solution details field and subsequent processing field, and for each table, a mapping relationship between the preset function field and the initial field is established. Among them, the preset function field may include: title field and content field; for the table-like candidate file of the table file to be stored, the mapping relationship may include: the mapping relationship between the title field and the first initial field, and the mapping relationship between the content field and the second initial field, wherein the first initial field is the entry name field, and the second initial field includes: background technology field, solution details field and subsequent processing field and content field, etc., that is, the mapping relationship is: the mapping relationship between the entry name field and the title field, or the mapping relationship between the background technology field, solution details field and subsequent processing field and the content field.

[0124] If the current candidate file to be stored is a web page file, an intuitive initial field division can be made on the web page, such as the web page may include a title field, a media file field, a body field and a footer field, etc., and then a crawler is used to crawl the web page, and the content of each initial field is parsed according to the initial field. A mapping relationship between the preset function field and the initial field is established for the parsed content, and fields with similar functions are added to the same function field, wherein the preset function field may include: a title field and a content field; for candidate files of the web page type, the mapping relationship may include: a mapping relationship between the title field and the first initial field, and a mapping relationship between the content field and the second initial field, wherein the first initial field is the title field, and the second initial field includes: a media file field, a body field and a footer field, etc., that is, the content corresponding to the title field is mapped to the "title" function field, and the content in the body field and / or the footer field is mapped to the "content" function field, etc.

[0125] If the currently stored candidate file is a non-text file, for example, it can be a mind map file, a mapping relationship between preset function fields and initial fields is established for the content included in the mind map file, and fields with similar functions are uniformly added to the same function field, wherein the preset function fields may include, for example: title field, canvas field, author field, modification date field and node field, etc.; for candidate files of the mind map type, the mapping relationship may include: a mapping relationship between the file name of the mind map file and the function field "title", a mapping relationship between the canvas name of the mind map file and the function field "canvas", a mapping relationship between the creator of the mind map file and the function field "author", a mapping relationship between the last modification date of the mind map file and the function field "modification date", and a mapping relationship between each node of the mind map file and the function field "node".

[0126] Among them, due to the particularity of mind map nodes, a node usually does not contain a sentence, but some conceptual keywords or general words, such as "mall", "high-precision model", "low-precision model", "communication protocol", etc., which are extended from the concept of "skin". The closer the node is to the root, the smaller the probability that the content is a complete sentence. In order to avoid the dilution of these node contents by the "content" field that includes a large amount of space due to their short length, these node contents are stored separately as one or more fields, for example, the root node is called field 1; the nodes closest to the root node are called field 2; the set of child nodes closest to the nodes in field 2 is called field 3.

[0127] It should be understood that how to establish the above mapping relationship can be flexibly adjusted according to user needs, and the mapping relationship is not limited to the above embodiment. When mapping, it is also necessary to consider whether the field is an updateable field, and then map it according to the corresponding mapping relationship. The mapping methods corresponding to the updateable field and the non-updateable field are Figure 3 - Figure 4 The method provided will not be described in detail in this application.

[0128] By adopting the data search method provided by the present application, for all candidate files, after determining whether the content of each field in each candidate file is updateable content, the mapping between the initial field content and the functional field is implemented through the first field mapping relationship and the second field mapping relationship, so that in the process of searching for the search question, the field content can be directly obtained according to the functional field and the corresponding field mapping relationship, thereby unifying the format of the candidate files from different data sources, so that even if the types of candidate files are different or the data source formats are different, the weight of the same word in the same preset functional field of each candidate file can be guaranteed to remain unchanged, so that functional fields with similar functions in different data sources share scoring parameters for the same query keyword, thereby improving the accuracy of the search.

[0129] The following is an explanation of the data search device provided by the present application in conjunction with the accompanying drawings. The data search device can perform the above Figure 1-Figure 4 For any data search method, its specific implementation and beneficial effects are as mentioned above and will not be repeated below.

[0130] Figure 5 A schematic diagram of the structure of a data search device provided in an embodiment of the present application is shown in FIG. Figure 5 As shown, the device includes: a word segmentation module 201, an acquisition module 202, a calculation module 203 and a return module 204, wherein:

[0131] The word segmentation module 201 is used to segment the search sentence to obtain search keywords;

[0132] The acquisition module 202 is used to acquire at least one candidate file including the search keyword from the database according to the search keyword;

[0133] A calculation module 203, used to calculate the score of the candidate file according to the data content corresponding to the preset function field in the candidate file;

[0134] The return module 204 is used to return the search result corresponding to the search statement to the client according to the score of at least one candidate file.

[0135] Optionally, the calculation module 203 is specifically configured to calculate a content score of the candidate file according to the data content corresponding to each functional field in the candidate file; and calculate a score of the candidate file according to multiple content scores of the candidate file.

[0136] Figure 6 A schematic diagram of the structure of a data search device provided in an embodiment of the present application is shown in FIG. Figure 6 As shown, the device also includes: a determination module 205, wherein:

[0137] The acquisition module 202 is specifically used to acquire the length of the data content corresponding to each function field and the average length of the data content corresponding to all function fields in the candidate file;

[0138] The determination module 205 is used to determine the occurrence frequency of the search keyword in the content corresponding to each function field according to the search keyword and the data content corresponding to each function field; and determine the weight of the search keyword according to the frequency of the search keyword in at least one candidate file;

[0139] The calculation module 203 is specifically used to calculate a content score of the candidate file according to the data content length, average length, number of occurrences and weight of the search keyword corresponding to each function field.

[0140] Optionally, the determination module 205 is specifically used to determine, based on the name index of the preset functional field, the first field mapping relationship corresponding to the candidate file, and to determine from the candidate file that the data content of the initial field is the data content corresponding to the preset functional field; the first field mapping relationship is: the mapping relationship between the data content of the functional field and the initial field.

[0141] Optionally, the determination module 205 is specifically used to determine the initial field corresponding to the name index based on the name index of the preset functional field and using the second field mapping relationship corresponding to the candidate file, wherein the second field mapping relationship is: a mapping relationship between the functional field and the initial field, and in the second field mapping relationship, the type of the functional field is pre-declared as: an alias of the initial field; based on the initial field, determine from the candidate file that the data content corresponding to the initial field is the data content corresponding to the preset functional field.

[0142] like Figure 6 As shown, the device also includes: a storage module 206, wherein:

[0143] The determination module 205 is specifically used to determine the first field mapping relationship corresponding to the candidate file;

[0144] The storage module 206 is used to store the first field mapping relationship and the candidate file in a database.

[0145] Optionally, the determination module 205 is specifically configured to determine a second field mapping relationship corresponding to the candidate file;

[0146] The storage module 206 is specifically configured to store the second field mapping relationship and the candidate file in a database.

[0147] The above-mentioned device is used to execute the method provided by the aforementioned embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0148] The above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more digital singnal processors (DSP), or one or more field programmable gate arrays (FPGA). For another example, when a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0149] Figure 7 This is a schematic diagram of the structure of a data search device provided in one embodiment of the present application. The data search device can be integrated into a retrieval server or a query server.

[0150] The data search device includes: a processor 501 , a storage medium 502 and a bus 503 .

[0151] The processor 501 is used to store programs. The processor 501 calls the program stored in the storage medium 502 to execute the above Figure 1 - Figure 4 The corresponding method embodiment has similar specific implementation methods and technical effects, which will not be described here.

[0152] Optionally, the present application also provides a program product, such as a storage medium, on which a computer program is stored, including a program that, when executed by a processor, executes an embodiment corresponding to the above method.

[0153] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0154] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0155] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0156] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit 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.) or a processor (English: processor) to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviated: ROM), random access memory (English: Random Access Memory, abbreviated: RAM), disk or optical disk and other media that can store program codes.

Claims

1. A data search method, characterized in that: The method comprises: Segment the search statement to obtain the search keywords; According to the search keyword, obtaining at least one candidate file including the search keyword from a database, wherein the candidate file includes a preset function field, and the weight of the same word in the same preset function field of each candidate file remains unchanged; Calculate the score of the candidate file according to the data content corresponding to the preset function field in the candidate file; Returning search results corresponding to the search statement to the client according to the score of at least one of the candidate files; The preset function field includes: a plurality of function fields, and the calculating the score of the candidate file according to the data content corresponding to the preset function field in the candidate file includes: Calculating a content score of the candidate file according to the data content corresponding to each function field in the candidate file, wherein the content score of the candidate file is used to represent the relevance between the data content corresponding to a function field in the candidate file and the search keyword; The score of the candidate file is calculated according to the multiple content scores of the candidate file.

2. The method according to claim 1, characterized in that Calculating a content score of the candidate file according to the data content corresponding to each function field in the candidate file includes: Obtaining the data content length corresponding to each function field and the average length of the data content corresponding to all function fields in the candidate file; Determine, according to the search keyword and the data content corresponding to each function field, the frequency of occurrence of the search keyword in the content corresponding to each function field; Determining a weight of the search keyword according to a frequency of the search keyword in the at least one candidate file; A content score of the candidate file is calculated according to the data content length corresponding to each function field, the average length, the occurrence frequency and the weight of the search keyword.

3. The method according to claim 1, characterized in that The candidate file is a non-updatable file; before calculating the score of the candidate file according to the data content corresponding to the preset function field in the candidate file, the method further includes: According to the name index of the preset functional field, the first field mapping relationship corresponding to the candidate file is adopted to determine from the candidate file that the data content of the initial field is the data content corresponding to the preset functional field; the first field mapping relationship is: a mapping relationship between the data content of the functional field and the initial field.

4. The method according to claim 1, characterized in that The candidate file is an updateable file. Before calculating the score of the candidate file according to the data content corresponding to the preset function field in the candidate file, the method further includes: According to the name index of the preset function field, the initial field corresponding to the name index is determined by using the second field mapping relationship corresponding to the candidate file, wherein the second field mapping relationship is: a mapping relationship between a function field and an initial field, and in the second field mapping relationship, the type of the function field is pre-declared as: an alias of the initial field; According to the initial field, the data content corresponding to the initial field is determined from the candidate file as the data content corresponding to the preset function field.

5. The method according to claim 3, characterized in that Before acquiring at least one candidate file including the search keyword from a database according to the search keyword, the method further includes: Determine the first field mapping relationship corresponding to the candidate file; The first field mapping relationship and the candidate file are stored in the database.

6. The method according to claim 4, characterized in that Before acquiring at least one candidate file including the search keyword from a database according to the search keyword, the method further includes: Determine the second field mapping relationship corresponding to the candidate file; The second field mapping relationship and the candidate file are stored in the database.

7. The method according to any one of claims 1 to 6, characterized in that: The candidate file is: a table in a table file, and the multiple functional fields include: a title field and a content field; The data content corresponding to the title field includes: the data content of the entry name in the table; The data content corresponding to the content field includes: the data content of other fields in the table except the entry name.

8. The method according to any one of claims 1 to 6, characterized in that: The candidate file is: a web page file, and the multiple functional fields include: a title field and a content field; The data content corresponding to the title field includes: the data content of the title field in the web page file; The data content corresponding to the content field includes: the data content of the body field in the web page file.

9. The method according to any one of claims 1 to 6, characterized in that: The candidate file is: a non-text file, and the multiple functional fields include: a title field and a content field; Wherein, the data content corresponding to the title field includes: the data content of the file name field in the non-text file; The data content corresponding to the content field includes: the data content of the node content field in the non-text file.

10. The method according to claim 9, characterized in that The multiple function fields also include: canvas field, author field, modification date field, node field; The data content corresponding to the canvas field includes: the data content of the canvas name field in the non-text file; The data content corresponding to the author field includes: the data content of the creator field in the non-text file; The data content corresponding to the modification date field includes: the data content of the last modification date field in the non-text file; The data content corresponding to the node field includes: the data content of the node segment in the non-text file.

11. A data search device, characterized in that: The device comprises: a word segmentation module, an acquisition module, a calculation module and a return module, wherein: The word segmentation module is used to segment the search sentence to obtain the search keywords; The acquisition module is used to acquire at least one candidate file including the search keyword from a database according to the search keyword, wherein the candidate file includes a preset function field, and the weight of the same word in the same preset function field of each candidate file remains unchanged; The calculation module is used to calculate the score of the candidate file according to the data content corresponding to the preset function field in the candidate file; The returning module is used to return the search result corresponding to the search statement to the client according to the score of at least one of the candidate files; The calculation module is specifically used to calculate a content score of the candidate file according to the data content corresponding to each functional field in the candidate file, wherein the content score of the candidate file is used to characterize the relevance between the data content corresponding to a functional field in the candidate file and the search keyword; and calculate the score of the candidate file according to multiple content scores of the candidate file.

12. A data search device, characterized in that: The device includes: a processor, a storage medium and a bus, the storage medium stores machine-readable instructions executable by the processor, when the data search device is running, the processor and the storage medium communicate through the bus, and the processor executes the machine-readable instructions to execute the method described in any one of claims 1 to 10.

13. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 10 is executed.

Citation Information

Patent Citations

  • Academic paper search sorting method based on document scoring model and relevancy

    CN107229738A

  • Seat taking query method and device, and server

    CN108664509A