JavaWeb索引框架————Solr

1、什么是Solr
Solr 是Apache下的一个顶级开源项目,采用Java开发,它是基于Lucene的全文搜索服务器。Solr提供了比Lucene更为丰富的查询语言,同时实现了可配置、可扩展,并对索引、搜索性能进行了优化。
Solr可以独立运行,运行在Jetty、Tomcat等这些Servlet容器中,Solr 索引的实现方法很简单,用 POST 方法向 Solr 服务器发送一个描述 Field 及其内容的 XML 文档,Solr根据xml文档添加、删除、更新索引 。Solr 搜索只需要发送 HTTP GET 请求,然后对 Solr 返回Xml、json等格式的查询结果进行解析,组织页面布局。Solr不提供构建UI的功能,Solr提供了一个管理界面,通过管理界面可以查询Solr的配置和运行情况。

Solr与Lucene的区别:
Lucene是一个开放源代码的全文检索引擎工具包,它不是一个完整的全文检索引擎,Lucene提供了完整的查询引擎和索引引擎,目的是为软件开发人员提供一个简单易用的工具包,以方便的在目标系统中实现全文检索的功能,或者以Lucene为基础构建全文检索引擎。
Solr的目标是打造一款企业级的搜索引擎系统,它是一个搜索引擎服务,可以独立运行,通过Solr可以非常快速的构建企业的搜索引擎,通过Solr也可以高效的完成站内搜索功能。
这里写图片描述
2、Solr安装及配置
2.1 Solr的下载
从Solr官方网站(http://lucene.apache.org/solr/ )下载Solr4.10.3,根据Solr的运行环境,Linux下需要下载lucene-4.10.3.tgz,windows下需要下载lucene-4.10.3.zip
Solr使用指南可参考:`https://wiki.apache.org/solr/FrontPage
2.2 Solr的文件夹结构

将solr-4.10.3.zip解压:
这里写图片描述

bin:solr的运行脚本
contrib:solr的一些贡献软件/插件,用于增强solr的功能。
dist:该目录包含build过程中产生的war和jar文件,以及相关的依赖文件。
docs:solr的API文档
example:solr工程的例子目录:
example/solr:
该目录是一个包含了默认配置信息的Solr的Core目录。
example/multicore:
该目录包含了在Solr的multicore中设置的多个Core目录。
example/webapps:
该目录中包括一个solr.war,该war可作为solr的运行实例工程。
licenses:solr相关的一些许可信息

2.3 运行环境
solr 需要运行在一个Servlet容器中,Solr4.10.3要求jdk使用1.7以上,Solr默认提供Jetty(java写的Servlet容器),实际生产中使用Tocmat作为Servlet容器,环境如下:

Solr:Solr4.10.3
Jdk:jdk1.7.0_72
Tomcat:apache-tomcat-7.0.53
2.4 Solr整合tomcat
2.4.1 Solr Home与SolrCore
创建一个Solr home目录,SolrHome是Solr运行的主目录,目录中包括了运行Solr实例所有的配置文件和数据文件,Solr实例就是SolrCore,一个SolrHome可以包括多个SolrCore(Solr实例),每个SolrCore提供单独的搜索和索引服务。

example\solr是一个solr home目录结构,如下:
这里写图片描述
上图中“collection1”是一个SolrCore(Solr实例)目录 ,目录内容如下所示:
这里写图片描述
说明:
collection1:叫做一个Solr运行实例SolrCore,SolrCore名称不固定,一个solr运行实例对外单独提供索引和搜索接口。
solrHome中可以创建多个solr运行实例SolrCore。
一个solr的运行实例对应一个索引目录。
conf是SolrCore的配置文件目录 。
data目录存放索引文件需要创建
2.4.2 整合步骤
第一步:安装tomcat。D:\temp\apache-tomcat-7.0.53
第二步:把solr的war包复制到tomcat 的webapp目录下。
把\solr-4.10.3\dist\solr-4.10.3.war复制到D:\temp\apache-tomcat-7.0.53\webapps下。
改名为solr.war
第三步:solr.war解压。使用压缩工具解压或者启动tomcat自动解压。解压之后删除solr.war
第四步:把\solr-4.10.3\example\lib\ext目录下的所有的jar包添加到solr工程中
第五步:配置solrHome和solrCore。
1)创建一个solrhome(存放solr所有配置文件的一个文件夹)。\solr-4.10.3\example\solr目录就是一个标准的solrhome。
2)把\solr-4.10.3\example\solr文件夹复制到D:\temp\0108路径下,改名为solrhome,改名不是必须的,是为了便于理解。
3)在solrhome下有一个文件夹叫做collection1这就是一个solrcore。就是一个solr的实例。一个solrcore相当于mysql中一个数据库。Solrcore之间是相互隔离。

i.在solrcore中有一个文件夹叫做conf,包含了索引solr实例的配置信息。
ii.在conf文件夹下有一个solrconfig.xml。配置实例的相关信息。如果使用默认配置可以不用做任何修改。

Xml的配置信息:
Lib:solr服务依赖的扩展包,默认的路径是collection1\lib文件夹,如果没有 就创建一个
dataDir:配置了索引库的存放路径。默认路径是collection1\data文件夹,如 果没有data文件夹,会自动创建。
requestHandler:
这里写图片描述
这里写图片描述
第六步:告诉solr服务器配置文件也就是solrHome的位置。修改web.xml使用jndi的方式告诉solr服务器。
Solr/home名称必须是固定的。
这里写图片描述
第七步:启动tomcat
第八步:访问http://localhost:8080/solr/
2.5 Solr后台管理
2.5.1 管理界面
这里写图片描述
2.5.2.Dashboard
仪表盘,显示了该Solr实例开始启动运行的时间、版本、系统资源、jvm等信息。
2.5.3.Logging
Solr运行日志信息
2.5.4.Cloud
Cloud即SolrCloud,即Solr云(集群),当使用Solr Cloud模式运行时会显示此菜单,如下图是Solr Cloud的管理界面:
这里写图片描述
2.5.5.Core Admin
Solr Core的管理界面。Solr Core 是Solr的一个独立运行实例单位,它可以对外提供索引和搜索服务,一个Solr工程可以运行多个SolrCore(Solr实例),一个Core对应一个索引目录。

添加solrcore:
第一步:复制collection1改名为collection2
第二步:修改core.properties。name=collection2
第三步:重启tomcat
2.5.6.java properties
Solr在JVM 运行环境中的属性信息,包括类路径、文件编码、jvm内存设置等信息。
2.5.7.Tread Dump
显示Solr Server中当前活跃线程信息,同时也可以跟踪线程运行栈信息。
2.5.8.Core selector
选择一个SolrCore进行详细操作,如下:
这里写图片描述
2.5.9 Analysis
这里写图片描述
2.5.10.Dataimport
可以定义数据导入处理器,从关系数据库将数据导入 到Solr索引库中。
2.5.11.Document
通过此菜单可以创建索引、更新索引、删除索引等操作,界面如下:
这里写图片描述
/update表示更新索引,solr默认根据id(唯一约束)域来更新Document的内容,如果根据id值搜索不到id域则会执行添加操作,如果找到则更新
2.5.12.Query
这里写图片描述
通过/select执行搜索索引,必须指定“q”查询条件方可搜索。
2.6.配置中文分析器
2.6.1.Schema.xml
schema.xml,在SolrCore的conf目录下,它是Solr数据表配置文件,它定义了加入索引的数据的数据类型的。主要包括FieldTypes、Fields和其他的一些缺省设置。
这里写图片描述
FieldType域类型定义
下边“text_general”是Solr默认提供的FieldType,通过它说明FieldType定义的内容:
这里写图片描述
FieldType子结点包括:name,class,positionIncrementGap等一些参数:
name:是这个FieldType的名称
class:是Solr提供的包solr.TextField,solr.TextField 允许用户通过分析器来定制索引和查询,分析器包括一个分词器(tokenizer)和多个过滤器(filter)
positionIncrementGap:可选属性,定义在同一个文档中此类型数据的空白间隔,避免短语匹配错误,此值相当于Lucene的短语查询设置slop值,根据经验设置为100。

在FieldType定义的时候最重要的就是定义这个类型的数据在建立索引和进行查询的时候要使用的分析器analyzer,包括分词和过滤

索引分析器中:使用solr.StandardTokenizerFactory标准分词器,solr.StopFilterFactory停用词过滤器,solr.LowerCaseFilterFactory小写过滤器。
搜索分析器中:使用solr.StandardTokenizerFactory标准分词器,solr.StopFilterFactory停用词过滤器,这里还用到了solr.SynonymFilterFactory同义词过滤器。
Field定义
在fields结点内定义具体的Field,filed定义包括name,type(为之前定义过的各种FieldType),indexed(是否被索引),stored(是否被储存),multiValued(是否存储多个值)等属性。如下:

<field name="name" type="text_general" indexed="true" stored="true"/>
<field name="features" type="text_general" indexed="true" stored="true" multiValued="true"/>

multiValued:该Field如果要存储多个值时设置为true,solr允许一个Field存储多个值,比如存储一个用户的好友id(多个),商品的图片(多个,大图和小图),通过使用solr查询要看出返回给客户端是数组:
这里写图片描述
uniqueKey
Solr中默认定义唯一主键key为id域,如下:
这里写图片描述
**Solr在删除、更新索引时使用id域进行判断,也可以自定义唯一主键。
注意在创建索引时必须指定唯一约束。**
copyField复制域
copyField复制域,可以将多个Field复制到一个Field中,以便进行统一的检索:
比如,输入关键字搜索title标题内容content,
定义title、content、text的域:
这里写图片描述
根据关键字只搜索text域的内容就相当于搜索title和content,将title和content复制到text中,如下:
这里写图片描述
dynamicField(动态字段)
动态字段就是不用指定具体的名称,只要定义字段名称的规则,例如定义一个 dynamicField,name 为*_i,定义它的type为text,那么在使用这个字段的时候,任何以_i结尾的字段都被认为是符合这个定义的,例如:name_i,gender_i,school_i等。

自定义Field名为:product_title_t,“product_title_t”和scheam.xml中的dynamicField规则匹配成功,如下:
这里写图片描述
“product_title_t”是以“_t”结尾。

创建索引:
这里写图片描述
搜索索引:
这里写图片描述
2.6.2 安装中文分词器

使用IKAnalyzer中文分析器。

第一步:把IKAnalyzer2012FF_u1.jar添加到solr/WEB-INF/lib目录下。
第二步:复制IKAnalyzer的配置文件和自定义词典和停用词词典到solr的classpath下。
第三步:在schema.xml中添加一个自定义的fieldType,使用中文分析器。

<!-- IKAnalyzer-->
    <fieldType name="text_ik" class="solr.TextField">
      <analyzer class="org.wltea.analyzer.lucene.IKAnalyzer"/>
    </fieldType>

第四步:定义field,指定field的type属性为text_ik

<!--IKAnalyzer Field-->
   <field name="title_ik" type="text_ik" indexed="true" stored="true" />
   <field name="content_ik" type="text_ik" indexed="true" stored="false" multiValued="true"/>

第四步:重启tomcat
测试:
这里写图片描述
2.7 设置业务系统Field
如果不使用Solr提供的Field可以针对具体的业务需要自定义一套Field,如下是商品信息Field:

<!--product-->
   <field name="product_name" type="text_ik" indexed="true" stored="true"/>
   <field name="product_price"  type="float" indexed="true" stored="true"/>
   <field name="product_description" type="text_ik" indexed="true" stored="false" />
   <field name="product_picture" type="string" indexed="false" stored="true" />
   <field name="product_catalog_name" type="string" indexed="true" stored="true" />

   <field name="product_keywords" type="text_ik" indexed="true" stored="false" multiValued="true"/>
   <copyField source="product_name" dest="product_keywords"/>
   <copyField source="product_description" dest="product_keywords"/>

3、Solr管理索引库
3.1.添加/更新文档
添加或更新单个文档
这里写图片描述
3.2.批量导入数据
使用dataimport插件批量导入数据。
第一步:把dataimport插件依赖的jar包添加到solrcore(collection1\lib)中
这里写图片描述
还需要mysql的数据库驱动。

第二步:配置solrconfig.xml文件,添加一个requestHandler。

<requestHandler name="/dataimport" 
class="org.apache.solr.handler.dataimport.DataImportHandler">
    <lst name="defaults">
      <str name="config">data-config.xml</str>
     </lst>
  </requestHandler> 

第三步:创建一个data-config.xml,保存到collection1\conf\目录下

<?xml version="1.0" encoding="UTF-8" ?>  
<dataConfig>   
<dataSource type="JdbcDataSource"   
          driver="com.mysql.jdbc.Driver"   
          url="jdbc:mysql://localhost:3306/lucene"   
          user="root"   
          password="root"/>   
<document>   
    <entity name="product" query="SELECT pid,name,catalog_name,price,description,picture FROM products ">
         <field column="pid" name="id"/> 
         <field column="name" name="product_name"/> 
         <field column="catalog_name" name="product_catalog_name"/> 
         <field column="price" name="product_price"/> 
         <field column="description" name="product_description"/> 
         <field column="picture" name="product_picture"/> 
    </entity>   
</document>   

</dataConfig>

第四步:重启tomcat
这里写图片描述
第五步:点击“execute”按钮导入数据
导入数据前会先清空索引库,然后再导入。

3.3 删除文档

删除索引格式如下:

1) 删除制定ID的索引

<delete>
    <id>8</id>
</delete>
<commit/>

2) 删除查询到的索引数据

<delete>
    <query>product_catalog_name:幽默杂货</query>
</delete>

3) 删除所有索引数据

<delete>
    <query>*:*</query>
</delete>

查询索引

通过/select搜索索引,Solr制定一些参数完成不同需求的搜索:

1.q - 查询字符串,必须的,如果查询所有使用:
这里写图片描述
2.fq - (filter query)过虑查询,作用:在q查询符合结果中同时是fq查询符合的,例如::
这里写图片描述
过滤查询价格从1到20的记录。
也可以在“q”查询条件中使用product_price:[1 TO 20],如下:
这里写图片描述
也可以使用“*”表示无限,例如:
20以上:product_price:[20 TO *]
20以下:product_price:[* TO 20]

3、sort - 排序,格式:sort=<field name>+<desc|asc>[,<field name>+<desc|asc>]… 。示例:
这里写图片描述按价格降序

4.start - 分页显示使用,开始记录下标,从0开始
5.rows - 指定返回结果最多有多少条记录,配合start来实现分页。
这里写图片描述
6.fl - 指定返回那些字段内容,用逗号或空格分隔多个。
这里写图片描述
显示商品图片、商品名称、商品价格
7.df-指定一个搜索Field
这里写图片描述
也可以在SolrCore目录 中conf/solrconfig.xml文件中指定默认搜索Field,指定后就可以直接在“q”查询条件中输入关键字。
这里写图片描述
8.wt - (writer type)指定输出格式,可以有 xml, json, php, phps, 后面 solr 1.3增加的,要用通知我们,因为默认没有打开。
9.hl 是否高亮 ,设置高亮Field,设置格式前缀和后缀。
这里写图片描述
4、使用SolrJ管理索引库

什么是solrJ
solrj是访问Solr服务的java客户端,提供索引和搜索的请求方法,SolrJ通常在嵌入在业务系统中,通过SolrJ的API接口操作Solr服务,如下图:
这里写图片描述
依赖的jar包
这里写图片描述
添加文档

1.1.实现步骤
第一步:创建一个java工程
第二步:导入jar包。包括solrJ的jar包。还需要
这里写图片描述
第三步:和Solr服务器建立连接。HttpSolrServer对象建立连接。
第四步:创建一个SolrInputDocument对象,然后添加域。
第五步:将SolrInputDocument添加到索引库。
第六步:提交。
1.2 代码实现

/向索引库中添加索引
    @Test
    public void addDocument() throws Exception {
        //和solr服务器创建连接
        //参数:solr服务器的地址
        SolrServer solrServer = new HttpSolrServer("http://localhost:8080/solr");
        //创建一个文档对象
        SolrInputDocument document = new SolrInputDocument();
        //向文档中添加域
        //第一个参数:域的名称,域的名称必须是在schema.xml中定义的
        //第二个参数:域的值
        document.addField("id", "c0001");
        document.addField("title_ik", "使用solrJ添加的文档");
        document.addField("content_ik", "文档的内容");
        document.addField("product_name", "商品名称");
        //把document对象添加到索引库中
        solrServer.add(document);
        //提交修改
        solrServer.commit();

    }

删除文档
根据id删除

//删除文档,根据id删除
    @Test
    public void deleteDocumentByid() throws Exception {
        //创建连接
        SolrServer solrServer = new HttpSolrServer("http://localhost:8080/solr");
        //根据id删除文档
        solrServer.deleteById("c0001");
        //提交修改
        solrServer.commit();
    }

根据查询删除
查询语法完全支持Lucene的查询语法。

//根据查询条件删除文档
    @Test
    public void deleteDocumentByQuery() throws Exception {
        //创建连接
        SolrServer solrServer = new HttpSolrServer("http://localhost:8080/solr");
        //根据查询条件删除文档
        solrServer.deleteByQuery("*:*");
        //提交修改
        solrServer.commit();
    }

修改文档
在solrJ中修改没有对应的update方法,只有add方法,只需要添加一条新的文档,和被修改的文档id一致就,可以修改了。本质上就是先删除后添加。

查询文档

简单查询

//查询索引
    @Test
    public void queryIndex() throws Exception {
        //创建连接
        SolrServer solrServer = new HttpSolrServer("http://localhost:8080/solr");
        //创建一个query对象
        SolrQuery query = new SolrQuery();
        //设置查询条件
        query.setQuery("*:*");
        //执行查询
        QueryResponse queryResponse = solrServer.query(query);
        //取查询结果
        SolrDocumentList solrDocumentList = queryResponse.getResults();
        //共查询到商品数量
        System.out.println("共查询到商品数量:" + solrDocumentList.getNumFound());
        //遍历查询的结果
        for (SolrDocument solrDocument : solrDocumentList) {
            System.out.println(solrDocument.get("id"));
            System.out.println(solrDocument.get("product_name"));
            System.out.println(solrDocument.get("product_price"));
            System.out.println(solrDocument.get("product_catalog_name"));
            System.out.println(solrDocument.get("product_picture"));

        }
    }

复杂查询
其中包含查询、过滤、分页、排序、高亮显示等处理。

//复杂查询索引
    @Test
    public void queryIndex2() throws Exception {
        //创建连接
        SolrServer solrServer = new HttpSolrServer("http://localhost:8080/solr");
        //创建一个query对象
        SolrQuery query = new SolrQuery();
        //设置查询条件
        query.setQuery("钻石");
        //过滤条件
        query.setFilterQueries("product_catalog_name:幽默杂货");
        //排序条件
        query.setSort("product_price", ORDER.asc);
        //分页处理
        query.setStart(0);
        query.setRows(10);
        //结果中域的列表
        query.setFields("id","product_name","product_price","product_catalog_name","product_picture");
        //设置默认搜索域
        query.set("df", "product_keywords");
        //高亮显示
        query.setHighlight(true);
        //高亮显示的域
        query.addHighlightField("product_name");
        //高亮显示的前缀
        query.setHighlightSimplePre("<em>");
        //高亮显示的后缀
        query.setHighlightSimplePost("</em>");
        //执行查询
        QueryResponse queryResponse = solrServer.query(query);
        //取查询结果
        SolrDocumentList solrDocumentList = queryResponse.getResults();
        //共查询到商品数量
        System.out.println("共查询到商品数量:" + solrDocumentList.getNumFound());
        //遍历查询的结果
        for (SolrDocument solrDocument : solrDocumentList) {
            System.out.println(solrDocument.get("id"));
            //取高亮显示
            String productName = "";
            Map<String, Map<String, List<String>>> highlighting = queryResponse.getHighlighting();
            List<String> list = highlighting.get(solrDocument.get("id")).get("product_name");
            //判断是否有高亮内容
            if (null != list) {
                productName = list.get(0);
            } else {
                productName = (String) solrDocument.get("product_name");
            }

            System.out.println(productName);
            System.out.println(solrDocument.get("product_price"));
            System.out.println(solrDocument.get("product_catalog_name"));
            System.out.println(solrDocument.get("product_picture"));

        }
    }

5、案例实现

a)原型分析
这里写图片描述
b)系统架构
这里写图片描述
c)工程搭建
创建一个web工程导入jar包
1、springmvc的相关jar包
2、solrJ的jar包
3、Example\lib\ext下的jar包
5.1.1.springmvc.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">

    <context:component-scan base-package="com.itheima.jd"/>
    <!-- 配置注解驱动,如果配置此标签可以不用配置处理器映射器和适配器 -->
    <mvc:annotation-driven/>
        <!-- 配置视图解析器 -->
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/jsp/"/>
        <property name="suffix" value=".jsp"/>
    </bean>
    <!-- SolrServer的配置 -->
    <bean id="httpSolrServer" class="org.apache.solr.client.solrj.impl.HttpSolrServer">
        <constructor-arg index="0" value="http://localhost:8080/solr"/>
    </bean>
</beans>

5.1.2.web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>solr-jd</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <!-- 配置前段控制器 -->
  <servlet>
    <servlet-name>springmvc</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <!-- 指定springmvc配置文件的路径 
            如果不指定默认为:/WEB-INF/${servlet-name}-servlet.xml
        -->
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:springmvc.xml</param-value>
    </init-param>
  </servlet>
  <servlet-mapping>
    <servlet-name>springmvc</servlet-name>
    <url-pattern>*.action</url-pattern>
  </servlet-mapping>
  <!-- 解决post乱码问题 -->
  <filter>
        <filter-name>CharacterEncodingFilter</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>utf-8</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>CharacterEncodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>

d)Dao

功能:接收service层传递过来的参数,根据参数查询索引库,返回查询结果。
参数:SolrQuery对象
返回值:一个商品列表List。
方法定义:public List getResultModelFromSolr(QueryVo vo) throws Exception;

商品对象模型:

public class ProductModel {
    // 商品编号
    private String pid;
    // 商品名称
    private String name;
    // 商品分类名称
    private String catalog_name;
    // 价格
    private float price;
    // 商品描述
    private String description;
    // 图片名称
    private String picture;
}
@Repository
public class SolrDaoImpl implements SolrDao {
    @Autowired
    private SolrServer solrServer;

    public List<ProductModel> getResultModelFromSolr(QueryVo vo) throws Exception{
        SolrQuery solrQuery = new SolrQuery();
        //关键词
        if(null != vo.getQueryString() && !"".equals(vo.getQueryString())){
            solrQuery.setQuery(vo.getQueryString());
            solrQuery.set("df", "product_keywords");

        }
        //商品类型
        if(null != vo.getCatalog_name() && !"".equals(vo.getCatalog_name().trim())){
            solrQuery.addFilterQuery("product_catalog_name:" + vo.getCatalog_name());
        }
        //价格
        if(null != vo.getPrice() && !"".equals(vo.getPrice().trim())){
            String[] split = vo.getPrice().split("-");
            if(split.length == 2){
                solrQuery.addFilterQuery("product_price:[" + split[0] + " TO " + split[1] + "]");
            }else{
                solrQuery.addFilterQuery("product_price:[" + split[0] + " TO *]");
            }
        }
        //价格排序
        if("1".equals(vo.getSort())){
            solrQuery.setSort("product_price", ORDER.desc);
        }else{
            solrQuery.setSort("product_price", ORDER.asc);
        }

        //显示的域
        //solrQuery.setFields("id,product_name,product_price");

        //1:设置高亮开关
        solrQuery.setHighlight(true);
        //2:需要高亮的域
        solrQuery.addHighlightField("product_name");
        //3:高亮的简单样式  前缀
        solrQuery.setHighlightSimplePre("<span style='color:red'>");
        //4:高亮的简单样式 后缀
        solrQuery.setHighlightSimplePost("</span>");
        QueryResponse response = solrServer.query(solrQuery);
        //取出高亮
        Map<String, Map<String, List<String>>> highlighting = response.getHighlighting();

        //取出结果集
        SolrDocumentList docs = response.getResults();
        //打印总条数
        System.out.println("总条数:" + docs.getNumFound());
        //结果集
        List<ProductModel> productModels = new ArrayList<ProductModel>();
        //閬嶅巻
        for (SolrDocument doc : docs) {

            ProductModel productModel = new ProductModel();
            //ID
            String id = (String) doc.get("id");
            productModel.setPid(id);
            //
            Map<String, List<String>> map = highlighting.get(id);
            List<String> list = map.get("product_name");
            //判断高亮必须不为空
            if(null != list && list.size() > 0){
                String name = list.get(0);
                productModel.setName(name);
            }
            //价格
            productModel.setPrice((float) doc.get("product_price"));
            //商品图片
            productModel.setPicture((String) doc.get("product_picture"));
            //商品类型
            productModel.setCatalog_name((String) doc.get("product_catalog_name"));

            productModels.add(productModel);
        }
        return productModels;
    }

}

e)Service

功能:接收action传递过来的参数,根据参数拼装一个查询条件,调用dao层方法,查询商品列表。接收返回的商品列表和商品的总数量,根据每页显示的商品数量计算总页数。
参数:
1、查询条件:字符串
2、商品分类的过滤条件:商品的分类名称,字符串
3、商品价格区间:传递一个字符串,满足格式:“0-100、101-200、201-*”
4、排序条件:页面传递过来一个升序或者降序就可以,默认是价格排序。0:升序1:降序
5、分页信息:每页显示的记录条数创建一个常量60条。传递一个当前页码就可以了。
业务逻辑
1、根据参数创建查询对象
2、调用dao执行查询。
3、根据总记录数计算总页数。
返回值:ResultModel

方法定义:ResultModel queryProduct(String queryString, String caltalog_name, String price, String sort, Integer page) throws Exception;

@Service
public class SolrServiceImpl implements SolrService {


    @Autowired
    private SolrDao solrDao;
    public List<ProductModel> getResultModelFromSolr(QueryVo vo) throws Exception {
        return solrDao.getResultModelFromSolr(vo);
    }

}

f)controller

功能:接收页面传递过来的参数调用service查询商品列表。将查询结果返回给jsp页面,还需要查询参数的回显。

参数:
1、查询条件:字符串
2、商品分类的过滤条件:商品的分类名称,字符串
3、商品价格区间:传递一个字符串,满足格式:“0-100、101-200、201-*”
4、排序条件:页面传递过来一个升序或者降序就可以,默认是价格排序。0:升序1:降序
5、分页信息:每页显示的记录条数创建一个常量60条。传递一个当前页码就可以了。
6、Model:相当于request。

返回结果:String类型,就是一个jsp的名称。

public class QueryVo {

    //关键词
    private String queryString;
    //过滤条件 商品类型
    //价格区间
    private String catalog_name;
    private String price;
    //排序  1 正   0倒
    private String sort;
/**
 * 商品搜索
 * @author lx
 *
 */
@Controller
public class ProductController {

    @Autowired
    SolrService solrService;
    //搜索
    @RequestMapping("/list.action")
    public String list(QueryVo vo,Model model) throws Exception{
        //结果集
        List<ProductModel> productList = solrService.getResultModelFromSolr(vo);
        model.addAttribute("productList", productList);
        model.addAttribute("catalog_name", vo.getCatalog_name());
        model.addAttribute("price", vo.getPrice());
        model.addAttribute("sort", vo.getSort());
        model.addAttribute("queryString", vo.getQueryString());
        return "product_list";
    }
}

g)Jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<!-- saved from url=(0047)http://list.jd.com/list.html?cat=1315,1343,1355 -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content="utf-8" http-equiv="charset">
<link rel="stylesheet" type="text/css"
    href="<c:url value='/resource'/>/base.css" media="all">
<link rel="stylesheet" type="text/css"
    href="<c:url value='/resource'/>/plist20131112.css" media="all">
<link rel="stylesheet" type="text/css"
    href="<c:url value='/resource'/>/list-page-20141009.css" media="all">
<link rel="stylesheet" type="text/css"
    href="<c:url value='/resource'/>/pop_compare.css" media="all">
<link rel="shortcut icon" type="image/ico"
    href="http://list.jd.com/favicon.ico">
<script type="text/javascript"
    src="<c:url value='/resource'/>/jquery-1.2.6.pack.js"></script>
<style id="style-1-cropbar-clipper">/* Copyright 2014 Evernote Corporation. All rights reserved. */
.en-markup-crop-options {
    top: 18px !important;
    left: 50% !important;
    margin-left: -100px !important;
    width: 200px !important;
    border: 2px rgba(255,255,255,.38) solid !important;
    border-radius: 4px !important;
}

.en-markup-crop-options div div:first-of-type {
    margin-left: 0px !important;
}
</style>
<script type="text/javascript">
    function query() {
        //执行关键词查询时清空过滤条件
        document.getElementById("catalog_name").value="";
        document.getElementById("price").value="";
        document.getElementById("page").value="";
        //执行查询
        queryList();
    }
    function queryList() {
        //提交表单
        document.getElementById("actionForm").submit();
    }
    function filter(key, value) {
        document.getElementById(key).value=value;
        queryList();
    }
    function sort() {
        var s = document.getElementById("sort").value;
        if (s != "1") {
            s = "1";
        } else {
            s = "0";
        }
        document.getElementById("sort").value = s;
        queryList();
    }
    function changePage(p) {
        var curpage = Number(document.getElementById("page").value);
        curpage = curpage + p;
        document.getElementById("page").value = curpage;
        queryList();
    }
</script>
</head>
<body class="root61">
<div id="shortcut-2013">
    <div class="w">
        <ul class="fl lh">
            <li class="fore1 ld"><b></b><a href="#" rel="nofollow">收藏京东</a></li>
        </ul>
        <ul class="fr lh">
            <li class="fore1" id="loginbar">您好,欢迎来到京东!<span><a href="#">[登录]</a> <a href="#" class="link-regist">[免费注册]</a></span></li>
            <li class="fore2 ld">
                <s></s>
                <a href="#" rel="nofollow">我的订单</a>
            </li>
            <li class="fore2-1 ld" id="jd-vip"><i></i>
                <i></i>
                <s></s>
                <a target="_blank" rel="nofollow" href="http://vip.jd.com/">会员俱乐部</a>
            </li>
            <li class="fore2-2 ld" id="jd-dakehu">        <i></i><s></s>        <a href="http://b.jd.com/" target="_blank" rel="nofollow">企业频道</a>    </li>
            <li class="fore3 ld menu" id="app-jd" data-widget="dropdown" clstag="homepage|keycount|home2013|01d"><s></s>
                <i></i>
                <span class="outline"></span>
                <span class="blank"></span>
                <a href="http://app.jd.com/" target="_blank">手机京东</a>
                <b></b>
            </li>
            <li class="fore4 ld menu" id="biz-service" data-widget="dropdown">
                <s></s>
                <span class="outline"></span>
                <span class="blank"></span>
                客户服务
                <b></b>
            </li>
            <li class="fore5 ld menu" id="site-nav" data-widget="dropdown">
                <s></s>
                <span class="outline"></span>
                <span class="blank"></span>
                网站导航
                <b></b>
            </li>
        </ul>
        <span class="clr"></span>
    </div>
</div><!--shortcut end-->
<div id="o-header-2013">
    <div class="w" id="header-2013">
        <div id="logo-2013" class="ld"><a href="http://www.jd.com/" hidefocus="true"><b></b><img src="<c:url value='/resource'/>/logo-201305.png" width="270" height="60" alt="京东"></a></div>
        <!--logo end-->
        <div id="search-2013">
            <div class="i-search ld">
                <ul id="shelper" class="hide"></ul>
                <form id="actionForm" action="list.action" method="POST">
                <div class="form">
                    <input type="text" class="text" accesskey="s" name="queryString" id="key" value="${queryString }"
                        autocomplete="off" onkeydown="javascript:if(event.keyCode==13) {query()}">
                    <input type="button" value="搜索" class="button" onclick="query()">
                </div>
                <input type="hidden" name="catalog_name" id="catalog_name" value="${catalog_name }"/> 
                <input type="hidden" name="price" id="price" value="${price }"/> 
                <input type="hidden" name="sort" id="sort" value="${sort }"/> 
                </form>
            </div>
            <div id="hotwords"></div>
        </div>
        <!--search end-->
        <div id="my360buy-2013">
            <dl>
                <dt class="ld"><s></s><a href="http://home.jd.com/">我的京东</a><b></b></dt>
                <dd>
                    <div class="loading-style1"><b></b>加载中,请稍候...</div>
                </dd>
            </dl>
        </div>
        <!--my360buy end-->
        <div id="settleup-2013">
            <dl>
                <dt class="ld"><s></s><span class="shopping"><span id="shopping-amount">0</span></span><a href="http://cart.jd.com/cart/cart.html" id="settleup-url">去购物车结算</a> <b></b> </dt>
                <dd>
                    <div class="prompt">
                        <div class="loading-style1"><b></b>加载中,请稍候...</div>
                    </div>
                </dd>
            </dl>
        </div>
        <!--settleup end-->
    </div>
    <!--header end-->
    <div class="w">
        <div id="nav-2013">
            <div id="categorys-2013" class="categorys-2014">
                <div class="mt ld">
                    <h2><a href="http://www.jd.com/allSort.aspx">全部商品分类<b></b></a></h2>
                </div>
            </div>
            <div id="treasure"></div>
            <ul id="navitems-2013">
                <li class="fore1" id="nav-home"><a href="http://www.jd.com/">首页</a></li>
                <li class="fore2" id="nav-fashion"><a href="http://fashion.jd.com/">服装城</a></li>
                <li class="fore3" id="nav-chaoshi"><a href="http://channel.jd.com/chaoshi.html">食品</a></li>
                <li class="fore4" id="nav-tuan"><a href="http://tuan.jd.com/" target="_blank">团购</a></li>
                <li class="fore5" id="nav-auction"><a href="http://auction.jd.com/">夺宝岛</a></li>
                <li class="fore6" id="nav-shan"><a href="http://red.jd.com/">闪购</a></li>
                <li class="fore7" id="nav-jinrong"><a href="http://jr.jd.com/" target="_blank">金融</a></li>
            </ul>
        </div>
    </div>
</div>
<div class="w">
    <div class="breadcrumb">
        <strong><a href="#">服饰内衣</a></strong><span>&nbsp;&gt;&nbsp;<a
            href="#">女装</a>&nbsp;&gt;&nbsp;<a href="#">T恤</a></span>
    </div>
</div>
<div class="w main">
<div class="right-extra">
<div id="select" clstag="thirdtype|keycount|thirdtype|select" class="m">
    <div class="mt">
        <h1>
            T恤 -<strong>&nbsp;商品筛选</strong>
        </h1>
    </div>
    <div class="mc attrs">
        <div data-id="100001" class="brand-attr">
            <div class="attr">
                <div class="a-key">商品类别:</div>
                <div class="a-values">
                    <div class="v-tabs">
                        <div class="tabcon">
                            <div>
                                <a href="javascript:filter('catalog_name', '幽默杂货')" >幽默杂货</a>
                            </div>
                            <div>
                                <a href="javascript:filter('catalog_name', '时尚卫浴')">时尚卫浴</a>
                            </div>
                            <div>
                                <a href="javascript:filter('catalog_name', '另类文体')">另类文体</a>
                            </div>
                            <div>
                                <a href="javascript:filter('catalog_name', '创意相架')">创意相架</a>
                            </div>
                            <div>
                                <a href="javascript:filter('catalog_name', '巧妙收纳')">巧妙收纳</a>
                            </div>
                            <div>
                                <a href="javascript:filter('catalog_name', '与钟不同')">与钟不同</a>
                            </div>
                            <div>
                                <a href="javascript:filter('catalog_name', '个性男人')">个性男人</a>
                            </div>
                            <div>
                                <a href="javascript:filter('catalog_name', '电脑周边')">电脑周边</a>
                            </div>
                            <div>
                                <a href="javascript:filter('catalog_name', '品质家电')">品质家电</a>
                            </div>                                            
                            <div>                                             
                                <a href="javascript:filter('catalog_name', '品味茶杯')">品味茶杯</a>
                            </div>                                            
                            <div>                                             
                                <a href="javascript:filter('catalog_name', '四季用品')">四季用品</a>
                            </div>                                            
                            <div>                                             
                                <a href="javascript:filter('catalog_name', '健康宝宝')">健康宝宝</a>
                            </div>                                            
                            <div>                                             
                                <a href="javascript:filter('catalog_name', '新潮美容')">新潮美容</a>
                            </div>                                            
                            <div>                                             
                                <a href="javascript:filter('catalog_name', '产品配件')">产品配件</a>
                            </div>                                            
                            <div>                                             
                                <a href="javascript:filter('catalog_name', '雅致灯饰')">雅致灯饰</a>
                            </div>                                            
                            <div>                                             
                                <a href="javascript:filter('catalog_name', '阳光车饰')">阳光车饰</a>
                            </div>                                            
                            <div>                                             
                                <a href="javascript:filter('catalog_name', '趣味纸抽')">趣味纸抽</a>
                            </div>                                            
                            <div>                                             
                                <a href="javascript:filter('catalog_name', '布艺毛绒')">布艺毛绒</a>
                            </div>                                            
                            <div>                                             
                                <a href="javascript:filter('catalog_name', '益智手工')">益智手工</a>
                            </div>                                            
                            <div>                                             
                                <a href="javascript:filter('catalog_name', '环保餐具')">环保餐具</a>
                            </div>                                            
                            <div>                                             
                                <a href="javascript:filter('catalog_name', '闪亮匙扣')">闪亮匙扣</a>
                            </div>                                            
                            <div>                                             
                                <a href="javascript:filter('catalog_name', '手机饰品')">手机饰品</a>
                            </div>                                            
                            <div>                                             
                                <a href="javascript:filter('catalog_name', '精品数码')">精品数码</a>
                            </div>                                            
                            <div>                                             
                                <a href="javascript:filter('catalog_name', '理财钱罐')">理财钱罐</a>
                            </div>                                            
                            <div>                                             
                                <a href="javascript:filter('catalog_name', '美味厨房')">美味厨房</a>
                            </div>                                            
                            <div>                                             
                                <a href="javascript:filter('catalog_name', '保健按摩')">保健按摩</a>
                            </div>                                            
                            <div>                                             
                                <a href="javascript:filter('catalog_name', '魅力女人')">魅力女人</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div data-id="100002" class="prop-attrs">
            <div class="attr">
                <div class="a-key">价格:</div>
                <div class="a-values">
                    <div class="v-fold">
                        <ul class="f-list">
                            <li><a href="javascript:filter('price','0-9')">0-9</a></li>
                            <li><a href="javascript:filter('price','10-19')">10-19</a></li>
                            <li><a href="javascript:filter('price','20-29')">20-29</a></li>
                            <li><a href="javascript:filter('price','30-39')">30-39</a></li>
                            <li><a href="javascript:filter('price','40-49')">40-49</a></li>
                            <li><a href="javascript:filter('price','50-*')">50以上</a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div id="filter">
    <div class="cls"></div>
    <div class="fore1">
        <dl class="order">
            <dt>排序:</dt>
            <dd>
                <a href="javascript:sort()">价格</a><b></b>
            </dd>
        </dl>
        <dl class="activity">
            <dd></dd>
        </dl>
        <div class="pagin pagin-m">
            <span class="text"><i>1</i>/200</span>
            <a href="javascript:;" class="prev">上一页<b></b></a>
            <a href="javascript:;" class="next">下一页<b></b></a>
        </div>
        <div class="total">
            <span><strong>2000</strong>个商品
            </span>
        </div>
        <span class="clr"></span>
    </div>
</div>
<!--商品列表开始-->
<div id="plist" class="m plist-n7 plist-n8 prebuy">
    <ul class="list-h">
        <c:forEach var="item" items="${productModels }">
        <li pid="${item.pid }">
            <div class="lh-wrap">
                <div class="p-img">
                    <a target="_blank" href="#">
                        <img width="220" height="282" class="err-product" src="<c:url value='/images'/>/${item.picture}">
                    </a>
                </div>
                <div class="p-name">
                    <a target="_blank" href="#">${item.name }</a>
                </div>
                <div class="p-price">
                    <strong><fmt:formatNumber value="${item.price}" maxFractionDigits="2"/></strong><span id="p1269191543"></span>
                </div>
            </div>
        </li>
        </c:forEach>
    </ul>
</div>
<!--商品列表结束-->
</div>
<div class="left">
    <div id="sortlist" clstag="thirdtype|keycount|thirdtype|sortlist"
        class="m">
        <div class="mt">
            <h2>服饰内衣</h2>
        </div>
        <div class="mc">
            <div class="item current">
                <h3>
                    <b></b>女装
                </h3>
                <ul>
                    <li><a href="http://list.jd.com/1315-1343-1355.html">T恤</a></li>
                    <li><a href="http://list.jd.com/1315-1343-1354.html">衬衫</a></li>
                    <li><a href="http://list.jd.com/1315-1343-1356.html">针织衫</a></li>
                    <li><a href="http://list.jd.com/1315-1343-9713.html">雪纺衫</a></li>
                    <li><a href="http://list.jd.com/1315-1343-9710.html">卫衣</a></li>
                    <li><a href="http://list.jd.com/1315-1343-9714.html">马甲</a></li>
                    <li><a href="http://list.jd.com/1315-1343-9719.html">连衣裙</a></li>
                    <li><a href="http://list.jd.com/1315-1343-9720.html">半身裙</a></li>
                    <li><a href="http://list.jd.com/1315-1343-9715.html">牛仔裤</a></li>
                    <li><a href="http://list.jd.com/1315-1343-9717.html">休闲裤</a></li>
                    <li><a href="http://list.jd.com/1315-1343-9716.html">打底裤</a></li>
                    <li><a href="http://list.jd.com/1315-1343-9718.html">正装裤</a></li>
                    <li><a href="http://list.jd.com/1315-1343-9711.html">小西装</a></li>
                    <li><a href="http://list.jd.com/1315-1343-9712.html">短外套</a></li>
                    <li><a href="http://list.jd.com/1315-1343-9708.html">风衣</a></li>
                    <li><a href="http://list.jd.com/1315-1343-9706.html">毛呢大衣</a></li>
                    <li><a href="http://list.jd.com/1315-1343-9707.html">真皮皮衣</a></li>
                    <li><a href="http://list.jd.com/1315-1343-9705.html">棉服</a></li>
                    <li><a href="http://list.jd.com/1315-1343-3983.html">羽绒服</a></li>
                    <li><a href="http://list.jd.com/1315-1343-9722.html">大码女装</a></li>
                    <li><a href="http://list.jd.com/1315-1343-9721.html">中老年女装</a></li>
                    <li><a href="http://list.jd.com/1315-1343-9723.html">婚纱</a></li>
                    <li><a href="http://list.jd.com/1315-1343-11985.html">打底衫</a></li>
                    <li><a href="http://list.jd.com/1315-1343-11986.html">旗袍/唐装</a></li>
                    <li><a href="http://list.jd.com/1315-1343-11987.html">加绒裤</a></li>
                    <li><a href="http://list.jd.com/1315-1343-11988.html">吊带/背心</a></li>
                    <li><a href="http://list.jd.com/1315-1343-11989.html">羊绒衫</a></li>
                    <li><a href="http://list.jd.com/1315-1343-11991.html">短裤</a></li>
                    <li><a href="http://list.jd.com/1315-1343-11993.html">皮草</a></li>
                    <li><a href="http://list.jd.com/1315-1343-11996.html">礼服</a></li>
                    <li><a href="http://list.jd.com/1315-1343-11998.html">仿皮皮衣</a></li>
                    <li><a href="http://list.jd.com/1315-1343-11999.html">羊毛衫</a></li>
                    <li><a href="http://list.jd.com/1315-1343-12000.html">设计师/潮牌</a></li>
                </ul>
            </div>
            <div class="item">
                <h3>
                    <b></b>男装
                </h3>
            </div>
            <div class="item">
                <h3>
                    <b></b>内衣
                </h3>
            </div>
            <div class="item">
                <h3>
                    <b></b>服饰配件
                </h3>
            </div>
        </div>
    </div>
    <div id="limitBuy">
        <div id="limitbuy9199"
            clstag="thirdtype|keycount|thirdtype|limitbuy536"
            class="m limitbuy hide">
            <div class="mt">
                <h2>服饰鞋帽</h2>
            </div>
            <div class="mc">
                <div id="clock9199" class="clock">正在加载…</div>
                <div id="limit9199"></div>
            </div>
        </div>
    </div>
    <div id="ad_left" reco_id="6" class="m m0 hide"></div>
    <!--用户最终购买-->
    <div id="finalbuy" class="hide m m0" style="display: block;">
        <div class="mt">
            <h2>
                浏览<font color="red">T恤</font>最终购买
            </h2>
        </div>
        <div class="mc">
        </div>
    </div>
    <div id="weekRank" clstag="thirdtype|keycount|thirdtype|mrank"
        class="m rank">
        <div class="mt">
            <h2>一周销量排行</h2>
        </div>
        <div class="mc">
        </div>
    </div>
</div><!--<div class="left">-->

<span class="clr"></span>
<div id="Collect_Tip" class="Tip360 w260"></div>

</div><!--<div class="w main">-->


<div class="w">
    <div id="service-2013">
        <dl class="fore1">
            <dt><b></b><strong>购物指南</strong></dt>
            <dd>
                <div><a href="http://help.jd.com/help/question-56.html" target="_blank" rel="nofollow">购物流程</a></div>
                <div><a href="http://help.jd.com/help/question-57.html" target="_blank" rel="nofollow">会员介绍</a></div>
                <div><a href="http://help.jd.com/help/question-181.html" target="_blank" rel="nofollow">团购/机票</a></div>
                <div><a href="http://help.jd.com/help/question-61.html" target="_blank" rel="nofollow">常见问题</a></div>
                <div><a href="http://help.jd.com/help/question-63.html" target="_blank" rel="nofollow">大家电</a></div>
                <div><a href="http://help.jd.com/index.html" target="_blank" rel="nofollow">联系客服</a></div>
            </dd>
        </dl>
        <dl class="fore2">
            <dt><b></b><strong>配送方式</strong></dt>
            <dd>
                <div><a href="http://help.jd.com/help/question-64.html" target="_blank" rel="nofollow">上门自提</a></div>
                <div><a href="http://help.jd.com/help/question-360.html" target="_blank" rel="nofollow">211限时达</a></div>
                <div><a href="http://help.jd.com/help/distribution-768.html" target="_blank" rel="nofollow">配送服务查询</a></div>
                <div><a href="http://help.jd.com/help/question-892.html#help2215" target="_blank" rel="nofollow">配送费收取标准</a></div>

                <div><a href="http://en.jd.com/chinese.html" target="_blank">海外配送</a></div>
            </dd>
        </dl>
        <dl class="fore3">
            <dt><b></b><strong>支付方式</strong></dt>
            <dd>
                <div><a href="http://help.jd.com/help/question-67.html" target="_blank" rel="nofollow">货到付款</a></div>
                <div><a href="http://help.jd.com/help/question-68.html" target="_blank" rel="nofollow">在线支付</a></div>
                <div><a href="http://help.jd.com/help/question-71.html" target="_blank" rel="nofollow">分期付款</a></div>
                <div><a href="http://help.jd.com/help/question-69.html" target="_blank" rel="nofollow">邮局汇款</a></div>
                <div><a href="http://help.jd.com/help/question-70.html" target="_blank" rel="nofollow">公司转账</a></div>
            </dd>
        </dl>
        <dl class="fore4">
            <dt><b></b><strong>售后服务</strong></dt>
            <dd>
                <div><a href="http://myjd.jd.com/afs/help/afshelp.action" target="_blank" rel="nofollow">售后政策</a></div>
                <div><a href="http://help.jd.com/help/question-99.html" target="_blank" rel="nofollow">价格保护</a></div>
                <div><a href="http://help.jd.com/help/question-100.html" target="_blank" rel="nofollow">退款说明</a></div>
                <div><a href="http://myjd.jd.com/repair/repairs.action" target="_blank" rel="nofollow">返修/退换货</a></div>
                <div><a href="http://help.jd.com/help/question-881.html" target="_blank" rel="nofollow">取消订单</a></div>
            </dd>
        </dl>
        <dl class="fore5">
            <dt><b></b><strong>特色服务</strong></dt>
            <dd>
                <div><a href="http://help.jd.com/help/question-79.html" target="_blank">夺宝岛</a></div>
                <div><a href="http://help.jd.com/help/question-86.html" target="_blank">DIY装机</a></div>
                <div><a href="http://fuwu.jd.com/" target="_blank" rel="nofollow">延保服务</a></div>
                <div><a href="http://giftcard.jd.com/market/index.action" target="_blank" rel="nofollow">京东E卡</a></div>
                <div><a href="http://help.jd.com/help/question-91.html" target="_blank" rel="nofollow">节能补贴</a></div>
                <div><a href="http://mobile.jd.com/" target="_blank" rel="nofollow">京东通信</a></div>
            </dd>
        </dl>
        <span class="clr"></span>
    </div>
</div><!-- service end --><div class="w">
    <div id="footer-2013">
        <div class="links">
            <a rel="nofollow" target="_blank" href="http://www.jd.com/intro/about.aspx">关于我们</a>|<a rel="nofollow" target="_blank" href="http://www.jd.com/contact/">联系我们</a>|<a rel="nofollow" target="_blank" href="http://zhaopin.jd.com/">人才招聘</a>|<a rel="nofollow" target="_blank" href="http://www.jd.com/contact/joinin.aspx">商家入驻</a>|<a rel="nofollow" target="_blank" href="http://sale.jd.com/act/y3surX7qpM.html">广告服务</a>|<a rel="nofollow" target="_blank" href="http://app.jd.com/">手机京东</a>|<a target="_blank" href="http://club.jd.com/links.aspx">友情链接</a>|<a target="_blank" href="http://cps.jd.com/">销售联盟</a>|<a href="http://club.jd.com/" target="_blank">京东社区</a>|<a href="http://gongyi.jd.com/" target="_blank">京东公益</a></div>
        <div class="copyright">北京市公安局朝阳分局备案编号110105014669&nbsp;&nbsp;|&nbsp;&nbsp;京ICP证070359号&nbsp;&nbsp;|&nbsp;&nbsp;互联网药品信息服务资格证编号(京)-非经营性-2011-0034<br><a rel="nofollow" href="http://misc.360buyimg.com/skin/df/i/com/f_music.jpg" target="_blank">音像制品经营许可证苏宿批005号</a>|&nbsp;&nbsp;出版物经营许可证编号新出发(苏)批字第N-012号&nbsp;&nbsp;|&nbsp;&nbsp;互联网出版许可证编号新出网证(京)字150号<br><a href="http://misc.360buyimg.com/wz/wlwhjyxkz.jpg" target="_blank">网络文化经营许可证京网文[2011]0168-061号</a>Copyright&nbsp;©&nbsp;2004-2015&nbsp;&nbsp;京东JD.com&nbsp;版权所有<br>京东旗下网站:<a href="http://en.jd.com/" target="_blank">English Site</a></div>
        <div class="authentication"><a rel="nofollow" target="_blank" href="http://www.hd315.gov.cn/beian/view.asp?bianhao=010202007080200026"><img width="108" height="40" alt="经营性网站备案中心" src="<c:url value='/resource'/>/108_40_zZOKnl.gif" class="err-product"></a>
            <a rel="nofollow" target="_blank" tabindex="-1"
                href="https://ss.cnnic.cn/verifyseal.dll?sn=2008070300100000031&ct=df&pa=294005"
                id="urlknet"><img width="108" height="40" border="true"
                name="CNNIC_seal" alt="可信网站"
                src="<c:url value='/resource'/>/kxwz.gif"
                class="err-product"></a>
            <a rel="nofollow" target="_blank"
                href="http://www.bj.cyberpolice.cn/index.do"><img width="108"
                height="40" alt="朝阳网络警察"
                src="<c:url value='/resource'/>/cywljc.png"
                class="err-product"></a>
            <a rel="nofollow" target="_blank"
                href="https://search.szfw.org/cert/l/CX20120111001803001836"><img
                width="112" height="40"
                src="<c:url value='/resource'/>/112_40_WvArIl.png"
                class="err-product"></a>
        </div>
    </div>
</div>
</body>
</html>

说明:博客内容主要参考传智播客相关课程

猜你喜欢

转载自blog.csdn.net/Jorocco/article/details/80301009