A position top-k keyword query-based priority query algorithm and system under a sliding window. The algorithm comprises the following steps: step 1, inputting a constructed quadtree indexing model, a query node and k, and initializing a set of results; step 2, executing a branch trim operation to obtain a set of candidate results; step 3, using a maximum heap C to store each word in the set of candidate results and the score thereof; step 4, when the size of the set of results is smaller than k, sequentially taking a word at a queue head from C, traversing from a root node to a leaf node to find the accurate score thereof and placing same into a queue; step 5, cyclically carrying out step 4, and when the score of the word at the queue head is equal to the accurate score of the word in the leaf node, placing same in the set of results; and step 6, when the size of the set of results is equal to k, returning the set of results. The algorithm and system can effectively trim a search space according to word frequency and position proximity, and avoids unnecessary computations while ensuring that no candidate word is lost, greatly reducing computation costs and improving the speed of querying.
展开▼