Created
January 27, 2012 23:32
-
-
Save toastdriven/1691578 to your computer and use it in GitHub Desktop.
For fission6...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> from haystack.inputs import Raw | |
>>> from haystack.query import SearchQuerySet, SQ | |
>>> sqs = SearchQuerySet().filter(content='python') | |
>>> sqs2 = SearchQuerySet().filter(SQ(content='python') | (SQ(content='python') & SQ(content=Raw('pycon^10')))) | |
>>> | |
>>> sqs.count() | |
16 | |
>>> sqs2.count() | |
16 | |
>>> | |
>>> sqs | |
[<SearchResult: feeds.feedentry (pk=u'2770')>, <SearchResult: feeds.feedentry (pk=u'2783')>, <SearchResult: feeds.feedentry (pk=u'2767')>, <SearchResult: feeds.feedentry (pk=u'2765')>, <SearchResult: feeds.feedentry (pk=u'2755')>, <SearchResult: feeds.feedentry (pk=u'2757')>, <SearchResult: feeds.feedentry (pk=u'2788')>, <SearchResult: feeds.entryitem (pk=u'2545')>, <SearchResult: feeds.feedentry (pk=u'2771')>, <SearchResult: feeds.feedentry (pk=u'2773')>, <SearchResult: feeds.feedentry (pk=u'2766')>, <SearchResult: feeds.entryitem (pk=u'2548')>, <SearchResult: feeds.feedentry (pk=u'2768')>, <SearchResult: feeds.feedentry (pk=u'2778')>, <SearchResult: feeds.entryitem (pk=u'2544')>, <SearchResult: feeds.feedentry (pk=u'2769')>] | |
>>> | |
>>> sqs2 | |
[<SearchResult: feeds.feedentry (pk=u'2755')>, <SearchResult: feeds.feedentry (pk=u'2783')>, <SearchResult: feeds.feedentry (pk=u'2767')>, <SearchResult: feeds.feedentry (pk=u'2770')>, <SearchResult: feeds.feedentry (pk=u'2765')>, <SearchResult: feeds.entryitem (pk=u'2545')>, <SearchResult: feeds.feedentry (pk=u'2757')>, <SearchResult: feeds.feedentry (pk=u'2788')>, <SearchResult: feeds.feedentry (pk=u'2771')>, <SearchResult: feeds.feedentry (pk=u'2768')>, <SearchResult: feeds.feedentry (pk=u'2773')>, <SearchResult: feeds.feedentry (pk=u'2766')>, <SearchResult: feeds.entryitem (pk=u'2548')>, <SearchResult: feeds.feedentry (pk=u'2778')>, <SearchResult: feeds.entryitem (pk=u'2544')>, <SearchResult: feeds.feedentry (pk=u'2769')>] | |
>>> | |
>>> sqs[0].score, sqs[1].score, sqs[2].score, sqs[3].score, sqs[4].score | |
(0.4796222, 0.31147015, 0.27666408, 0.2334467, 0.19563106) | |
>>> sqs2[0].score, sqs2[1].score, sqs2[2].score, sqs2[3].score, sqs2[4].score | |
(0.3408122, 0.29142436, 0.1574226, 0.020727906, 0.008377838) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment