Method and system for querying synonyms based on database ES

By building a synonym database and combining it with the Elasticsearch search engine, the problem of traditional search engines being difficult to process synonym queries is solved, more accurate and comprehensive query results are achieved, user experience is improved and maintenance costs are reduced.

CN119336789AInactive Publication Date: 2025-01-21INSPUR ZHUOSHU BIG DATA IND DEV CO LTD

Patent Information

Application Number
CN202411312486.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-20
Publication Date
2025-01-21
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Traditional search engines find it difficult to effectively handle synonym queries, resulting in inaccurate and comprehensive query results, affecting user experience.

Method used

By constructing the database of homework, record the mapping relationship and associated weight between synonyms, and combine the Elasticsearch search engine to achieve the extension and sorting of synonyms for user query words, and finally improve the accuracy and correlation of the query results.

Benefits of technology

It improves the accuracy of query results and user experience, can cover more relevant documents, reduces maintenance costs, and has good scalability and versatility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119336789A_ABST
    Figure CN119336789A_ABST
Patent Text Reader

Abstract

The invention discloses a method and a system for querying synonyms based on a database ES, belongs to the technical field of databases, and aims to solve the technical problem of how to realize efficient synonym query in a search engine and improve the accuracy of a query result and user experience. Comprising the following steps: constructing a synonym database comprising a mapping relationship between synonyms and associated weights; taking a query word input by a user as an original query word, analyzing the original query word to obtain a keyword, searching synonyms from the synonym database based on the keyword, and sorting the searched synonyms based on the association weight to form a synonym list; taking the original query word and the corresponding synonym list as query conditions, performing query through an Elasticsearch search engine, matching and sequencing the documents in the index based on the query conditions, and returning related documents; and displaying the related document.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of database technology, and in particular to a method and system for querying synonyms based on a database ES. Background Art

[0002] With the rapid development of information technology, search engines have become an important tool for users to obtain online information. However, due to the diversity and complexity of languages, users may use different words to express the same or similar intentions when searching, such as synonyms, antonyms, abbreviations, etc. Traditional search engines can usually only accurately match the query terms entered by users and cannot effectively process synonym queries, resulting in inaccurate and incomplete query results, which affects user experience.

[0003] How to implement efficient synonym query in search engines and improve the accuracy of query results and user experience is a technical problem that needs to be solved. Summary of the invention

[0004] The technical task of the present invention is to address the above shortcomings and provide a method and system for querying synonyms based on the database ES to solve the technical problem of how to achieve efficient synonym query in the search engine, improve the accuracy of query results and user experience.

[0005] In a first aspect, the present invention provides a method for querying synonyms based on a database ES, comprising the following steps:

[0006] Synonym database construction: Build a synonym database including the mapping relationship between synonyms and the association weights. The association weights are used to reflect the association between different synonyms.

[0007] Synonym query: The user enters a query word through the search engine interface. The query word entered by the user is used as the original query word. The original query word is parsed to obtain keywords. Synonyms are searched from the synonym database based on the keywords. The found synonyms are sorted based on the association weights to form a synonym list.

[0008] ES query: Use the original query word and the corresponding synonym list as query conditions, query through the Elasticsearch search engine, match and sort the documents in the index based on the query conditions, and return relevant documents that meet the query conditions as query results;

[0009] Result display: Display the relevant documents returned by Elasticsearch.

[0010] Preferably, the relevant documents returned by Elasticsearch are sorted based on the relevance between the relevant documents and the original query term to form a document list, and the document list is displayed.

[0011] Preferably, the association weight is calculated based on the semantic similarity and usage frequency between synonyms as factors.

[0012] Preferably, after displaying the relevant documents returned by Elasticsearch, the synonym database is updated and optimized based on user feedback and the quality of the query results.

[0013] In a second aspect, the present invention provides a system for querying synonyms based on a database ES, which is used to implement synonym query by using a method for querying synonyms based on a database ES as described in any one of the first aspects, wherein the system includes a synonym database construction module, a synonym query module, an ES query module, and a result display module;

[0014] The synonym database construction module is used to perform the following: construct a synonym database including mapping relationships between synonyms and association weights, where the association weights are used to reflect the association between different synonyms;

[0015] The synonym query module is used to perform the following: a user inputs a query word through the search engine interface, takes the query word input by the user as the original query word, parses the original query word to obtain a keyword, searches for synonyms in the synonym database based on the keyword, and sorts the found synonyms based on the association weight to form a synonym list;

[0016] The ES query module is used to perform the following: query the original query term and the corresponding synonym list as query conditions through the Elasticsearch search engine, match and sort the documents in the index based on the query conditions through Elasticsearch, and return relevant documents that meet the query conditions as query results;

[0017] The result display module is used to perform the following operations: Display the relevant documents returned by Elasticsearch.

[0018] Preferably, for the relevant documents returned by Elasticsearch, the result display module is used to sort the relevant documents based on the relevance between the relevant documents and the original query term to form a document list, and then display the document list.

[0019] Preferably, the association weight is calculated based on the semantic similarity and usage frequency between synonyms as factors.

[0020] Preferably, after displaying the relevant documents returned by Elasticsearch, the synonym database construction module is used to update and optimize the synonym database based on user feedback and the quality of the query results.

[0021] The method and system for querying synonyms based on database ES of the present invention have the following advantages:

[0022] 1. Improve query accuracy: Synonym expansion of query terms through the synonym database can cover more relevant documents and improve the accuracy of query results;

[0023] 2. Improve user experience: Displaying related documents containing synonyms can provide users with richer and more comprehensive information and improve user experience;

[0024] 3. Reduce maintenance costs: The synonym database can be updated dynamically, reducing the workload of manually maintaining the synonym dictionary and reducing maintenance costs;

[0025] 4. Strong scalability: It can be integrated with other search engines and databases, and has good scalability and versatility. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, 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 invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0027] The present invention is further described below in conjunction with the accompanying drawings.

[0028] Figure 1 This is a flowchart of a method for querying synonyms based on the database ES in Example 1;

[0029] Figure 2 This is a schematic diagram of the result of a synonym table in a synonym database in a method for querying synonyms based on a database ES in Example 1;

[0030] Figure 3 This is an example diagram of synonym query in a method for querying synonyms based on a database ES in Example 1. DETAILED DESCRIPTION

[0031] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it. However, the embodiments are not intended to limit the present invention. In the absence of conflict, the embodiments of the present invention and the technical features in the embodiments may be combined with each other.

[0032] The embodiment of the present invention provides a method and system for querying synonyms based on a database ES, which is used to solve the technical problem of how to implement efficient synonym query in a search engine, improve the accuracy of query results and user experience.

[0033] Embodiment 1:

[0034] The present invention discloses a method for querying synonyms based on a database ES, comprising four steps: synonym database construction, synonym query, ES query and result display.

[0035] Step S100: Constructing a synonym database: constructing a synonym database including mapping relationships between synonyms and associated weights, where the associated weights are used to reflect the associations between different synonyms.

[0036] In this embodiment, a synonym database including mapping relationships between synonyms and associated weights is constructed. The database can obtain synonyms and their associated weights by crawling Internet resources, collecting user feedback, etc. The associated weights are calculated based on factors such as semantic similarity and usage frequency between synonyms. The structure of the synonym table is as follows: Figure 2 As shown, it includes field name, field type, field length, and field comment.

[0037] Step S200 synonym query: the user inputs a query word through the search engine interface, the query word input by the user is used as the original query word, the original query word is parsed to obtain a keyword, synonyms are searched from the synonym database based on the keyword, and the found synonyms are sorted based on the associated weight to form a synonym list.

[0038] In this embodiment, the user inputs a query word through the search engine interface, and the search engine plug-in IK parses the query word input by the user to extract keywords. Then, synonyms are searched in the synonym database according to the keywords, and the synonyms are sorted according to the association weights.

[0039] Among them, when searching for synonyms in the synonym database based on keywords, if the original query term is a word, synonyms are searched from the synonym database based on the synonym mapping relationship; if the original query term is a phrase composed of multiple words, synonyms can be searched from the synonym database based on the overall semantics of the phrase and the synonym mapping relationship. For query phrases composed of multiple words, the overall semantics of the phrase must also be considered to ensure the accuracy of the synonym mapping.

[0040] Step S300ES query: Use the original query word and the corresponding synonym list as query conditions, query through the Elasticsearch search engine, match and sort the documents in the index based on the query conditions, and return relevant documents that meet the query conditions as query results.

[0041] In this embodiment, the original query word and its synonym list are used as query conditions and sent to the Elasticsearch search engine for query. Elasticsearch matches and sorts the documents in the index according to the query conditions and returns relevant documents that meet the conditions. Figure 3 .

[0042] Step S400: Result display: display the relevant documents returned by Elasticsearch.

[0043] In step S400 of this embodiment, the results returned by Elasticsearch are sorted according to relevance and displayed to the user.

[0044] As an improvement to this embodiment, the synonym database is updated and optimized based on user feedback and the quality of query results to improve the accuracy and efficiency of subsequent queries.

[0045] The method of this embodiment achieves synonym expansion for user query terms by building a synonym database and integrating the Elasticsearch search engine, thereby improving the accuracy and relevance of query results and thus enhancing user experience.

[0046] Embodiment 2:

[0047] The present invention discloses a system for querying synonyms based on a database ES, comprising a synonym database construction module, a synonym query module, an ES query module and a result display module.

[0048] The synonym database construction module is used to perform the following: construct a synonym database including mapping relationships between synonyms and associated weights, and the associated weights are used to reflect the association between different synonyms.

[0049] In this embodiment, a synonym database including mapping relationships between synonyms and associated weights is constructed. The database can obtain synonyms and their associated weights by crawling Internet resources, collecting user feedback, and other methods. The associated weights are calculated based on factors such as semantic similarity and usage frequency between synonyms. Among them, the structure of the synonym table includes field name, field type, field length, and field annotation.

[0050] The synonym query module is used to perform the following: the user inputs a query word through the search engine interface, the query word input by the user is used as the original query word, the original query word is parsed to obtain a keyword, synonyms are searched from the synonym database based on the keyword, and the found synonyms are sorted based on the associated weight to form a synonym list.

[0051] In this embodiment, the user inputs a query word through the search engine interface, and the search engine plug-in IK parses the query word input by the user to extract keywords. Then, synonyms are searched in the synonym database according to the keywords, and the synonyms are sorted according to the association weights.

[0052] Among them, when searching for synonyms in the synonym database based on keywords, if the original query term is a single word, the synonym query module is used to search for synonyms from the synonym database based on the synonym mapping relationship; if the original query term is a phrase composed of multiple words, the synonym query module is used to search for synonyms from the synonym database based on the overall semantics of the phrase and the synonym mapping relationship. For query phrases composed of multiple words, the overall semantics of the phrase must also be considered to ensure the accuracy of the synonym mapping.

[0053] The ES query module is used to perform the following: query the original query term and the corresponding synonym list as query conditions, query through the Elasticsearch search engine, match and sort the documents in the index based on the query conditions, and return relevant documents that meet the query conditions as query results.

[0054] In this embodiment, the original query word and its synonym list are used as query conditions and sent to the Elasticsearch search engine for query. Elasticsearch matches and sorts the documents in the index according to the query conditions and returns relevant documents that meet the conditions. Figure 3 .

[0055] The result display module is used to perform the following operations: Display the relevant documents returned by Elasticsearch.

[0056] The result display module of this embodiment is used to sort the results returned by Elasticsearch according to relevance and display them to the user.

[0057] As an improvement of this embodiment, the synonym database construction module is used to update and optimize the synonym database according to user feedback and the quality of query results, so as to improve the accuracy and efficiency of subsequent queries.

[0058] The system of this embodiment can execute the method disclosed in Example 1 to implement synonym query.

[0059] The present invention has been shown and described in detail above through the accompanying drawings and preferred embodiments. However, the present invention is not limited to these disclosed embodiments. Based on the above multiple embodiments, those skilled in the art can know that the means in the above different embodiments can be combined to obtain more embodiments of the present invention, and these embodiments are also within the protection scope of the present invention.

Claims

1. A method for querying synonyms based on database ES, characterized in that: The steps include: Synonym database construction: Build a synonym database including the mapping relationship between synonyms and the association weights. The association weights are used to reflect the association between different synonyms. Synonym query: The user enters a query word through the search engine interface. The query word entered by the user is used as the original query word. The original query word is parsed to obtain keywords. Synonyms are searched from the synonym database based on the keywords. The found synonyms are sorted based on the association weights to form a synonym list. ES query: Use the original query word and the corresponding synonym list as query conditions, query through the Elasticsearch search engine, match and sort the documents in the index based on the query conditions, and return relevant documents that meet the query conditions as query results; Result display: Display the relevant documents returned by Elasticsearch.

2. The method for querying synonyms based on database ES according to claim 1 is characterized in that: For the relevant documents returned by Elasticsearch, they are sorted based on their relevance to the original query terms to form a document list, and the document list is displayed.

3. The method for querying synonyms based on database ES according to claim 1 is characterized in that: The association weight is calculated based on the semantic similarity and usage frequency between synonyms.

4. The method for querying synonyms based on database ES according to claim 1 is characterized in that: After displaying the relevant documents returned by Elasticsearch, the synonym database is updated and optimized based on user feedback and the quality of the query results.

5. A system for querying synonyms based on the ES database, characterized in that: Used to implement synonym query by a method for querying synonyms based on a database ES as described in any one of claims 1 to 4, the system comprising a synonym database construction module, a synonym query module, an ES query module and a result display module; The synonym database construction module is used to perform the following: construct a synonym database including mapping relationships between synonyms and association weights, where the association weights are used to reflect the association between different synonyms; The synonym query module is used to perform the following: a user inputs a query word through the search engine interface, takes the query word input by the user as the original query word, parses the original query word to obtain a keyword, searches for synonyms in the synonym database based on the keyword, and sorts the found synonyms based on the association weight to form a synonym list; The ES query module is used to perform the following: query the original query term and the corresponding synonym list as query conditions through the Elasticsearch search engine, match and sort the documents in the index based on the query conditions through Elasticsearch, and return relevant documents that meet the query conditions as query results; The result display module is used to perform the following operations: Display the relevant documents returned by Elasticsearch.

6. A system for querying synonyms based on database ES according to claim 5, characterized in that: For the relevant documents returned by Elasticsearch, the result display module is used to sort the relevant documents based on the relevance between them and the original query term to form a document list, and then display the document list.

7. A system for querying synonyms based on database ES according to claim 5, characterized in that: The association weight is calculated based on the semantic similarity and usage frequency between synonyms.

8. The system for querying synonyms based on database ES according to claim 5, characterized in that: After displaying the relevant documents returned by Elasticsearch, the synonym database construction module is used to update and optimize the synonym database based on user feedback and the quality of query results.

Citation Information

Patent Citations

  • Full text retrieval system based on natural language

    CN101246492A

  • Text data query method and apparatus

    CN108427686A

  • Intelligent patent similarity searching method and device based on semantic retrieval

    CN113821646A

  • Electronic archive retrieval method and system based on large language model

    CN118643148A

Cited By

  • A method and system for storage and retrieval of knowledge representation data structures

    CN122633833A