分享

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

本帖最后由 yuwenge 于 2015-6-9 16:02 编辑

问题导读

1.纵横小说数据库设计思路是什么?
2.四张表用来做什么的?
3.表novelchapter存储什么的?









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

设计思路
      对于纵横中文小说网的四个采集类,我们将设计四张表来存储相关的信息。表crawllist主要存储采集的入口,存储着采集的地址、采集状态和采集频率;表novelinfo存储由更新列表页采集程序得到的url,并通过简介页采集程序将其他的信息更新完整;表novelchapter存储由章节列表采集程序得到的信息;表novelchapterdetail存储由小说阅读页采集程序得到的信息。表novelchapterdetail的信息可以合并到表novelchapter中,但这里为了以后的拓展需要,特意将其分开。
      在这些表中,添加一个state字段,该字段标识这该项目下的url是否需要采集,这个字段是实现分布式采集的关键所在。

表设计图

20150513160544062.png



sql文
[mw_shl_code=bash,true]/*  
Navicat MySQL Data Transfer  
  
Source Server         : 本机数据库  
Source Server Version : 50151  
Source Host           : localhost:3306  
Source Database       : novel  
  
Target Server Type    : MYSQL  
Target Server Version : 50151  
File Encoding         : 65001  
  
Date: 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;  [/mw_shl_code]



相关内容:
基于lucene的案例开发1:lucene初始认知

基于lucene的案例开发2:索引数学模型

基于lucene的案例开发3:索引文件结构

基于lucene的案例开发4:创建索引

基于lucene的案例开发5:搜索索引

基于lucene的案例开发6:分词器介绍

基于lucene的案例开发7:Query查询

基于lucene的案例开发8:IndexSearcher中检索方法

基于lucene的案例开发9:案例初识

基于lucene的案例开发10:搜索后台基础,JsonUtil & XmlUtil类介绍

基于lucene的案例开发11:项目常用类ClassUtil & CharsetUtil介绍

基于lucene的案例开发12:数据库连接池

基于lucene的案例开发13:实现实时索引基本原理

基于lucene的案例开发14:实时索引管理类IndexManager

基于lucene的案例开发15:实时索引的检索

基于lucene的案例开发16:实时索引的修改

基于lucene的案例开发17:查询语句创建PackQuery

基于lucene的案例开发18:纵横小说更新列表页抓取

基于lucene的案例开发19:纵横小说简介页采集

基于lucene的案例开发20:纵横小说章节列表采集

基于lucene的案例开发21:纵横小说阅读页采集




出处:http://blog.csdn.net/xiaojimanman/article/details/45694049

已有(1)人评论

跳转到指定楼层
tang 发表于 2015-6-10 10:13:10
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条