Changeset 775:29909eb43528 in hatta-dev for hatta.py
Legend:
- Unmodified
- Added
- Removed
-
hatta.py
r773 r775 1401 1401 def update_words(self, title, text, cursor): 1402 1402 title_id = self.title_id(title, cursor) 1403 cursor.execute('DELETE FROM words WHERE page=?;', (title_id,)) 1404 if not text: 1405 return 1403 1406 words = self.count_words(self.split_text(text)) 1404 1407 title_words = self.count_words(self.split_text(title)) 1405 1408 for word, count in title_words.iteritems(): 1406 1409 words[word] = words.get(word, 0) + count 1407 cursor.execute('DELETE FROM words WHERE page=?;', (title_id,))1408 1410 for word, count in words.iteritems(): 1409 1411 cursor.execute('INSERT INTO words VALUES (?, ?, ?);', … … 1535 1537 text = get_text() 1536 1538 except NotFoundErr: 1537 text = u'' 1538 extract_links = getattr(page, 'extract_links', lambda x: []) 1539 if text: 1540 self.update_links(title, extract_links(text), cursor=cursor) 1541 self.update_words(title, text, cursor=cursor) 1539 text = None 1540 title_id = self.title_id(title, cursor) 1541 if not list(self.page_backlinks(title)): 1542 cursor.execute("DELETE FROM titles WHERE id=?;", (title_id,)) 1543 extract_links = getattr(page, 'extract_links', None) 1544 if extract_links and text: 1545 links = extract_links(text) 1546 else: 1547 links = [] 1548 self.update_links(title, links, cursor=cursor) 1549 self.update_words(title, text or u'', cursor=cursor) 1542 1550 1543 1551 def update_page(self, page, title, data=None, text=None):
Note: See TracChangeset
for help on using the changeset viewer.
