基于lucene的案例开发:纵横小说数据库设计

转载请注明出处:

个人博客站已经上线了,网址 ~欢迎各位吐槽~————————————————————————————————-

首先和大家说一声抱歉,由于最近公司和个人的原因,博客停更已经有一个月了,最近自己会慢慢的恢复博客的更新。

在前面的几篇中已经介绍了纵横中文小说网的采集,这篇博客就介绍下数据库的设计。

设计思路

对于纵横中文小说网的四个采集类,我们将设计四张表来存储相关的信息。表crawllist主要存储采集的入口,存储着采集的地址、采集状态和采集频率;表novelinfo存储由更新列表页采集程序得到的url,并通过简介页采集程序将其他的信息更新完整;表novelchapter存储由章节列表采集程序得到的信息;表novelchapterdetail存储由小说阅读页采集程序得到的信息。表novelchapterdetail的信息可以合并到表novelchapter中,但这里为了以后的拓展需要,特意将其分开。

在这些表中,添加一个state字段,该字段标识这该项目下的url是否需要采集,,这个字段是实现分布式采集的关键所在。

表设计图

sql文

/*Navicat MySQL Data TransferSource Server: 本机数据库Source Server Version : 50151Source Host: localhost:3306Source Database: novelTarget Server Type : MYSQLTarget Server Version : 50151File Encoding: 65001Date: 2015-05-13 15:37:35*/SET FOREIGN_KEY_CHECKS=0;– —————————— Table structure for `crawllist` 小说采集入口– —————————-DROP TABLE IF EXISTS `crawllist`;CREATE TABLE `crawllist` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `url` varchar(100) NOT NULL,##采集url `state` enum('1','0') NOT NULL,##采集状态 `info` varchar(100) DEFAULT NULL,##描述 `frequency` int(11) DEFAULT '60',##采集频率 PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;– —————————— Table structure for `novelchapter` 小说章节信息– —————————-DROP TABLE IF EXISTS `novelchapter`;CREATE TABLE `novelchapter` ( `id` varchar(32) NOT NULL, `url` varchar(100) NOT NULL,##阅读页URL `title` varchar(50) DEFAULT NULL,##章节名 `wordcount` int(11) DEFAULT NULL,##字数 `chapterid` int(11) DEFAULT NULL,##章节排序 `chaptertime` bigint(20) DEFAULT NULL,##章节时间 `createtime` bigint(20) DEFAULT NULL,##创建时间 `state` enum('1','0') NOT NULL,##采集状态 PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;– —————————— Table structure for `novelchapterdetail` 小说章节详细信息– —————————-DROP TABLE IF EXISTS `novelchapterdetail`;CREATE TABLE `novelchapterdetail` ( `id` varchar(32) NOT NULL, `url` varchar(100) NOT NULL,##阅读页url `title` varchar(50) DEFAULT NULL,##章节标题 `wordcount` int(11) DEFAULT NULL,##字数 `chapterid` int(11) DEFAULT NULL,##章节排序 `content` text,##正文 `chaptertime` bigint(20) DEFAULT NULL,##章节时间 `createtime` bigint(20) DEFAULT NULL,##创建时间 `updatetime` bigint(20) DEFAULT NULL,##最后更新时间 PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;– —————————— Table structure for `novelinfo` 小说简介信息– —————————-DROP TABLE IF EXISTS `novelinfo`;CREATE TABLE `novelinfo` ( `id` varchar(32) NOT NULL, `url` varchar(100) NOT NULL,##简介页url `name` varchar(50) DEFAULT NULL,##小说名 `author` varchar(30) DEFAULT NULL,##作者名 `description` text,##小说简介 `type` varchar(20) DEFAULT NULL,##分类 `lastchapter` varchar(100) DEFAULT NULL,##最新章节名 `chaptercount` int(11) DEFAULT NULL,##章节数 `chapterlisturl` varchar(100) DEFAULT NULL,##章节列表页url `wordcount` int(11) DEFAULT NULL,##字数 `keywords` varchar(100) DEFAULT NULL,##关键字 `createtime` bigint(20) DEFAULT NULL,##创建时间 `updatetime` bigint(20) DEFAULT NULL,##最后更新时间 `state` enum('1','0') NOT NULL,##采集状态 PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;—————————————————————————————————-ps:最近发现其他网站可能会对博客转载,上面并没有源链接,如想查看更多关于 基于lucene的案例开发 请点击这里。或访问网址 或

时光的消化是这样的缓慢。虽然这也仅仅是无处可说的委屈。而不是痛苦。

基于lucene的案例开发:纵横小说数据库设计

相关文章:

你感兴趣的文章:

标签云: