Full-text search method, system, electronic device and storage medium
By establishing field indexes in full-text searches and generating DSL query indexes, the problem of the inability to accurately locate user intent in existing technologies is solved, fast and efficient information recall is achieved, and the accuracy and relevance of searches are improved.
Patent Information
- Application Number
- CN202110500852.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-08
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2041-05-08
AI Technical Summary
In the existing technology, full-text search cannot quickly, efficiently, and accurately locate information that is strongly relevant to the user's search intention, resulting in inaccurate sorting of related documents.
By establishing a full-text index, extracting the field information that needs to be retrieved from the document, and dividing it into field indexes of different dimensions, specifying keywords for each field, and generating DSL query indexes for combination, relevant documents can be quickly and accurately recalled.
It improves the accuracy and recall of unstructured data retrieval, enhances the ability to express user intent, and ensures that the recalled documents are more relevant to user needs.
Smart Images

Figure CN113127596B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of retrieval technology, and in particular to a full-text retrieval method, system, electronic device and storage medium. Background Art
[0002] In most existing technologies, there is usually only one entry for searching keywords. To search for a keyword, the usual practice is to match each field involved in the search in the index with the keyword. As long as one field of a document is successfully matched, it is considered a hit. The degree of match of all fields involved in the search is comprehensively summarized for relevance sorting. Although this can recall relevant documents, this method usually cannot express the user's precise search intention for a specific field, especially multiple fields, and different keywords for each field, resulting in the documents that are strongly related to the user's intention being ranked at the back. For example, the user's intention is to search for books whose author is Zhang San and published on 2021-01-01. If the traditional search method is used and "Zhang San 2021-01-01" is entered, the document titled "Zhang San 2021-01-01 Becomes Rich Overnight" is likely to be ranked higher, while the book whose author is Zhang San and published on 2021-01-01 is likely to be ranked lower. Therefore, it is impossible to quickly, efficiently and accurately locate and obtain information that is highly relevant to the customer's search intention through existing technologies. Summary of the Invention
[0003] The embodiments of the present application provide a full-text search method, system, electronic device and storage medium, which at least solve the problem of being unable to quickly, efficiently and accurately locate information that is strongly relevant to the customer's search intention during the full-text search process through the present invention.
[0004] The present invention provides a full-text retrieval method, comprising:
[0005] Index creation step: creating a full-text index and writing the field information involved in the retrieval into the full-text index;
[0006] Retrieval parameter construction step: constructing the retrieval parameters and abstracting the keywords of the field information to generate a DSL interface class;
[0007] Query index acquisition step: calling a DSL abstract method to obtain a DSL query index, combining the DSL query indexes to obtain a complete DSL query index;
[0008] Retrieval step: Search through the complete DSL query index to recall relevant documents.
[0009] In the above-mentioned full-text search method, the index establishment step includes, after establishing the full-text index, extracting the field information to be retrieved from each document involved in the retrieval, and writing each field information into the full-text index.
[0010] In the above-mentioned full-text search method, the search parameter construction step includes constructing the search parameter, abstracting the DSL interface class generated by the keyword corresponding to the single field information, and then realizing the DSL interface class according to different field information.
[0011] In the above-mentioned full-text search method, the query index acquisition step includes:
[0012] Selection step: selecting the DSL interface class suitable for each kv pair according to the key of the search parameter;
[0013] Generating step: after calling genDSL to generate the DSL query index of the kv pair, all the DSL query indexes are combined using an and relationship to generate the complete DSL query index.
[0014] The present invention also provides a full-text search system, which is applicable to the full-text search method described above, and the full-text search system includes:
[0015] Index building unit: builds a full-text index and writes the field information involved in the retrieval into the full-text index;
[0016] Retrieval parameter construction unit: constructs retrieval parameters and abstracts the keywords of the field information to generate DSL interface classes;
[0017] Query index acquisition unit: calls the DSL abstract method to obtain a DSL query index, combines the DSL query indexes, and obtains a complete DSL query index;
[0018] Retrieval unit: searches through the complete DSL query index to recall relevant documents.
[0019] The above-mentioned full-text search system, after the full-text index is established by the index establishment unit, extracts the field information to be retrieved from each document involved in the retrieval, and writes each field information into the full-text index.
[0020] The full-text search system constructs the search parameter through the search parameter construction unit, and after abstracting the DSL interface class generated by the keyword corresponding to the single field information, implements the DSL interface class according to different field information.
[0021] In the above-mentioned full-text retrieval system, the query index acquisition unit includes:
[0022] Selection module: selects the DSL interface class suitable for each kv pair according to the key of the search parameter;
[0023] Generating module: after calling genDSL to generate the DSL query index of the kv pair, all the DSL query indexes are combined using the relationship of and to generate the complete DSL query index.
[0024] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the above-described full-text retrieval methods when executing the computer program.
[0025] The present invention also provides an electronic device readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by the processor, any of the above-mentioned full-text retrieval methods is implemented.
[0026] Compared with related technologies, the present invention divides document-related information of different dimensions that need to be retrieved into different fields for indexing through a search engine, and specifies different keywords for each field involved in the retrieval, so as to quickly and accurately recall documents that are strongly related to user intentions, enhance the expression ability of unstructured data retrieval intentions, and improve the accuracy of recalled data and query optimization capabilities.
[0027] The details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0029] Figure 1 is a flow chart of a full-text search method according to an embodiment of the present application;
[0030] Figure 2 Schematic diagram of the structure of the full-text retrieval system of the present invention;
[0031] Figure 3 It is a framework diagram of an electronic device according to an embodiment of the present application.
[0032] Wherein, the accompanying drawings are marked as follows:
[0033] Index building unit: 51;
[0034] Retrieval parameter construction unit: 52;
[0035] Query index acquisition unit: 53;
[0036] Retrieval unit: 54;
[0037] Select module: 531;
[0038] Generate module: 532;
[0039] bus:80;
[0040] Processor: 81;
[0041] Memory: 82;
[0042] Communication interface:83. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solutions and advantages of this application more clearly understood, the present application is described and illustrated below in conjunction with the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely used to explain this application and are not intended to limit this application. Based on the embodiments provided in this application, all other embodiments obtained by those of ordinary skill in the art without making any creative efforts are within the scope of protection of this application.
[0044] Obviously, the drawings described below are merely examples or embodiments of the present application. Those skilled in the art can apply the present application to other similar scenarios based on these drawings without inventive effort. Furthermore, it is also understood that, although the effort involved in such a development process may be complex and lengthy, for those skilled in the art related to the disclosure of the present application, changes in design, manufacturing, or production based on the technical content disclosed in the present application are merely conventional technical means and should not be construed as an insufficiency of the disclosure of the present application.
[0045] References to "embodiments" in this application mean that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it refer to independent or alternative embodiments that are mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described in this application may be combined with other embodiments unless there is a conflict.
[0046] Unless otherwise defined, technical or scientific terms used herein shall have the ordinary meaning as understood by persons of ordinary skill in the art to which this application belongs. The terms "a," "an," "an," "the," and similar expressions used herein do not denote quantitative limitations and may refer to either the singular or the plural. The terms "comprise," "include," "have," and any variations thereof, used herein, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or modules (units) is not limited to the listed steps or units but may also include steps or units not listed, or may include other steps or units inherent to the process, method, product, or apparatus. The terms "connected," "connected," "coupled," and similar expressions used herein are not limited to physical or mechanical connections but may include electrical connections, whether direct or indirect. As used herein, "plurality" means two or more. "And / or" describes an association between associated objects, indicating that three possible relationships exist. For example, "A and / or B" may mean: A exists alone; A and B exist simultaneously; or B exists alone. The character " / " generally indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific order for the objects.
[0047] A search engine is a system that uses specific computer programs to collect information from the internet based on specific strategies. After organizing and processing this information, it provides search services and displays relevant information to users. Search engines include full-text indexes, directory indexes, metasearch engines, vertical search engines, collection search engines, portal search engines, and free link lists. A search engine consists of four components: a search engine, an indexer, a crawler, and a user interface. Search engines use software that follows specific patterns to track links on web pages, crawling from one link to another, much like a spider on a web. Hence, they are called "spiders" or "robots." Search engine spiders are programmed with specific rules for their crawling, requiring them to follow commands or file contents. Search engines crawl web pages by following links and storing the crawled data in a database of original pages. This data is identical to the HTML displayed by the user's browser. Search engine spiders also perform duplicate content checks when crawling pages. If they encounter a low-ranking website with a large amount of plagiarized, scraped, or duplicated content, they will likely stop crawling. Search engines perform various pre-processing steps on pages retrieved by their spiders. After a user enters a keyword in the search box, the ranking program accesses the indexed data, calculates the ranking, and displays it to the user. This ranking process is directly interactive with the user. However, due to the vast amount of data stored in search engines, while small updates can be made daily, search engine ranking rules are generally updated on a daily, weekly, or monthly basis. The search engine's function is to roam the internet, discovering and collecting information. The indexer's function is to understand the information being searched, extract index terms from it, use them to represent documents, and generate index tables for the document library. The retriever's function is to quickly retrieve documents from the index based on the user's query, evaluate their relevance to the query, sort the output results, and implement some form of user relevance feedback. The user interface is responsible for entering user queries, displaying query results, and providing user relevance feedback. Search engines are essential features of website development to ensure user convenience and are also an effective tool for studying website user behavior. Efficient on-site search allows users to quickly and accurately find targeted information, thereby more effectively promoting product / service sales. Furthermore, in-depth analysis of website visitor search behavior is crucial for developing more effective online marketing strategies. From the perspective of online marketing, the development of search engine marketing plays a crucial role in promoting online marketing. From the perspective of performance marketing, many companies are able to apply online marketing due to the use of search engine marketing. As for the components of a complete e-commerce concept, online marketing is the most important element and a crucial step in delivering information to end customers.
[0048] The present invention provides a full-text retrieval method, system, electronic device and storage medium. By using a search engine, document-related information of different dimensions that needs to be retrieved is divided into different fields for indexing. The specific fields can be flexibly customized according to business needs. The user specifies keywords for each field to be retrieved to accurately recall documents that meet the user's intentions.
[0049] The present invention will be described below with reference to specific embodiments.
[0050] Example 1
[0051] This embodiment provides a full-text search method. Please refer to Figure 1 , Figure 1 : is a flow chart of a full-text search method according to an embodiment of the present application. As shown in the figure, the full-text search method includes the following steps:
[0052] Index establishment step S1: establishing a full-text index, and writing the field information involved in the retrieval into the full-text index;
[0053] Retrieval parameter construction step S2: constructing retrieval parameters and abstracting the keywords of the field information to generate a DSL interface class;
[0054] Query index acquisition step S3: calling a DSL abstract method to obtain a DSL query index, combining the DSL query indexes to obtain a complete DSL query index;
[0055] Retrieval step S4: Searching through the complete DSL query index to recall relevant documents.
[0056] In the embodiment, the index establishment step S1 includes, after establishing the full-text index, extracting the field information to be retrieved from each document involved in the retrieval, and writing each field information into the full-text index.
[0057] In practice, after establishing the full-text index, a batch of documents is given. For each document, all fields required for retrieval are extracted using techniques such as NLP. All field information for each document is then written to the index. In the full-text index, each document corresponds to the entire content of that document. Field names and types in the mapping can be customized based on different application scenarios.
[0058] In an embodiment, the search parameter construction step S2 includes constructing the search parameter, abstracting the DSL interface class generated by the keyword corresponding to a single field information, and then implementing the DSL interface class according to different field information.
[0059] In the specific implementation, the search parameters are constructed to form a Map<String, String> The structure is as follows: key is the field name, value is the field value, and an interface class for generating DSL for a single field keyword is abstracted, denoted as FieldKeywordDSL. After defining an abstract method for generating DSL, denoted as DSL genDsl(String keyword), the DSL interface class is implemented according to different field information.
[0060] In an embodiment, the query index obtaining step S3 includes:
[0061] Selection step S31: selecting the DSL interface class suitable for each kv pair according to the key of the search parameter;
[0062] Generating step S32: after calling genDSL to generate the DSL query index of the kv pair, all the DSL query indexes are combined using an and relationship to generate the complete DSL query index.
[0063] The specific implementation takes elasticsearch as a search engine as an example and gives a retrieval example diagram.
[0064]
[0065] Example 2
[0066] Please refer to Figure 2 , Figure 2 FIG. 1 is a schematic diagram of the structure of the full-text search system of the present invention. Figure 2 As shown, the full-text retrieval system of the invention is applicable to the above-mentioned full-text retrieval method, and the full-text retrieval system includes:
[0067] Index building unit 51: builds a full-text index and writes the field information involved in the retrieval into the full-text index;
[0068] Retrieval parameter construction unit 52: constructs retrieval parameters and abstracts the keywords of the field information to generate a DSL interface class;
[0069] The query index obtaining unit 53 calls a DSL abstract method to obtain a DSL query index, and combines the DSL query indexes to obtain a complete DSL query index.
[0070] Retrieval unit 54: performs retrieval through the complete DSL query index to retrieve relevant documents.
[0071] In this embodiment, after the full-text index is created by the index creation unit 51, the field information required to be retrieved from each document involved in the retrieval is extracted, and each field information is written into the full-text index.
[0072] In this embodiment, the search parameter construction unit 52 constructs the search parameter, and after abstracting the keyword corresponding to a single field information to generate the DSL interface class, the DSL interface class is implemented according to different field information.
[0073] In this embodiment, the query index obtaining unit 53 includes:
[0074] Selection module 531: selects the DSL interface class suitable for each kv pair according to the key of the search parameter;
[0075] Generating module 532: after calling genDSL to generate the DSL query index of the kv pair, all the DSL query indexes are combined using the relationship of and to generate the complete DSL query index.
[0076] Example 3
[0077] Combine Figure 3 As shown, this embodiment discloses a specific implementation of an electronic device. The electronic device may include a processor 81 and a memory 82 storing computer program instructions.
[0078] Specifically, the processor 81 may include a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0079] The memory 82 may include a large-capacity memory for data or instructions. By way of example, and not limitation, the memory 82 may include a hard disk drive (HDD), a floppy disk drive, a solid-state drive (SSD), a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 82 may include removable or non-removable (or fixed) media. Where appropriate, the memory 82 may be internal or external to the full-text search device. In certain embodiments, the memory 82 is a non-volatile memory. In certain embodiments, the memory 82 includes a read-only memory (ROM) and a random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable read-only memory (PROM), an erasable programmable read-only memory (FPROM), an electrically erasable programmable read-only memory (EFPROM), an electrically alterable read-only memory (EAROM), or flash memory (FLASH), or a combination of two or more of these. Under appropriate circumstances, the RAM can be a static random access memory (SRAM) or a dynamic random access memory (DRAM), where the DRAM can be a fast page mode dynamic random access memory (FPMDRAM), an extended data out dynamic random access memory (EDODRAM), a synchronous dynamic random access memory (SDRAM), etc.
[0080] The memory 82 may be used to store or cache various data files required for processing and / or communication, as well as possible computer program instructions executed by the processor 81 .
[0081] The processor 81 implements any full-text search method in the above embodiments by reading and executing computer program instructions stored in the memory 82 .
[0082] In some embodiments, the electronic device may further include a communication interface 83 and a bus 80. Figure 3 As shown, the processor 81, the memory 82, and the communication interface 83 are connected via a bus 80 and communicate with each other.
[0083] The communication interface 83 is used to implement communication between the various modules, devices, units, and / or devices in the embodiments of the present application. The communication interface 83 can also implement data communication with other components such as: external devices, image / full-text search devices, databases, external storage, and image / full-text search workstations.
[0084] The bus 80 includes hardware, software, or both, and couples the components of the electronic device to each other. The bus 80 includes, but is not limited to, at least one of the following: a data bus, an address bus, a control bus, an expansion bus, and a local bus. By way of example and not limitation, bus 80 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses, or a combination of two or more of these. Bus 80 may include one or more buses, where appropriate. Although embodiments herein describe and illustrate a particular bus, this application contemplates any suitable bus or interconnect.
[0085] Electronic devices can be connected to the full-text search system to achieve the combination Figure 1 Described method.
[0086] The technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above-mentioned embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0087] To sum up, the present invention divides the document-related information of different dimensions that need to be involved in the retrieval into different fields for indexing through the search engine, and specifies different keywords for each field involved in the retrieval, so as to quickly and accurately recall documents that are strongly related to the user's intention, enhance the expression ability of unstructured data retrieval intention, and improve the accuracy of recalled data.
[0088] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be subject to the scope of protection of the appended claims.
Claims
1. A full-text search method, characterized in that: include: Index creation step: creating a full-text index and writing the field information involved in the retrieval into the full-text index; Retrieval parameter construction step: constructing the retrieval parameters and abstracting the keywords of the field information to generate a DSL interface class; Query index acquisition step: calling a DSL abstract method to obtain a DSL query index, combining the DSL query indexes to obtain a complete DSL query index; Retrieval step: searching through the complete DSL query index to retrieve relevant documents; The index establishment step includes, after establishing the full-text index, extracting the field information to be retrieved from each document involved in the retrieval, and writing each field information into the full-text index; The search parameter construction step includes constructing the search parameters to form a Map<String, String> The structure is as follows: key is the field name, value is the field value, and after abstracting the keyword corresponding to a single field information to generate the DSL interface class FieldKeywordDSL, an abstract method DSL genDsl (String keyword) for generating DSL is defined to implement the DSL interface class according to different field information; Wherein, the query index acquisition step includes: Selection step: selecting the DSL interface class suitable for each kv pair according to the key of the search parameter; Generating step: after calling genDSL to generate the DSL query index of the kv pair, all the DSL query indexes are combined using an and relationship to generate the complete DSL query index.
2. A full-text retrieval system, characterized in that: Applicable to the full-text search method described in claim 1 above, the full-text search system includes: Index building unit: builds a full-text index and writes the field information involved in the retrieval into the full-text index; Retrieval parameter construction unit: constructs retrieval parameters and abstracts the keywords of the field information to generate DSL interface classes; Query index acquisition unit: calls the DSL abstract method to obtain a DSL query index, combines the DSL query indexes, and obtains a complete DSL query index; Retrieval unit: searching through the complete DSL query index to retrieve relevant documents; After the full-text index is established by the index establishment unit, the field information required to be retrieved from each document involved in the retrieval is extracted, and each field information is written into the full-text index; The search parameter construction unit constructs the search parameter to form a Map<String, String> The structure of the field key is the field name, the value is the field value, and after abstracting the keyword corresponding to a single field information to generate the DSL interface class FieldKeywordDSL, an abstract method DSL genDsl (String keyword) for generating DSL is defined, and the DSL interface class is implemented according to different field information; Wherein, the query index acquisition unit includes: Selection module: selects the DSL interface class suitable for each kv pair according to the key of the search parameter; Generating module: after calling genDSL to generate the DSL query index of the kv pair, all the DSL query indexes are combined using the relationship of and to generate the complete DSL query index.
3. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the full-text search method according to claim 1 is implemented.
4. An electronic device-readable storage medium having computer program instructions stored thereon, wherein the computer program instructions, when executed by a processor, implement the full-text search method according to claim 1.
Citation Information
Patent Citations
Visual service data operating system and method
CN111190916A