欢迎来到沃文网! | 帮助中心 分享知识,传播智慧!
沃文网
全部分类
  • 教学课件>
  • 医学资料>
  • 技术资料>
  • 学术论文>
  • 资格考试>
  • 建筑施工>
  • 实用文档>
  • 其他资料>
  • ImageVerifierCode 换一换
    首页 沃文网 > 资源分类 > DOC文档下载
    分享到微信 分享到微博 分享到QQ空间

    基于Luncene的compass框架详解java.doc

    • 资源ID:1039001       资源大小:386.90KB        全文页数:29页
    • 资源格式: DOC        下载积分:10积分
    快捷下载 游客一键下载
    账号登录下载
    微信登录下载
    三方登录下载: QQ登录 微博登录
    二维码
    微信扫一扫登录
    下载资源需要10积分
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP,下载更划算!
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    基于Luncene的compass框架详解java.doc

    1、目录一、原理描述:二、术语解释:三、下载地址:四、使用流程: .五、基于SSH的compass的实例: 一、原理描述:Compass是一流的开放源码JAVA搜索引擎框架,对于你的应用修饰,搜索引擎语义更具有能力。依靠顶级的Lucene搜索引擎,Compass 结合了,像 Hibernate和 Spring的流行的框架,为你的应用提供了从数据模型和数据源同步改变的搜索力.并且添加了2方面的特征,事物管理和快速更新优化. Compass的目标是:把java应用简单集成到搜索引擎中.编码更少,查找数据更便捷 .二、术语解释:名称描述Lucene Apache Lucene是一个基于Java全文搜索引

    2、擎,利用它可以轻易地为Java软件加入全文搜寻功能。Lucene的最主要工作是替文件的每一个字作索引,索引让搜寻的效率比传统的逐字比较大大提高了,Lucene提供一组解读,过滤,分析文件,编排和使用索引的提供一组解读,过滤,分析文件,编排和使用索引的API,它的强大之处除了高效和简单外,是最重要的是使使用都是可以随时应自己需要自订其功能。开发者可以把Lucene看成一个支持全文索引的数据库系统的.Compass我对Compass的定义是面向域模型的搜索框架, 面向域模型意味着必须支持对对象的搜索,对持久化对象的搜索,和对XML文档对象的搜索,同时还必须支持事务的处理,包括对创建,更新,保存,删

    3、除进行事务级别的处理. 所以, Compass是基于Lucene, 高于Lucene的. 有个形象的比喻. Compass对于Lucene就像Hibernate对于JDBC,太有才了!Compass的开发路数完全参照Hibernate.OSEM对象搜索引擎影射(Object Search Engine Mapping),通过xml配置文件,提供了POJOs (Plain Old Java Objects)到搜索引擎.三、下载地址:软件名称下载地址软件描述Compass框架、jar包passframework.org/基于Java的搜索引擎四、使用流程:网络机器人程序www文档网络机器人程序建立

    4、索引从数据库中搜索信息Tomcat服务器JSP 索引数据库浏览器浏览器五、基于SSH的compass的实例:step1 在ssh2的基础上开发 加入jar包(compass-2.1.2.jar compass-index-patch.jar lucene-analyzers-2.4.0.jar lucene-core-2.4.0.jar lucene-highlighter-2.4.0.jar paoding-analysis.jar ) step2 先来看下实体bean的编写 Java代码 1. packagecom.v512.example.model; 2. importpass.ann

    5、otations.*; 3. /* 4. *Productentity. 5. * 6. *authorMyEclipsePersistenceTools 7. */8. Searchable9. publicclassProductimplementsjava.io.Serializable 10. 11. /Fields 12. 13. SearchableId14. privateStringid; 15. SearchableProperty(name=name,index=Index.ANALYZED,store=Store.YES) 16. privateStringname; 1

    6、7. SearchableProperty(name=price,index=Index.NOT_ANALYZED,store=Store.YES) 18. privateDoubleprice; 19. SearchableProperty(name=brand,index=Index.ANALYZED,store=Store.YES) 20. privateStringbrand; 21. SearchableProperty(name=description,index=Index.ANALYZED,store=Store.YES) 22. privateStringdescriptio

    7、n; 23. 24. /Constructors 25. 26. /*defaultconstructor*/27. publicProduct() 28. 29. 30. /*fullconstructor*/31. publicProduct(Stringname,Doubleprice,Stringbrand,Stringdescription) 32. this.name=name; 33. this.price=price; 34. this.brand=brand; 35. this.description=description; 36. 37. 38. /Propertyacc

    8、essors 39. 40. publicStringgetId() 41. returnthis.id; 42. 43. 44. publicvoidsetId(Stringid) 45. this.id=id; 46. 47. 48. publicStringgetName() 49. returnthis.name; 50. 51. 52. publicvoidsetName(Stringname) 53. this.name=name; 54. 55. 56. publicDoublegetPrice() 57. returnthis.price; 58. 59. 60. public

    9、voidsetPrice(Doubleprice) 61. this.price=price; 62. 63. 64. publicStringgetBrand() 65. returnthis.brand; 66. 67. 68. publicvoidsetBrand(Stringbrand) 69. this.brand=brand; 70. 71. 72. publicStringgetDescription() 73. returnthis.description; 74. 75. 76. publicvoidsetDescription(Stringdescription) 77.

    10、this.description=description; 78. 79. 80. package com.v512.example.model;import pass.annotations.*;/* * Product entity. * * author MyEclipse Persistence Tools */Searchablepublic class Product implements java.io.Serializable / FieldsSearchableIdprivate String id;SearchableProperty(name=name,index=Ind

    11、ex.ANALYZED,store=Store.YES)private String name;SearchableProperty(name=price,index=Index.NOT_ANALYZED,store=Store.YES)private Double price;SearchableProperty(name=brand,index=Index.ANALYZED,store=Store.YES)private String brand;SearchableProperty(name=description,index=Index.ANALYZED,store=Store.YES

    12、)private String description;/ Constructors/* default constructor */public Product() /* full constructor */public Product(String name, Double price, String brand, String description) this.name = name;this.price = price;this.brand = brand;this.description = description;/ Property accessorspublic Strin

    13、g getId() return this.id;public void setId(String id) this.id = id;public String getName() return this.name;public void setName(String name) this.name = name;public Double getPrice() return this.price;public void setPrice(Double price) this.price = price;public String getBrand() return this.brand;pu

    14、blic void setBrand(String brand) this.brand = brand;public String getDescription() return this.description;public void setDescription(String description) this.description = description;step3属性文件Product.hbm.xml Java代码 1. 2. !DOCTYPEhibernate-mappingPUBLIC-/Hibernate/HibernateMappingDTD3.0/EN3. 4. 7.

    15、8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. !DOCTYPE hibernate-mapping PUBLIC -/Hibernate/Hibernate Mapping DTD 3.0/EN 要使用Compass必须加入一个applicationContext-compass.xml文件,文件名可以自行定义 这个就不用说了 废话 step4applicationContext-compass.xml: Java代码 1. 2. 3. 7. 8. 9. 11. 12. 13. 14. 15.

    16、 16. 17. 18. classpath:com/v512/example/model 19. 20. 21. 22. 23. /lucene/indexes 24. 25. 26. 27. 28. 29. com.v512.example.model.Product 30. 31. 32. 34. 35. 36. 37. 38. 39. pass.spring.transaction.SpringSyncTransactionFactory 40. 41. net.paoding.analysis.analyzer.PaodingAnalyzer 42. 43. 44. 45. 46.

    17、47. 48. 49. 51. 52. hibernateDevice 53. 54. 55. 56. true 57. 58. 59. 60. 62. 63. 64. 65. 67. 68. 69. 70. 71. 72. 73. 74. 76. 77. 78. 79. 80. 83. 84. 85. 86. 87. 88. 89. 90. classpath:com/v512/example/model /lucene/indexes com.v512.example.model.Product pass.spring.transaction.SpringSyncTransactionFa

    18、ctory net.paoding.analysis.analyzer.PaodingAnalyzer hibernateDevicetrue中间都有注解 就不多解释了 下面来编写dao及dao的实现以及severce层 step5 Java代码 1. packagecom.v512.example.dao; 2. 3. importjava.util.List; 4. 5. importcom.v512.example.model.Product; 6. 7. publicinterfaceProductDao 8. publicvoidcreate(Productp); 9. publicProductgetProduct(Stringid); 10. publicListgetProducts(); 11. publicvoidupdate(Productproduct); 12. publicvoidremove(Stringid); 13. 14. package com.v512.example.dao;import java.util.List;import com.v512.example.model.Product;public interface ProductDao public void create(Product p);publ


    注意事项

    本文(基于Luncene的compass框架详解java.doc)为本站会员(星星)主动上传,沃文网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知沃文网(点击联系客服),我们立即给予删除!




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服点击这里,给沃文网发消息,QQ:2622162128 - 联系我们

    版权声明:以上文章中所选用的图片及文字来源于网络以及用户投稿,由于未联系到知识产权人或未发现有关知识产权的登记,如有知识产权人并不愿意我们使用,如有侵权请立即联系:2622162128@qq.com ,我们立即下架或删除。

    Copyright© 2022-2024 www.wodocx.com ,All Rights Reserved |陕ICP备19002583号-1

    陕公网安备 61072602000132号     违法和不良信息举报:0916-4228922