CN110516141B - Data query method and device, electronic equipment and readable storage medium - Google Patents

Data query method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN110516141B
CN110516141B CN201910662741.9A CN201910662741A CN110516141B CN 110516141 B CN110516141 B CN 110516141B CN 201910662741 A CN201910662741 A CN 201910662741A CN 110516141 B CN110516141 B CN 110516141B
Authority
CN
China
Prior art keywords
search
result set
terminal
query
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910662741.9A
Other languages
Chinese (zh)
Other versions
CN110516141A (en
Inventor
薛洪立
王东川
沈军
王艳辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Visionvera Information Technology Co Ltd
Original Assignee
Visionvera Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Visionvera Information Technology Co Ltd filed Critical Visionvera Information Technology Co Ltd
Priority to CN201910662741.9A priority Critical patent/CN110516141B/en
Publication of CN110516141A publication Critical patent/CN110516141A/en
Application granted granted Critical
Publication of CN110516141B publication Critical patent/CN110516141B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9532Query formulation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9535Search customisation based on user profiles and personalisation

Abstract

The embodiment of the invention provides a data query method, and relates to the technical field of data processing. The method comprises the following steps: receiving a search keyword sent by a terminal; decomposing the search keywords to obtain a first query value; searching according to the first query value to obtain a first result set; when a continuous search request is received, decomposing the search keywords to obtain a second query value, searching in the first result set according to the second query value to obtain a second result set, increasing the search keywords according to the second query value, and gradually simplifying the result set to finally obtain a search target. The invention also provides a data inquiry device, electronic equipment and a readable storage medium. The data query method, the data query device, the electronic equipment and the readable storage medium can quickly and accurately search the search target, and can avoid the phenomenon of slow response and false halt caused by large amount of original data.

Description

Data query method and device, electronic equipment and readable storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a data query method, device electronic equipment, and a computer-readable storage medium.
Background
When a user inquires data, the user directly searches the data under the condition of large amount of original data, and the time spent by the user is different according to the configuration of a searching device, the searching mode and the searching content.
In the related art, when a user searches in a data source directly during query, the user directly judges that a target result is slower in search or is not responded due to too large data, and the user is in a false halt state under the condition that the original data amount is large.
Disclosure of Invention
In view of the above problems, embodiments of the present invention are proposed to provide a data query method, apparatus, electronic device and readable storage medium that overcome or at least partially solve the above problems.
In a first aspect, an embodiment of the present invention discloses a data query method, where the method is applied to a background server, and the background server is in communication connection with a terminal, and the method includes:
receiving a search keyword sent by the terminal;
decomposing the search keyword to obtain a first query value, wherein the first query value is the minimum unit value of the search keyword;
searching according to the first query value to obtain a first result set, and sending the first result set to the terminal so that the terminal can display the first result set;
receiving a continuous search request sent by the terminal, wherein the continuous search request is sent to the background server when the terminal judges that a search target is not obtained according to the first result set;
judging whether a first result in the first result set is larger than a preset index or not;
under the condition that the first result is larger than the preset index, decomposing the search keyword to obtain a second query value, wherein the unit value of the second query value is larger than the unit value of the first query value;
searching in the first result set according to the second query value to obtain a second result set;
sending the second result set to the terminal so that the terminal displays the second result set;
and stopping searching when a search stopping request sent by the terminal is received, wherein the terminal judges whether a search target is obtained or not according to the second result set, sends a search stopping request to the server when the search target is obtained, and sends the search continuing request to the background server when the search target is not obtained until the terminal obtains the search target according to the received result set.
Further, the step of decomposing the search keyword to obtain a first query value includes:
and decomposing the search keyword, and extracting the first word of the search keyword as a first query value.
Further, the step of decomposing the search keyword to obtain a second query value includes:
and decomposing the search keyword to obtain an adjacent keyword of the first query value, and obtaining the second query value according to the first query value and the adjacent keyword.
Further, the method further comprises:
and establishing a corresponding relation between the search keyword and a target result set of the search target, and storing the search keyword and the target result set in a historical database.
Further, the method further comprises:
and judging whether the historical database has a target result set corresponding to the search keyword, and sending the target result set to the terminal when the historical database has the corresponding target result set.
In a second aspect, an embodiment of the present invention discloses a data query device, where the device is applied to a background server, the background server is in communication connection with a terminal, and the device includes:
the receiving module is used for receiving the search keywords sent by the terminal;
the decomposition module is used for decomposing the search keyword to obtain a first query value, wherein the first query value is the minimum unit value of the search keyword;
the query module is used for searching according to the first query value to obtain a first result set and sending the first result set to the terminal so that the terminal can display the first result set;
the receiving module is further configured to receive a continuous search request sent by the terminal, where the continuous search request is sent to the background server when the terminal determines that a search target is not obtained according to the first result set;
the first judgment module is used for judging whether a first result in the first result set is larger than a preset index or not;
the decomposition module is further configured to decompose the search keyword to obtain a second query value when the first result is greater than the preset index, where a unit value of the second query value is greater than a unit value of the first query value;
the query module is further configured to search the first result set according to the second query value, and obtain a second result set;
a sending module, configured to send the second result set to the terminal, so that the terminal displays the second result set;
and the stopping module is used for stopping searching when receiving a search stopping request sent by the terminal, wherein the terminal judges whether a search target is obtained or not according to the second result set, sends a search stopping request to the server when the search target is obtained, and sends the search continuing request to the background server when the search target is not obtained until the terminal obtains the search target according to the received result set.
Further, the decomposition module comprises:
and the first decomposition sub-module is used for decomposing the search keyword and extracting the first word of the search keyword as a first query value.
Further, the decomposition module further comprises:
and the second decomposition sub-module is used for decomposing the search keyword to obtain an adjacent keyword of the first query value, and obtaining the second query value according to the first query value and the adjacent keyword.
Further, the apparatus further comprises:
and the creating module is used for establishing the corresponding relation between the search keyword and a target result set of the search target, and storing the search keyword and the target result set into a historical database.
Further, the apparatus further comprises:
and the second judgment module is used for judging whether the historical database has a target result set corresponding to the search keyword or not, and sending the target result set to the terminal when the historical database has the corresponding target result set.
In a third aspect, an embodiment of the present invention further discloses an electronic device, including:
one or more processors; and
one or more machine-readable media having instructions stored thereon, which when executed by the one or more processors, cause the apparatus to perform a data query method as in any one of the embodiments of the invention.
In a fourth aspect, the embodiment of the present invention further discloses a computer-readable storage medium, which stores a computer program for causing a processor to execute the data query method according to the embodiment of the present invention.
The embodiment of the invention has the following advantages:
in the embodiment of the invention, the background server decomposes the received search key words sent by the terminal to obtain a first query value, carries out first search according to the first query value to obtain a first result set and sends the first result set to the terminal, and the terminal sends a continuous search request to the background server when the terminal needs to continue searching. And after receiving the continuous search request, the background server decomposes the search keywords again to obtain a second query value, searches in the first result set according to the second query value to obtain a second result set, and then sends the second result set to the terminal. And circulating the steps until the search target is obtained in the result set.
The search is started from the first query value with the minimum unit value of the search keyword, and when the query is matched, the unit value of the minimum unit value is minimum, so that the calculation amount required by single matching is smaller, the calculation amount required by the whole search matching is reduced, the false death phenomenon is effectively avoided, and the search speed is improved. Meanwhile, the search keywords are split, the maximum result set can be taken according to query matching of the data source, the size of the result set is reduced in sequence on the basis of the maximum result set, the search target is finally obtained accurately, and omission of related search contents can be effectively avoided.
Drawings
FIG. 1 is a schematic networking diagram of a video network of the present invention;
FIG. 2 is a schematic diagram of a hardware architecture of a node server according to the present invention;
fig. 3 is a schematic diagram of a hardware structure of an access switch of the present invention;
fig. 4 is a schematic diagram of a hardware structure of an ethernet protocol conversion gateway according to the present invention;
FIG. 5 is a flow chart of steps of a method of querying data in accordance with an embodiment of the present invention;
FIG. 6 is a flowchart of an implementation of a data query method according to an embodiment of the present invention;
FIG. 7 is a flowchart of one step of a data query method of an embodiment of the present invention;
fig. 8 is a schematic structural diagram of an embodiment of a data query apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
The video networking is an important milestone for network development, is a real-time network, can realize high-definition video real-time transmission, and pushes a plurality of internet applications to high-definition video, and high-definition faces each other.
The video networking adopts a real-time high-definition video exchange technology, can integrate required services such as dozens of services of video, voice, pictures, characters, communication, data and the like on a system platform on a network platform, such as high-definition video conference, video monitoring, intelligent monitoring analysis, emergency command, digital broadcast television, delayed television, network teaching, live broadcast, VOD on demand, television mail, Personal Video Recorder (PVR), intranet (self-office) channels, intelligent video broadcast control, information distribution and the like, and realizes high-definition quality video broadcast through a television or a computer.
To better understand the embodiments of the present invention, the following description refers to the internet of view:
some of the technologies applied in the video networking are as follows:
network Technology (Network Technology)
Network technology innovation in video networking has improved the traditional Ethernet (Ethernet) to face the potentially huge first video traffic on the network. Unlike pure network Packet Switching (Packet Switching) or network Circuit Switching (Circuit Switching), the Packet Switching is adopted by the technology of the video networking to meet the Streaming requirement. The video networking technology has the advantages of flexibility, simplicity and low price of packet switching, and simultaneously has the quality and safety guarantee of circuit switching, thereby realizing the seamless connection of the whole network switching type virtual circuit and the data format.
Switching Technology (Switching Technology)
The video network adopts two advantages of asynchronism and packet switching of the Ethernet, eliminates the defects of the Ethernet on the premise of full compatibility, has end-to-end seamless connection of the whole network, is directly communicated with a user terminal, and directly bears an IP data packet. The user data does not require any format conversion across the entire network. The video networking is a higher-level form of the Ethernet, is a real-time exchange platform, can realize the real-time transmission of the whole-network large-scale high-definition video which cannot be realized by the existing Internet, and pushes a plurality of network video applications to high-definition and unification.
Server Technology (Server Technology)
The server technology on the video networking and unified video platform is different from the traditional server, the streaming media transmission of the video networking and unified video platform is established on the basis of connection orientation, the data processing capacity of the video networking and unified video platform is independent of flow and communication time, and a single network layer can contain signaling and data transmission. For voice and video services, the complexity of video networking and unified video platform streaming media processing is much simpler than that of data processing, and the efficiency is greatly improved by more than one hundred times compared with that of a traditional server.
Storage Technology (Storage Technology)
The super-high speed storage technology of the unified video platform adopts the most advanced real-time operating system in order to adapt to the media content with super-large capacity and super-large flow, the program information in the server instruction is mapped to the specific hard disk space, the media content is not passed through the server any more, and is directly sent to the user terminal instantly, and the general waiting time of the user is less than 0.2 second. The optimized sector distribution greatly reduces the mechanical motion of the magnetic head track seeking of the hard disk, the resource consumption only accounts for 20% of that of the IP internet of the same grade, but concurrent flow which is 3 times larger than that of the traditional hard disk array is generated, and the comprehensive efficiency is improved by more than 10 times.
Network Security Technology (Network Security Technology)
The structural design of the video network completely eliminates the network security problem troubling the internet structurally by the modes of independent service permission control each time, complete isolation of equipment and user data and the like, generally does not need antivirus programs and firewalls, avoids the attack of hackers and viruses, and provides a structural carefree security network for users.
Service Innovation Technology (Service Innovation Technology)
The unified video platform integrates services and transmission, and is not only automatically connected once whether a single user, a private network user or a network aggregate. The user terminal, the set-top box or the PC are directly connected to the unified video platform to obtain various multimedia video services in various forms. The unified video platform adopts a menu type configuration table mode to replace the traditional complex application programming, can realize complex application by using very few codes, and realizes infinite new service innovation.
Networking of the video network is as follows:
the video network is a centralized control network structure, and the network can be a tree network, a star network, a ring network and the like, but on the basis of the centralized control node, the whole network is controlled by the centralized control node in the network.
As shown in fig. 1, the video network is divided into an access network and a metropolitan network.
The devices of the access network part can be mainly classified into 3 types: node server, access switch, terminal (including various set-top boxes, coding boards, memories, etc.). The node server is connected to an access switch, which may be connected to a plurality of terminals and may be connected to an ethernet network.
The node server is a node which plays a centralized control function in the access network and can control the access switch and the terminal. The node server can be directly connected with the access switch or directly connected with the terminal.
Similarly, devices of the metropolitan network portion may also be classified into 3 types: a metropolitan area server, a node switch and a node server. The metro server is connected to a node switch, which may be connected to a plurality of node servers.
The node server is a node server of the access network part, namely the node server belongs to both the access network part and the metropolitan area network part.
The metropolitan area server is a node which plays a centralized control function in the metropolitan area network and can control a node switch and a node server. The metropolitan area server can be directly connected with the node switch or directly connected with the node server.
Therefore, the whole video network is a network structure with layered centralized control, and the network controlled by the node server and the metropolitan area server can be in various structures such as tree, star and ring.
The access network part can form a unified video platform (the part in a dotted circle), and a plurality of unified video platforms can form a video network; each unified video platform may be interconnected via metropolitan area and wide area video networking.
Visio networking device classification
1.1 devices in the video network of the embodiment of the present invention can be mainly classified into 3 types: server, exchanger (including Ethernet protocol conversion gateway), terminal (including various set-top boxes, code board, memory, etc.). The video network as a whole can be divided into a metropolitan area network (or national network, global network, etc.) and an access network.
1.2 wherein the devices of the access network part can be mainly classified into 3 types: node server, access exchanger (including Ethernet protocol conversion gateway), terminal (including various set-top boxes, coding board, memory, etc.).
The specific hardware structure of each access network device is as follows:
a node server:
as shown in fig. 2, the system mainly includes a network interface module 201, a switching engine module 202, a CPU module 203, and a disk array module 204;
the network interface module 201, the CPU module 203, and the disk array module 204 all enter the switching engine module 202; the switching engine module 202 performs an operation of looking up the address table 205 on the incoming packet, thereby obtaining the direction information of the packet; and stores the packet in a queue of the corresponding packet buffer 206 based on the packet's steering information; if the queue of the packet buffer 206 is nearly full, it is discarded; the switching engine module 202 polls all packet buffer queues for forwarding if the following conditions are met: 1) the port send buffer is not full; 2) the queue packet counter is greater than zero. The disk array module 204 mainly implements control over the hard disk, including initialization, read-write, and other operations on the hard disk; the CPU module 203 is mainly responsible for protocol processing with an access switch and a terminal (not shown in the figure), configuring an address table 205 (including a downlink protocol packet address table, an uplink protocol packet address table, and a data packet address table), and configuring the disk array module 204.
The access switch:
as shown in fig. 3, the network interface module mainly includes a network interface module (a downlink network interface module 301 and an uplink network interface module 302), a switching engine module 303 and a CPU module 304;
wherein, the packet (uplink data) coming from the downlink network interface module 301 enters the packet detection module 305; the packet detection module 305 detects whether the Destination Address (DA), the Source Address (SA), the packet type, and the packet length of the packet meet the requirements, and if so, allocates a corresponding stream identifier (stream-id) and enters the switching engine module 303, otherwise, discards the stream identifier; the packet (downstream data) coming from the upstream network interface module 302 enters the switching engine module 303; the incoming data packet of the CPU module 304 enters the switching engine module 303; the switching engine module 303 performs an operation of looking up the address table 306 on the incoming packet, thereby obtaining the direction information of the packet; if the packet entering the switching engine module 303 is from the downstream network interface to the upstream network interface, the packet is stored in the queue of the corresponding packet buffer 307 in association with the stream-id; if the queue of the packet buffer 307 is nearly full, it is discarded; if the packet entering the switching engine module 303 is not from the downlink network interface to the uplink network interface, the data packet is stored in the queue of the corresponding packet buffer 307 according to the guiding information of the packet; if the queue of the packet buffer 307 is nearly full, it is discarded.
The switching engine module 303 polls all packet buffer queues and may include two cases:
if the queue is from the downlink network interface to the uplink network interface, the following conditions are met for forwarding: 1) the port send buffer is not full; 2) the queued packet counter is greater than zero; 3) obtaining a token generated by a code rate control module;
if the queue is not from the downlink network interface to the uplink network interface, the following conditions are met for forwarding: 1) the port send buffer is not full; 2) the queued packet counter is greater than zero.
The rate control module 308 is configured by the CPU module 304, and generates tokens for packet buffer queues from all downstream network interfaces to upstream network interfaces at programmable intervals to control the rate of upstream forwarding.
The CPU module 304 is mainly responsible for protocol processing with the node server, configuration of the address table 306, and configuration of the code rate control module 308.
Ethernet protocol conversion gateway
As shown in fig. 4, the apparatus mainly includes a network interface module (a downlink network interface module 401 and an uplink network interface module 402), a switching engine module 403, a CPU module 404, a packet detection module 405, a rate control module 408, an address table 406, a packet buffer 407, a MAC adding module 409, and a MAC deleting module 410.
Wherein, the data packet coming from the downlink network interface module 401 enters the packet detection module 405; the packet detection module 405 detects whether the ethernet MAC DA, the ethernet MAC SA, the ethernet length or frame type, the video network destination address DA, the video network source address SA, the video network packet type, and the packet length of the packet meet the requirements, and if so, allocates a corresponding stream identifier (stream-id); then, the MAC deletion module 410 subtracts MAC DA, MAC SA, length or frame type (2byte) and enters the corresponding receiving buffer, otherwise, discards it;
the downlink network interface module 401 detects the sending buffer of the port, and if there is a packet, obtains the ethernet MAC DA of the corresponding terminal according to the destination address DA of the packet, adds the ethernet MAC DA of the terminal, the MAC SA of the ethernet protocol gateway, and the ethernet length or frame type, and sends the packet.
The other modules in the ethernet protocol gateway function similarly to the access switch.
A terminal:
the system mainly comprises a network interface module, a service processing module and a CPU module; for example, the set-top box mainly comprises a network interface module, a video and audio coding and decoding engine module and a CPU module; the coding board mainly comprises a network interface module, a video and audio coding engine module and a CPU module; the memory mainly comprises a network interface module, a CPU module and a disk array module.
1.3 devices of the metropolitan area network part can be mainly classified into 2 types: node server, node exchanger, metropolitan area server. The node switch mainly comprises a network interface module, a switching engine module and a CPU module; the metropolitan area server mainly comprises a network interface module, a switching engine module and a CPU module.
2. Video networking packet definition
2.1 Access network packet definition
The data packet of the access network mainly comprises the following parts: destination Address (DA), Source Address (SA), reserved bytes, payload (pdu), CRC.
As shown in the following table, the data packet of the access network mainly includes the following parts:
DA SA Reserved Payload CRC
wherein:
the Destination Address (DA) is composed of 8 bytes (byte), the first byte represents the type of the data packet (such as various protocol packets, multicast data packets, unicast data packets, etc.), there are 256 possibilities at most, the second byte to the sixth byte are metropolitan area network addresses, and the seventh byte and the eighth byte are access network addresses;
the Source Address (SA) is also composed of 8 bytes (byte), and is defined to be the same as the Destination Address (DA);
reserved bytes consist of 2 bytes;
the payload part has different lengths according to different types of datagrams, and is 64 bytes if the datagram is various types of protocol packets, and is 32+1024 or 1056 bytes if the datagram is a unicast packet, of course, the length is not limited to the above 2 types;
the CRC consists of 4 bytes and is calculated in accordance with the standard ethernet CRC algorithm.
2.2 metropolitan area network packet definition
The topology of a metropolitan area network is a graph and there may be 2, or even more than 2, connections between two devices, i.e., there may be more than 2 connections between a node switch and a node server, a node switch and a node switch, and a node switch and a node server. However, the address of the metro network device is unique, and in order to accurately describe the connection relationship between the metro network devices, parameters are introduced in the embodiment of the present invention: a label to uniquely describe a metropolitan area network device.
In the present specification, the definition of the Label is similar to that of the Label of MPLS (Multi-Protocol Label Switch), and assuming that there are two connections between the device a and the device B, there are 2 labels for the packet from the device a to the device B, and there are 2 labels for the packet from the device B to the device a. The label is classified into an incoming label and an outgoing label, and assuming that the label (incoming label) of the packet entering the device a is 0x0000, the label (outgoing label) of the packet leaving the device a may become 0x 0001. The network access process of the metro network is a network access process under centralized control, that is, address allocation and label allocation of the metro network are both dominated by the metro server, and the node switch and the node server are both passively executed, which is different from label allocation of MPLS, and label allocation of MPLS is a result of mutual negotiation between the switch and the server.
As shown in the following table, the data packet of the metro network mainly includes the following parts:
DA SA Reserved label (R) Payload CRC
Namely Destination Address (DA), Source Address (SA), Reserved byte (Reserved), tag, payload (pdu), CRC. The format of the tag may be defined as follows: the tag is 32 bits with the upper 16 bits reserved and only the lower 16 bits used, and its position is between the reserved bytes and payload of the packet.
The data query method disclosed by the invention can be applied to the video network, the video network can comprise a terminal and a background server, and the terminal is in communication connection with the background server. The data query method disclosed by the invention is an associative search mode, and a corresponding result set is matched according to a certain atom set. In the data source, aiming at the target value to be obtained, a result set is obtained from the minimum query unit value of the search keyword, and on the basis of the result set obtained by the last query, the query values are sequentially increased in a reverse order for searching, so that the query result set is gradually simplified, and finally the target value is obtained by reverse screening.
Referring to fig. 5, a flowchart of steps of a data query method according to an embodiment of the present invention is shown, where the method may include the following steps:
step S501, receiving a search keyword sent by the terminal.
Step S502, decomposing the search keyword to obtain a first query value, wherein the first query value is the minimum unit value of the search keyword.
The search keyword can be input into the terminal by the user, and the terminal sends the search keyword to the background server. After receiving the search keywords, the background server decomposes the search keywords and then extracts a first query value. The magnitude of the first query value is the smallest unit value of the search key. For example, if the search keyword input by the user is "video conference", the background server decomposes the search keyword to obtain query values with 4 minimum unit values for video, conference and conference, respectively, and then one of the query values is used as the first query value. When the background server searches in the data source according to the first query value, the first query value with the minimum unit value is used for comparison and matching, the required calculated amount is smaller, and the data searching speed can be effectively improved.
Step S503, a first result set is obtained by searching according to the first query value, and the first result set is sent to the terminal, so that the terminal displays the first result set.
And searching in the data source according to the first query value to obtain a first result set. For example, the search keyword is "video conference", the server decomposes the "video conference" and extracts "view" as a first query value, and searches in the data source according to the "view", and a first result set obtained by the search may include: a certain video, a certain video recording, a certain video conference, a video conference recording, a video conference, etc. contains the result of a "view" word.
Searching according to the minimum unit value of the search keyword can obtain a result set containing more related search contents, such as the above-mentioned visual conference record. And the first result set obtained by searching is sent to the terminal, and richer search results are displayed to the user through the terminal, so that the use experience of the user is improved.
Step S504, receiving a continuous search request sent by the terminal, where the continuous search request is sent to the background server when the terminal determines that the search target is not obtained according to the first result set.
After the terminal displays the first result set, whether a search target is obtained in the first result set or not is judged, and a continuous search request is sent to the background server when the search target is not obtained.
It should be noted that, whether the search target is obtained in the first result set may be determined in various ways. In one determination mode, whether to send a search continuation request may be determined by an operation intention of the terminal for the current user, for example, if the user does not stop on a certain page while turning and browsing the interface, the terminal may consider that the user does not find a search target in the currently displayed first result set, and send a search continuation request to the background server. In another determination manner, whether to send a search continuation request may be determined according to an operation of the user, for example, if the user wants to continue searching while browsing a first page of the presented first result set, the terminal may be caused to send the search continuation request to the backend server by clicking a search continuation button.
In addition to the above, the determination of the terminal and the operation of the user may be combined to decide whether to send the search continuation request to the background server, for example, the terminal may send the search continuation request to the background server if the following conditions are satisfied:
1. the user sends a search continuation request after browsing the interface for a preset time, which can be set according to the requirements, for example, any time within 15-20S.
2. And the terminal identifies whether the current display interface has a jump or not. If the currently displayed interface jumps, the user can be considered to be interested in a certain search result in the first result set, and at the moment, a continuous search request is not sent to the background server.
3. The background server judges the priority, and the user operation is standard. And when the background server judges that the search needs to be continued, sending a click interface for judging whether to continue the search request to the user interface, and sending the search continuing request to the background server only under the condition that the user agrees to send the search continuing request.
In this embodiment, preferably, the third manner may be adopted, that is, the background judgment is preferred, and the user operation is the standard, so that the use experience of the user may be effectively improved.
Step S505, determining whether a first result in the first result set is greater than a preset index.
Step S506, when the first result is greater than the preset index, the search keyword is decomposed to obtain a second query value, where a unit value of the second query value is greater than a unit value of the first query value.
Specifically, after receiving the search continuation request, the background server determines whether the number of the first results in the first result set is greater than a preset index, where the preset index may be set according to an actual situation. For example, the preset index may be 1, 10, or 20. When the preset index is 1 and the number of the first results in the first result set is larger than 1, decomposing the search keyword to obtain a second query value; when the preset index is 10, the number of the first results in the first result set is more than 10, and the search keywords are decomposed to obtain a second query value; accordingly, the description of the case of more than 20 is similar and will not be repeated. When the specific setting is performed, the size of the preset index can be set according to the number of the search results displayed on the current interface of the terminal. And according to the difference of the size of the display interface of the terminal, the number of the search results that can be displayed by the display interface is different, so that in this embodiment, preferably, the preset index can be set to 1, so that under the terminal display interfaces of different sizes, friendly use experience can be brought to the user.
And step S507, searching in the first result set according to the second query value, and obtaining a second result set.
Step S508, sending the second result set to the terminal, so that the terminal displays the second result set.
After the second query value is obtained by decomposing the search keyword, searching is carried out in the result set of the last search. The unit value of the second query value is larger than that of the first query value, the matching condition during searching is improved compared with the first query value, searching is carried out in the first result set, and compared data during searching are all contents related to the first query value obtained by first searching, so that even if the unit value of the query value is increased, the matching condition is improved, and searching can be rapidly and accurately completed.
After the second result set is obtained, the second result set also needs to be sent to the terminal, and the second result set is displayed to the user through the terminal.
It should be noted that, after the second result set is displayed to the user, the determination method of whether to send the search continuation request to the background server is similar to the above description of step S504, and reference may be made to the above description for relevant points, which is not described herein again. It can be understood that if a search target is not obtained in the second result set, the background server needs to continue sending a search request to the background server, and the background server decomposes the search keyword according to the search request to obtain a third query value, and performs a third search in the second result set according to the third query value.
Step S509, stopping the search when receiving a search stopping request sent by the terminal, where the terminal determines whether a search target is obtained according to the second result set, sends a search stopping request to the server when the search target is obtained, and sends the search continuing request to the background server when the search target is not obtained until the terminal obtains the search target according to the received result set.
In this embodiment, decomposing the search keyword to obtain the query value and searching the query value is a cyclic process, and the unit value of the query value obtained by each decomposition is larger than the unit value of the query value obtained by the last decomposition; meanwhile, each search is conducted in the result set obtained in the last search except that the first search is conducted in the data source.
It should be noted that, the condition for stopping the search by the background server may be that, in addition to receiving the search stopping request sent by the terminal, the search is stopped when the number of results in the result set is smaller than a preset index.
In the embodiment of the invention, the background server decomposes the received search key words sent by the terminal to obtain a first query value, carries out first search according to the first query value to obtain a first result set and sends the first result set to the terminal, and the terminal sends a continuous search request to the background server when the terminal needs to continue searching. And after receiving the continuous search request, the background server decomposes the search keywords again to obtain a second query value, searches in the first result set according to the second query value to obtain a second result set, and then sends the second result set to the terminal. And circulating the steps until the search target is obtained in the result set.
The search is started from the first query value with the minimum unit value of the search keyword, and when the query is matched, the unit value of the minimum unit value is minimum, so that the calculation amount required by single matching is smaller, the calculation amount required by the whole search matching is reduced, the false death phenomenon is effectively avoided, and the search speed is improved. Meanwhile, the search keywords are split, the maximum result set can be taken according to query matching of the data source, the size of the result set is reduced in sequence on the basis of the maximum result set, the search target is finally obtained accurately, and omission of related search contents can be effectively avoided.
Optionally, in an embodiment of the present invention, the decomposing the search keyword to obtain the first query value may include:
and decomposing the search keyword, and extracting the first word of the search keyword as a first query value. For the decomposition of the search keyword, the decomposition is performed according to a minimum unit value, wherein the minimum unit value may be set according to an actual search requirement, for example, in this embodiment, the minimum unit value is a single character, and in some other possible embodiments, the minimum unit value may also be a phrase.
In this embodiment, after the search keyword is decomposed, the top word of the search keyword is extracted as the first query value in the order from left to right. It is understood that in some other embodiments, the extraction manner may be different according to different settings, for example, the extraction may be performed sequentially from right to left, or may be performed starting from a middle character of the search keyword.
Optionally, the step of decomposing the search keyword to obtain a second query value includes:
and decomposing the search keyword to obtain an adjacent keyword of the first query value, and obtaining the second query value according to the first query value and the adjacent keyword. The adjacent keywords may be left-adjacent keywords, right-adjacent keywords, or left-adjacent keywords and right-adjacent keywords. According to different ways of extracting the first query value, adjacent keywords obtained by decomposition are different, for example, query values are extracted from left to right in sequence, and the second query value is the combination of the first query value and the right adjacent keywords; the query values are extracted starting from the middle, and the second query value may be a combination of the first query value and the left and right adjacent keywords. It should be noted that even if the first query value is extracted from the middle of the search keyword, the left-adjacent keyword or the right-adjacent keyword of the first query value may be individually selected and combined as the second query value.
Referring to fig. 6, it is a flowchart of an implementation of a data query method according to an embodiment of the present invention. For ease of understanding, reference may be made to the following specific implementation flow of performing two search processes, including:
step S601, a user inputs a search keyword through a terminal, and the terminal sends the search keyword to a background server;
step S602, the background server decomposes the search keyword to obtain a first query value;
step S603, the background server searches for the first time in the data source according to the first query value;
step S604, the background server obtains a first result set of results of the first search;
step S605, the background server sends the first result set to the terminal;
step S606, the terminal judges whether a search target is obtained in the first result set, if so, the search is finished; otherwise, the process goes to step S607;
step S607, the terminal sends a continuous search request to the background server, and the background server continues searching according to the continuous search request;
step S608, the background server continues searching, and carries out secondary decomposition on the search keywords to obtain a second query value;
step S609, the background server carries out second search in the first result set according to the second query value;
step S610, the background server obtains a second result set of the result of the second search;
step S611, the background server sends the second result set to the terminal;
and step S612, the terminal obtains a search target in the second result set and the search is finished.
It should be noted that the above flow merely illustrates the process of performing the determination twice, and in practical applications, more search times may be executed, for example, when performing three searches, the background server may decompose the search keyword to obtain a third query value, and perform a search in the second result set according to the third query value to obtain a third result set. The manner of subsequent decomposition search is similar to this, and is not described herein again.
Referring to fig. 7, a flowchart of a step of a data query method according to an embodiment of the present invention is shown. In an embodiment of the present invention, the data query method may further include:
step S701, establishing a corresponding relation between the search keyword and a target result set of the search target, and storing the search keyword and the target result set in a historical database.
After the search target is obtained, the corresponding relation between the search keyword and the target result set of the obtained search target can be established and stored in the history database. The result set of the search target may be obtained by one-time search or obtained by performing multiple decomposition queries on the search keyword. It can be understood that the result set of the finally obtained search target may contain search results similar to the search target, and has a certain recommendation meaning for the search target of the user, so that the corresponding relationship between the search keyword and the obtained target result set is established and stored in the history database, thereby facilitating subsequent search.
Step S702, judging whether the historical database has a target result set corresponding to the search keyword, and sending the target result set to the terminal when the historical database has the corresponding target result set.
And after the target result set corresponding to the current search keyword is judged to exist in the historical database, the target result set can be directly sent to the terminal, so that the search efficiency is improved. Because the resources in the historical database are updated according to the historical search results, the updating speed is delayed compared with the real-time updating speed of the data source, so that if the terminal still needs to continue searching after displaying the target result set, the terminal can send a search request to the background server, and after receiving the search request, the background server decomposes the search keywords to extract a first query value and searches for the data source, thereby providing accurate search service for the user.
In this embodiment, the background server decomposes the received search keyword sent by the terminal to obtain a first query value, performs a first search according to the first query value to obtain a first result set, and sends the first result set to the terminal, and the terminal sends a continuous search request to the background server when the terminal needs to continue searching. And after receiving the continuous search request, the background server decomposes the search keywords again to obtain a second query value, searches in the first result set according to the second query value to obtain a second result set, and then sends the second result set to the terminal. And circulating the steps until the search target is obtained in the result set.
The search is started from the first query value with the minimum unit value of the search keyword, and when the query is matched, the unit value of the minimum unit value is minimum, so that the calculation amount required by single matching is smaller, the calculation amount required by the whole search and matching is reduced, the false death phenomenon is effectively avoided, and the search speed is improved. Meanwhile, the search keywords are split, the maximum result set can be taken according to query matching of the data source, the size of the result set is reduced in sequence on the basis of the maximum result set, the search target is finally obtained accurately, and omission of related search contents can be effectively avoided.
It should be noted that for simplicity of description, the method embodiments are shown as a series of combinations of acts, but those skilled in the art will recognize that the embodiments are not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
Fig. 8 is a schematic structural diagram of an embodiment of a data query apparatus according to an embodiment of the present invention. The device is applied to a background server, the background server is in communication connection with a terminal, and the device comprises:
a receiving module 801, configured to receive a search keyword sent by the terminal;
a decomposition module 802, configured to decompose the search keyword to obtain a first query value, where the first query value is a minimum unit value of the search keyword;
the query module 803 is configured to search according to the first query value to obtain a first result set, and send the first result set to the terminal, so that the terminal displays the first result set;
the receiving module 801 is further configured to receive a continuous search request sent by the terminal, where the continuous search request is sent to the background server when the terminal determines that a search target is not obtained according to the first result set;
a first determining module 804, configured to determine whether a first result in the first result set is greater than a preset index;
the decomposition module 802 is further configured to decompose the search keyword to obtain a second query value when the first result is greater than the preset index, where a unit value of the second query value is greater than a unit value of the first query value;
the query module 803 is further configured to search the first result set according to the second query value, and obtain a second result set;
a sending module 805, configured to send the second result set to the terminal, so that the terminal displays the second result set;
a stopping module 806, configured to stop searching when a search stopping request sent by the terminal is received, where the terminal determines whether a search target is obtained according to the second result set, sends a search stopping request to the server when the search target is obtained, and sends the search continuing request to the background server when the search target is not obtained until the terminal obtains the search target according to the received result set.
Optionally, the decomposition module comprises:
and the first decomposition sub-module is used for decomposing the search keyword and extracting the first word of the search keyword as a first query value.
Optionally, the decomposition module further comprises:
and the second decomposition sub-module is used for decomposing the search keyword to obtain an adjacent keyword of the first query value, and obtaining the second query value according to the first query value and the adjacent keyword.
Optionally, the apparatus further comprises:
and the creating module is used for establishing the corresponding relation between the search keyword and a target result set of the search target, and storing the search keyword and the target result set into a historical database.
Optionally, the apparatus further comprises:
and the second judging module is used for judging whether a target result set corresponding to the search keyword exists in the historical database or not, and sending the target result set to the terminal when the target result set corresponds to the search keyword.
For the embodiment of the data query device, since it is basically similar to the embodiment of the data query method, the description is relatively simple, and the relevant points can be referred to the partial description of the embodiment of the data query method.
An embodiment of the present invention further provides an electronic device, including:
one or more processors; and
one or more machine-readable media having instructions stored thereon, which when executed by the one or more processors, cause the electronic device to perform a data query method as in any one of the embodiments of the invention.
Embodiments of the present invention further provide a computer-readable storage medium, which stores a computer program for enabling a processor to execute the data query method according to the embodiments of the present invention.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As will be appreciated by one of skill in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "include", "including" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or terminal device including a series of elements includes not only those elements but also other elements not explicitly listed or inherent to such process, method, article, or terminal device. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The data query method, the data query device, the electronic device and the readable storage medium provided by the present invention are described in detail above, and a specific example is applied in the present disclosure to explain the principle and the implementation of the present invention, and the description of the above embodiment is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. A data query method is applied to a background server, wherein the background server is in communication connection with a terminal, and the method comprises the following steps:
receiving a search keyword sent by the terminal;
decomposing the search keyword to obtain a first query value, wherein the first query value is the minimum unit value of the search keyword;
searching according to the first query value to obtain a first result set, and sending the first result set to the terminal so that the terminal can display the first result set;
receiving a continuous search request sent by the terminal, wherein the continuous search request is sent to the background server when the terminal judges that a search target is not obtained according to the first result set;
judging whether a first result in the first result set is larger than a preset index or not;
under the condition that the first result is larger than the preset index, decomposing the search keyword to obtain a second query value, wherein the unit value of the second query value is larger than the unit value of the first query value;
searching in the first result set according to the second query value to obtain a second result set;
sending the second result set to the terminal so that the terminal displays the second result set;
stopping searching when a search stopping request sent by the terminal is received, wherein the terminal judges whether a search target is obtained or not according to the second result set, sends a search stopping request to the server when the search target is obtained, and sends the search continuing request to the background server when the search target is not obtained until the terminal obtains the search target according to the received result set;
the step of decomposing the search keyword to obtain a second query value includes:
and decomposing the search keyword to obtain an adjacent keyword of the first query value, and obtaining the second query value according to the first query value and the adjacent keyword.
2. The method of claim 1, wherein the step of decomposing the search keyword to obtain a first query value comprises:
and decomposing the search keyword, and extracting the first word of the search keyword as a first query value.
3. The method of claim 1, further comprising:
and establishing a corresponding relation between the search keyword and a target result set of the search target, and storing the search keyword and the target result set in a historical database.
4. The method of claim 3, further comprising:
and judging whether the historical database has a target result set corresponding to the search keyword, and sending the target result set to the terminal when the historical database has the corresponding target result set.
5. A data inquiry device is applied to a background server, wherein the background server is in communication connection with a terminal, and the device comprises:
the receiving module is used for receiving the search keywords sent by the terminal;
the decomposition module is used for decomposing the search keyword to obtain a first query value, wherein the first query value is the minimum unit value of the search keyword;
the query module is used for searching according to the first query value to obtain a first result set and sending the first result set to the terminal so that the terminal can display the first result set;
the receiving module is further configured to receive a continuous search request sent by the terminal, where the continuous search request is sent to the background server when the terminal determines that the search target is not obtained according to the first result set;
the first judgment module is used for judging whether a first result in the first result set is larger than a preset index or not;
the decomposition module is further configured to decompose the search keyword to obtain a second query value when the first result is greater than the preset index, where a unit value of the second query value is greater than a unit value of the first query value;
the query module is further configured to search in the first result set according to the second query value, and obtain a second result set;
a sending module, configured to send the second result set to the terminal, so that the terminal displays the second result set;
a stopping module, configured to stop searching when a search stopping request sent by the terminal is received, where the terminal determines, according to the second result set, whether a search target is obtained, sends a search stopping request to the server when the search target is obtained, and sends the search continuing request to the background server when the search target is not obtained until the terminal obtains the search target according to the received result set;
the decomposition module comprises a second decomposition submodule, the second decomposition submodule is used for decomposing the search keywords to obtain adjacent keywords of the first query value, and the second query value is obtained according to the first query value and the adjacent keywords.
6. The apparatus of claim 5, wherein the decomposition module comprises:
and the first decomposition sub-module is used for decomposing the search keyword and extracting the first word of the search keyword as a first query value.
7. The apparatus of claim 5, further comprising:
and the creating module is used for establishing the corresponding relation between the search keyword and a target result set of the search target, and storing the search keyword and the target result set into a historical database.
8. The apparatus of claim 7, further comprising:
and the second judgment module is used for judging whether the historical database has a target result set corresponding to the search keyword or not, and sending the target result set to the terminal when the historical database has the corresponding target result set.
9. An electronic device, comprising:
one or more processors; and
one or more machine-readable media having instructions stored thereon, which when executed by the one or more processors, cause the electronic device to perform the data query method of any of claims 1-4.
10. A computer-readable storage medium storing a computer program for causing a processor to execute the data query method according to any one of claims 1 to 4.
CN201910662741.9A 2019-07-22 2019-07-22 Data query method and device, electronic equipment and readable storage medium Active CN110516141B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910662741.9A CN110516141B (en) 2019-07-22 2019-07-22 Data query method and device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910662741.9A CN110516141B (en) 2019-07-22 2019-07-22 Data query method and device, electronic equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN110516141A CN110516141A (en) 2019-11-29
CN110516141B true CN110516141B (en) 2022-08-30

Family

ID=68622731

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910662741.9A Active CN110516141B (en) 2019-07-22 2019-07-22 Data query method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN110516141B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112650775B (en) * 2020-12-30 2024-01-05 深圳云天励飞技术股份有限公司 Data searching method and device, electronic equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101963965B (en) * 2009-07-23 2013-03-20 阿里巴巴集团控股有限公司 Document indexing method, data query method and server based on search engine
CN102479207B (en) * 2010-11-29 2013-07-03 阿里巴巴集团控股有限公司 Information search method, system and device
US9576046B2 (en) * 2011-11-16 2017-02-21 Ptc Inc. Methods for integrating semantic search, query, and analysis across heterogeneous data types and devices thereof

Also Published As

Publication number Publication date
CN110516141A (en) 2019-11-29

Similar Documents

Publication Publication Date Title
CN110647698B (en) Page loading method and device, electronic equipment and readable storage medium
CN110674362B (en) Search recommendation method and device, electronic equipment and readable storage medium
CN110190973B (en) Online state detection method and device
CN109474715B (en) Resource configuration method and device based on video network
CN109634988B (en) Monitoring polling method and device
CN109286826B (en) Information display method and device
CN109672857B (en) Information processing method and device for monitoring resources
CN109743550B (en) Method and device for monitoring data flow regulation
CN110581975A (en) Conference terminal updating method and video networking system
CN110602039A (en) Data acquisition method and system
CN110619066B (en) Information acquisition method and device based on directory tree
CN109802952B (en) Monitoring data synchronization method and device
CN109005378B (en) Video conference processing method and system
CN110677392B (en) Video data transmission method and device
CN110516141B (en) Data query method and device, electronic equipment and readable storage medium
CN110022500B (en) Packet loss processing method and device
CN108574655B (en) Conference monitoring and broadcasting method and device
CN111031090B (en) Data processing method and device, electronic equipment and readable storage medium
CN110557411A (en) video stream processing method and device based on video network
CN110351582B (en) Method, system and device for processing video stream data and storage medium
CN109756476B (en) User-defined nickname setting method and system based on video network
CN110557372B (en) Data acquisition method and system
CN109743585B (en) Method and device for collecting monitoring videos and cloning favorites
CN110830185B (en) Data transmission method and device
CN110120937B (en) Resource acquisition method, system, device and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant