'Efficiently and constantly reorganize searchable data based on access frequency
I want to be able to organize data for efficiency and constantly update the order of that data based on frequency of access, relevancy, and accuracy.
For example, given a list L:
L = [1, 'apple', 'dog', $2.99, 'Jim', 'carrot', 'peach', 5, $7.49, 'Susan', 'Cat']
If a user searches for the integer 1, then peach, then 5 I'd like the list to reorganize itself based on all previous searches like so:
L = [1, 5, $2.99, $7.49, 'peach', 'apple', 'carrot', 'dog', 'Jim', 'Susan', 'Cat']
Giving priority to any exact matches, any data with numbers as those were searched more frequently, then fruit, food, and everything else maintaining its previous order.
I've considered using an intensity weight as the key inside a dictionary instead:
L = {10:1, 9:5, 8:$2.99, 7:$7.49, 6:'peach', 4:'apple', 3:'carrot', 2:'dog', 1:'Jim', 0:'Susan', 0:'Cat'}
And then updating the keys with different weights.
What will likely work better for my needs is something dictionary/json related as my dataset is greater than 500,000 data points and growing. Storing the data in a different manner that doesn't require loading the entire dataset into memory for every search would also be helpful.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
