﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-我爱那只饼-随笔分类-JavaScript</title><link>http://www.cppblog.com/mildforest/category/15896.html</link><description>以后开始搞游戏开发了</description><language>zh-cn</language><lastBuildDate>Tue, 18 Jan 2011 09:39:02 GMT</lastBuildDate><pubDate>Tue, 18 Jan 2011 09:39:02 GMT</pubDate><ttl>60</ttl><item><title>python documentation 用jQuery实现的搜索功能代码分析</title><link>http://www.cppblog.com/mildforest/archive/2011/01/18/138766.html</link><dc:creator>Jokey Pretty</dc:creator><author>Jokey Pretty</author><pubDate>Tue, 18 Jan 2011 09:19:00 GMT</pubDate><guid>http://www.cppblog.com/mildforest/archive/2011/01/18/138766.html</guid><wfw:comment>http://www.cppblog.com/mildforest/comments/138766.html</wfw:comment><comments>http://www.cppblog.com/mildforest/archive/2011/01/18/138766.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/mildforest/comments/commentRss/138766.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/mildforest/services/trackbacks/138766.html</trackback:ping><description><![CDATA[前两天看python文档时候，看了下网页源代码，发现docs.python.org上的搜索功能竟然是用jQuery实现的，于是拜读了一下，豁然开朗，非常佩服。<br /><br />代码主要分成三个文件：<br /><ul><li><a href="http://docs.python.org/_static/searchtools.js">http://docs.python.org/_static/searchtools.js</a></li><li><a href="http://docs.python.org/searchindex.js">http://docs.python.org/searchindex.js</a></li><li><a href="http://docs.python.org/_static/doctools.js">http://docs.python.org/_static/doctools.js</a></li></ul>searchtools.js包括了搜索功能的主体，包括以下部分：<br /><ul><li>搜索模块 - Search类</li><li>生成搜索结果的摘要 - jQuery.makeSearchSummary</li><li>从单词中抽取词干 - PorterStemmer</li></ul>searchindex.js中包含的是已经编制好的文档索引，用Search.setIndex()方法引入。<br />doctools.js包含了一些辅助方法。<br /><br />最近对思维导图比较感兴趣，看代码的时候，用Xmind画了一个结构图，贴出来看看：<br /><br /><img src="http://www.cppblog.com/images/cppblog_com/mildforest/15895/o_pythonsearch.png" height="327" hspace="-1" vspace="-1" width="931" /><br /><br /><br /><img src ="http://www.cppblog.com/mildforest/aggbug/138766.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/mildforest/" target="_blank">Jokey Pretty</a> 2011-01-18 17:19 <a href="http://www.cppblog.com/mildforest/archive/2011/01/18/138766.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>