Example #1
0
 def any(self,statementpositionid):
     logging.info("Rebuilding statement position cache")
     poslist = statementpositionid.split("-") if "-" in statementpositionid else (statementpositionid, statementpositionid)    
     syncStatsGeneric("statement_position", range(int(poslist[0]), int(poslist[1])+1), primarykey="position_id", 
                     querysql = "last_changed as time, position_id as id, statement_id as entity, 0 as sourceentity, topic_id as topic, axis_id as axis, position_no as position", 
                     )        
     getStatementFilter(None,None,None,None, None, deferred_recache=True)
     self.response.write("<html><body>Done rebuilding statement Cache</body></html>")
Example #2
0
 def any(self):
     orgactionstats = syncStatsGeneric("action_citation", None, primarykey="citation_id", 
                     querysql = "last_changed as time, citation_id as id, statement_id as entity, org_id as person, reaction",
                     dest = "orgactionreaction", wherenotnull="person", sourceview = "action_citation_featured", force=True
                     )
     for orgid in set([p["person"] for p in orgactionstats]):
         getOrg(orgid, AnyExisting, deferred_recache=True)                             
     authormpstats = syncStatsGeneric("action_citation", None, primarykey="citation_id", 
                     querysql = "last_changed as time, citation_id as id, statement_id as entity, mp_id as person, reaction",
                     dest = "authormotionreaction", wherenotnull="person", sourceview = "action_citation_detail", force=True
                     )
     for authormpid in set([p["person"] for p in authormpstats]):
         getAuthorData(authormpid, AnyExisting, deferred_recache=True)                             
Example #3
0
 def any(self,articlepositionid):
     posrange = articlepositionid.split("-") if "-" in articlepositionid else (articlepositionid, articlepositionid)  
     syncStatsGeneric("article_position", range(int(posrange[0]), int(posrange[1])+1) , primarykey="position_id", 
                     querysql = "last_changed as time, position_id as id, article_id as entity, 0 as sourceentity, topic_id as topic, axis_id as axis, position_no as position", 
                     )        
     getTopicArticleHistory(None, deferred_recache=True)
     for topicid in query(DEFAULTFEED, "distinct exec topic from articleposition where id within (%s;%s)" % (int(posrange[0]),int(posrange[1])+1)):
         topic = getById(model.Topic, topicid)
         if topic is not None:
             for atopic in topic.parenttopics:
                 getTopicArticleHistory(atopic, deferred_recache=True)
                 getPositionAxis(atopic, deferred_recache=True)
             getTopicArticleHistory( topic, deferred_recache=True)
Example #4
0
 def any(self,citationid):
     poslist = citationid.split("-") if "-" in citationid else (citationid, citationid)    
     orgactionstats = syncStatsGeneric("action_citation", range(int(poslist[0]), int(poslist[1])+1), primarykey="citation_id", 
                     querysql = "last_changed as time, citation_id as id, statement_id as entity, org_id as person, reaction",
                     dest = "orgactionreaction", wherenotnull="person", sourceview = "action_citation_featured"
                     )
     for orgid in set([p["person"] for p in orgactionstats]):
         getOrg(orgid, AnyExisting, deferred_recache=True)                             
     authormpstats = syncStatsGeneric("action_citation", range(int(poslist[0]), int(poslist[1])+1), primarykey="citation_id", 
                     querysql = "last_changed as time, citation_id as id, statement_id as entity, mp_id as person, reaction",
                     dest = "authormotionreaction", wherenotnull="person", sourceview = "action_citation_detail"
                     )
     for authormpid in set([p["person"] for p in authormpstats]):
         getAuthorData(authormpid, AnyExisting, deferred_recache=True)                             
Example #5
0
 def any(self):
     partystats = syncStatsGeneric("reaction_citation", None, primarykey="citation_id", 
                     querysql = "last_changed as time, citation_id as id, statement_id as entity, campaign_id as person, reaction",
                     dest = "campaignstatementreaction", wherenotnull="person", force=True
                     )             
     for partyid in set([p["person"] for p in partystats]):
         getPartyData(partyid, AnyExisting, deferred_recache=True)                             
     commentatorstats = syncStatsGeneric("reaction_citation", None, primarykey="citation_id", 
                     querysql = "last_changed as time, citation_id as id, statement_id as entity, party_id as person, reaction",
                     dest = "partystatementreaction", wherenotnull="person", force=True
                     )
     for commentatorid in set([p["person"] for p in commentatorstats]):
         getAuthorData(commentatorid, AnyExisting, deferred_recache=True)                             
     campaignstats = syncStatsGeneric("reaction_citation", None, primarykey="citation_id", 
                     querysql = "last_changed as time, citation_id as id, statement_id as entity, commentator_id as person, reaction",
                     dest = "authorstatementreaction", wherenotnull="person", force=True
                     )             
Example #6
0
 def any(self,citationid):
     poslist = citationid.split("-") if "-" in citationid else (citationid, citationid)    
     partystats = syncStatsGeneric("reaction_citation", range(int(poslist[0]), int(poslist[1])+1), primarykey="citation_id", 
                     querysql = "last_changed as time, citation_id as id, statement_id as entity, party_id as person, reaction",
                     dest = "partystatementreaction", wherenotnull="person"
                     )
     for partyid in set([p["person"] for p in partystats]):
         getPartyData(partyid, AnyExisting, deferred_recache=True)                             
     commentatorstats = syncStatsGeneric("reaction_citation", range(int(poslist[0]), int(poslist[1])+1), primarykey="citation_id", 
                     querysql = "last_changed as time, citation_id as id, statement_id as entity, commentator_id as person, reaction",
                     dest = "authorstatementreaction", wherenotnull="person"
                     )                           
     for commentatorid in set([p["person"] for p in commentatorstats]):
         getAuthorData(commentatorid, AnyExisting, deferred_recache=True)                             
     campaignstats = syncStatsGeneric("reaction_citation", range(int(poslist[0]), int(poslist[1])+1), primarykey="citation_id", 
                     querysql = "last_changed as time, citation_id as id, statement_id as entity, campaign_id as person, reaction",
                     dest = "campaignstatementreaction", wherenotnull="person"
                     )                                    
Example #7
0
    def any(self, articleid):
        if "-" in articleid:
            articleid=articleid.split("-")[0]
        
        row = queryObject( "article", key=articleid)
        if row is None:
            logging.error( "article does not exist" )
            return
                    
        fields=[search.TextField(name='headline', value=row["headline"]),
            search.TextField(name='typ', value="article")]
        document = search.Document(
            doc_id=unicode("article"+str(row['article_id'])),
            fields=fields,
            language='en')
        DOCUMENT_INDEX.put([document,], deadline=None)
        
#Need to discuss what we are doing with 'onsite' now that we no longer have any article pages on site

        syncStatsGeneric("article", range(row['article_id'], row['article_id']+1) , primarykey="article_id",
                        querysql ="publish_date as time, article_id as id, source_id as source, author_id as author, true as onsite", 
                        )        
        getArticle(articleid, deferred_recache=True)
        getArticleSummary(articleid, deferred_recache=True)
Example #8
0
 def any(self):
     syncStatsGeneric("article", None, primarykey="article_id", force=True, remember=False, batch=30000, limit=10000000, skiptableflush=True,
                     querysql = "publish_date as time, article_id as id, source_id as source, author_id as author, false as onsite", 
                     )        
Example #9
0
def rebuildAllClients():
    syncStatsGeneric("client", None, primarykey="client_id", force=True, commalist="statementids", sourceview="client_depth",
                        querysql = "last_changed as time, client_id as id, topicstatement_ids as statementids"
                        )      
Example #10
0
 def any(self):
     syncStatsGeneric("motion_vote", None,  
                     querysql = "last_changed as time, vote_id as id, motion_id as entity, author_id as person, reaction", 
                     dest = "authormotionreaction", batch = 2000, primarykey="vote_id", force=True)
Example #11
0
 def any(self):
     syncStatsGeneric("article_position", None, primarykey="position_id", force=True, remember=False, batch=30000, limit=10000000, skiptableflush=True,
                     querysql = "last_changed as time, position_id as id, article_id as entity, 0 as sourceentity, topic_id as topic, axis_id as axis, position_no as position", 
                     )        
Example #12
0
 def any(self,authorpositionid):
     poslist = authorpositionid.split("-") if "-" in authorpositionid else (authorpositionid, authorpositionid)    
     syncStatsGeneric("author_position", range(int(poslist[0]), int(poslist[1])+1), primarykey="position_id", 
                     querysql = "last_changed as time, position_id as id, author_id as entity, 0 as sourceentity, topic_id as topic, axis_id as axis, position_no as position", 
                     )        
     self.response.write("<html><body>Done rebuilding Author position Cache</body></html>")
Example #13
0
 def any(self):
     syncStatsGeneric("statement_position", None, primarykey="position_id", force=True, sourceview="statement_position_active",
                     querysql = "last_changed as time, position_id as id, statement_id as entity, 0 as sourceentity, topic_id as topic, axis_id as axis, position_no as position", 
                     )