Ejemplo n.º 1
0
 def getBlog(self, filter):
     conn = solr.SolrConnection('http://localhost:8983/solr')
     print filter
     parsedFilter = SearchFilter()
     parsedFilter.decode(filter)
     print parsedFilter.toSolr()
     response = conn.query(**(parsedFilter.toSolr()))
     conn.close()
     return [hit['link'] for hit in response.results]
Ejemplo n.º 2
0
 def getBlog(self, filter):
     conn = solr.SolrConnection('http://localhost:8983/solr')
     print filter
     parsedFilter = SearchFilter()
     parsedFilter.decode(filter)
     print parsedFilter.toSolr()
     response = conn.query(**(parsedFilter.toSolr()))
     conn.close()
     return [hit['link'] for hit in response.results]
Ejemplo n.º 3
0
 def getBlogPost(self, filter):
     conn = solr.SolrConnection('http://localhost:8983/solr')
     print filter
     parsedFilter = SearchFilter()
     parsedFilter.decode(filter)
     params = parsedFilter.toSolr()
     params['q'] = params['q'] +  " sentiment:[0.75 TO 1.0]"
     good_response = conn.query(**(params))
     params = parsedFilter.toSolr()
     params['q'] = params['q'] +  " sentiment:[0.0 TO 0.25]"
     bad_response = conn.query(**(params))
     conn.close()
     goodText = ""
     badText = ""
     results = good_response.results + bad_response.results
     for hit in results:
         if hit['sentiment'] == True:
             goodText += hit['content']
         elif hit['sentiment'] == False:
             badText += hit['content']
     q, p = ngrams.main(goodText, badText, ngrams.getWordsForDisplay)
     return (q, p, [(hit['title'], hit['content'], hit['sentiment']) for hit in results if hit['content']])
Ejemplo n.º 4
0
 def getBlogPost(self, filter):
     conn = solr.SolrConnection('http://localhost:8983/solr')
     print filter
     parsedFilter = SearchFilter()
     parsedFilter.decode(filter)
     params = parsedFilter.toSolr()
     params['q'] = params['q'] + " sentiment:[0.75 TO 1.0]"
     good_response = conn.query(**(params))
     params = parsedFilter.toSolr()
     params['q'] = params['q'] + " sentiment:[0.0 TO 0.25]"
     bad_response = conn.query(**(params))
     conn.close()
     goodText = ""
     badText = ""
     results = good_response.results + bad_response.results
     for hit in results:
         if hit['sentiment'] == True:
             goodText += hit['content']
         elif hit['sentiment'] == False:
             badText += hit['content']
     q, p = ngrams.main(goodText, badText, ngrams.getWordsForDisplay)
     return (q, p, [(hit['title'], hit['content'], hit['sentiment'])
                    for hit in results if hit['content']])