我现在使用的是一个已经搭建好的solr环境下进行的测试:

第一步,需要配置solrhome中的一个配置文件schema.xml

配置内容如下,上面配置的是IK分词器,下面是配置完成的域.

因为我在这个需要使用的solr进行全文检索的只有这几个重要的字段.

然后内容如下:

    <!-- IKAnalyzer-->
<fieldType name="text_ik" class="solr.TextField">
<analyzer class="org.wltea.analyzer.lucene.IKAnalyzer"/>
</fieldType>
<!--IKAnalyzer Field-->
<field name="content_ik" type="text_ik" indexed="true" stored="true" />
<!--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"/>
<field name="item_goodsid" type="long" indexed="true" stored="true"/>
<field name="item_title" type="text_ik" indexed="true" stored="true"/>
<field name="item_price" type="double" indexed="true" stored="true"/>
<field name="item_image" type="string" indexed="false" stored="true" />
<field name="item_category" type="string" indexed="true" stored="true" />
<field name="item_seller" type="text_ik" indexed="true" stored="true" />
<field name="item_brand" type="string" indexed="true" stored="true" />
<field name="item_updatetime" type="date" indexed="true" stored="true" />
<!--复制域-->
<field name="item_keywords" type="text_ik" indexed="true" stored="false" multiValued="true"/>
<copyField source="item_title" dest="item_keywords"/>
<copyField source="item_category" dest="item_keywords"/>
<copyField source="item_seller" dest="item_keywords"/>
<copyField source="item_brand" dest="item_keywords"/>
<!--当我们需要动态扩充字段时,我们需要使用动态域-->
<dynamicField name="item_spec_*" type="string" indexed="true" stored="true" />

为什么要配置域?

  域相当于数据库的表字段,用户存放数据,因此用户根据业务需要去定义相关的Field(域),一般来说,每一种对应着一种数据,用户对同一种数据进行相同的操作.

域的常用属性:

  • name:指定域的名称
  • type:指定域的类型
  • indexed:是否索引
  • stored:是否存储
  • required:是否必须
  • multiValued:是否多值

复制域的作用是什么?

复制域的作用在于将某一个Field中的数据复制到另一个域中.

动态域的作用是什么?

  当我们需要动态扩充字段时,我们需要使用动态域.

使用solr进行配置文件的更多相关文章

  1. solr与.net系列课程(二)solr的配置文件及其含义

    solr与.net系列课程(二)solr的配置文件及其含义  本节内容还是不会涉及到.net与数据库的内容,但是不要着急,这都是学时solr必学要掌握的东西,solr可不是像其他的dll文件一样,只需 ...

  2. zookeeper管理solr的配置文件

    zookeeper可以管理solr和其他软件的配置文件.配置文件还是保存在linux服务器的磁盘上,但是不是改变solr读取solr/home配置的配置文件的位置. 现在solr/home配置文件的位 ...

  3. solr的配置文件及其含义

    solr与.net系列课程(二)solr的配置文件及其含义    solr与.net系列课程(二)solr的配置文件及其含义  本节内容还是不会涉及到.net与数据库的内容,但是不要着急,这都是学时s ...

  4. springboot+solr

    整合完DB层,cache层,开始整合solr. 注入SolrClient, package hello.configuration; import java.net.MalformedURLExcep ...

  5. 04 Apache Solr: 目录结构

         通过前面的介绍,我们已经能够看到管理员界面并对Solr形成了一个感性的认识.本篇将在物理上深入了解Solr的安装目录结构和Solr示例的主目录结构.   安装目录结构 Solr 6.3.0安 ...

  6. Solr初始化源码分析-Solr初始化与启动

    用solr做项目已经有一年有余,但都是使用层面,只是利用solr现有机制,修改参数,然后监控调优,从没有对solr进行源码级别的研究.但是,最近手头的一个项目,让我感觉必须把solrn内部原理和扩展机 ...

  7. 【Solr】Solr的安装部署

    目录 Solr安装部署 Solr Web界面分析 回到顶部 solr安装和部署 solr下载 http://lucene.apache.org/ 安装solr,就是去部署它的war包,war包所在的位 ...

  8. 基于Solr的HBase多条件查询测试

    背景: 某电信项目中采用HBase来存储用户终端明细数据,供前台页面即时查询.HBase无可置疑拥有其优势,但其本身只对rowkey支持毫秒级 的快 速检索,对于多字段的组合查询却无能为力.针对HBa ...

  9. Solr Cloud搭建

    1:搭建tomcat 配置connector: server.xm文件中: <Connector port="8080"maxThreads="200" ...

随机推荐

  1. 4e00~9fa5

    <script> function init (){ var begin = 0x4e00; var end = 0x9fa5; var str = ''; for(var a=begin ...

  2. vue.js学习资料

    vue.js学习VuejsAPI教程 https://vuejs.org.cn/guide/Vuejs自己的构建工具 http://www.jianshu.com/p/f8e21d87a572如何用v ...

  3. 14 CSS题目附答案

    转载自公众号:web前端开发  原文题目:45道CSS基础面试题(附答案) 1. 介绍一下标准的CSS的盒子模型?与低版本IE的盒子模型有什么不同的? 标准盒子模型:宽度=内容的宽度(content) ...

  4. js获取谷歌浏览器版本 和 js分辨不同浏览器

    // 获取谷歌版本 function getChromeVersion() { var arr = navigator.userAgent.split(' '); var chromeVersion ...

  5. 学习完HTML后的5大测试题----9.18

    考试题目   第一题: 布局出该效果 提示:使用DIV的border样式,调整边框粗细出现该效果,保留上边框,其它三个方向的边框需设置:border-left:100px solid transpar ...

  6. 关于maven的CoreException: Could not get the value for parameter compilerId for plugin 。。的错误

    在Eclipse中使用 Alt+F5 快捷键,在弹出的Update Maven Project对话框中选择报错的Maven工程,勾选下图中的 Force Update of Snapshots/Rel ...

  7. 强类型Dataset使用事务(改进原有方法)

    以下部份转自:http://blog.csdn.net/nfbing/article/details/5803980 关于强类型Dataset的用法和好处,我就不再多说,网上关于这方面的资料很多 , ...

  8. python全栈开发 * 31知识点汇总 * 180716

    31 模块和包一.模块(一)模块的种类:内置模块,自定义模块,扩展模块第三方模块(二)自定义模块 1.模块的创建 : 新建一个py文件. 2.模块名 : 模块名需要符合变量的命名规范. 3.模块的导入 ...

  9. 带你开发一款给Apk中自动注入代码工具icodetools(完善篇)【申明:来源于网络】

    带你开发一款给Apk中自动注入代码工具icodetools(完善篇)[申明:来源于网络] 带你开发一款给Apk中自动注入代码工具icodetools(完善篇):http://blog.csdn.net ...

  10. ELK之安装了search guard认证后安装elasticsearch-head

    安装searc guard参考https://www.cnblogs.com/minseo/p/10576126.html 安装elasticsearch-head参考 https://www.cnb ...