Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Result list by 'text' field #22

Open
ayxos opened this issue Nov 17, 2015 · 1 comment
Open

Result list by 'text' field #22

ayxos opened this issue Nov 17, 2015 · 1 comment

Comments

@ayxos
Copy link

ayxos commented Nov 17, 2015

Hi again, im a Redis newbie, i need a list with every single tweet with the same 'text'

ex. every single tweet (it doesnt matter from who) with the text "Welcome"

Any help? thank you so much

@tatsuya
Copy link
Owner

tatsuya commented Nov 17, 2015

Hey, I think if you only need a simple solution, you can just iterate all tweets and see if the text matches the specific term. As you may know this should work only if the data set is small enough because its time complexity is O(n).

If you need more faster solution, you probably need to construct index. I just found a post on Stack Overflow which could be related to this topic. The basic idea is to create the separated space in Redis using Set (or Sorted Set) data structure to store the term as key and the list of tweet IDs as value.

term:welcome => [123, 465, 987]
term:foo => [1024]
term:bar => [2048]

In the example above, each terms ("welcom", "foo" and "bar") are used as a key of Set and values (123, 465, 987, 1024 and 2048) are the list of tweet IDs which contain the term in its tweet. This is pretty much same implementation as most search engines do for their full text search functionality.

I hope this will help to solve your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants