Advertisement
Guest User

Untitled

a guest
May 18th, 2016
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.30 KB | None | 0 0
  1. In [1]: from forum.models import Post
  2.  
  3. In [2]: from forum.search_indexes import PostIndex
  4.  
  5. In [3]: for post in Post.objects.filter(content__icontains=u"spa"): print post.id, post.content
  6. 3 Spam Ham Eggs
  7. 4 spam ham eggs
  8. 5 spammer gonna hate
  9. 6 spa aplication is the future of web
  10. 7 SPA aplication is the future of web
  11. 60 Python eats spaghetti
  12.  
  13. In [4]: for post in PostIndex.objects.filter(content__contains=u"spa"): print post.id, post.content
  14. forum.post.7 SPA aplication is the future of web
  15. forum.post.6 spa aplication is the future of web
  16.  
  17. In [5]: for post in PostIndex.objects.autocomplete(content__contains=u"spa"): print post.id, post.content
  18. forum.post.7 SPA aplication is the future of web
  19. forum.post.6 spa aplication is the future of web
  20.  
  21. In [6]: for post in PostIndex.objects.autocomplete(text__contains=u"spa"): print post.id, post.content
  22. forum.post.7 SPA aplication is the future of web
  23. forum.post.6 spa aplication is the future of web
  24.  
  25. In [7]: for post in PostIndex.objects.filter(text__contains=u"spa"): print post.id, post.content
  26. forum.post.7 SPA aplication is the future of web
  27. forum.post.6 spa aplication is the future of web
  28.  
  29. In [8]: for post in PostIndex.objects.filter(text__contains=u"spam"): print post.id, post.content
  30. forum.post.3 Spam Ham Eggs
  31. forum.post.4 spam ham eggs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement