solr列子下载 Solr学习(二) Solr4.2.0IK Analyzer 2012 开场白: 本章简单讲述如何在solr中配置著名的 IK Analyzer 分词器。 本章建立在Solr学习(一) 基础上进行配置。 通过(一)的介绍,目前已经成功部署好单实例 solrtomcat 声明:描述的比较统繁琐,有偏
solr列子下载
Solr学习(二) Solr4.2.0+IK Analyzer 2012
开场白:
本章简单讲述如何在solr中配置著名的 IK Analyzer 分词器。
本章建立在 Solr学习(一) 基础上进行配置。
通过(一)的介绍,目前已经成功部署好单实例 solr+tomcat
声明:描述的比较笼统繁琐,有偏差的地方请大家毫不留情的拍砖
准备工作:
下载 “IK Analyzer 2012FF_hf1.zip”包。 详见:IK Analyzer中文分词器创始人 林良益 博客
名词解释:
IK源目录:解压缩“IK Analyzer 2012FF_hf1.zip”后得到的文件夹路径。解压缩后得到下图结构东东
IK三把刀:上图被选中的3个文件(IKAnalyzer.cfg.xml、IKAnalyzer2012FF_u1.jar、stopword.dic)
Tomcat :以下全部指 tomcat根目录。(例:E:\\apache-tomcat-6.0.35\\)。
开始生产
步骤1:将 IK三把刀”放入目录“...\Tomcat\webapps\solr\WEB-INF\lib”中,(注意!这里此时由于项目原来启动过一次,webapps下的“solr.war”包已经被成功发布部署成文“solr”文件夹了。所以这里是在solr文件内打开 WEB-INF\lib目录, 不然WAR包是不允许放入文件到特定目录)。
步骤2:开始设置IK分词器在“schema.xml”文件中的配置(schema.xml目录位置在 “...\Tomcat\solrapp\solr\collection1\conf”此处的 collection1 是默认的文件夹,有些朋友在先前配置时候会去改变此文件夹名称,请注意自行匹配);
打开schema.xml文件(尽量使用UE打开,防止乱码)在
<a target="_blank" href="http://item.taobao.com/item.htm?_u=gl4f5o5c437&id=39393009617"><span style="font-family:SimSun, 宋体, tahoma, arial, helvetica, sans-serif;font-size:14px;"><a target="_blank" href="http://item.taobao.com/item.htm?spm=a1z09.5.0.0.xZsiWo&id=23853332746&_u=tl4f5o5d7e5&qq-pf-to=pcqq.c2c"><fieldtype name="text_ik" class="solr.TextField"> <analyzer type="index" ismaxwordlength="false" class="org.wltea.analyzer.lucene.IKAnalyzer"></analyzer> <analyzer type="query" ismaxwordlength="true" class="org.wltea.analyzer.lucene.IKAnalyzer"></analyzer> </fieldtype></a></span></a>
这样就OK了。 增加了用 IK分词算法提供的字段类型。 (IK分词算法的其他扩展配置请自行参考IK算法的配置说明文档。在“IK三把刀”目录里头的PDF文件里有。)
测试阶段
可能一些朋友会想看看效果,确认一下IK分词器成功配置,接下来我们来尝试测试一下IK分词效果吧。
(看到此处的朋友,其实可以跳到看 schema.xml的具体字段说明文章去。 大概了解一下schema.xml是干嘛用的,不过不看也无妨,我们只是为了证明IK配置成功。)
我们在 schema.xml 文件里头。找到如下代码片段。(schema.xml文件在哪里?看步骤2 ...)
<a target="_blank" href="http://item.taobao.com/item.htm?_u=gl4f5o5c437&id=39393009617"></a><a target="_blank" href="http://item.taobao.com/item.htm?spm=a1z09.5.0.0.xZsiWo&id=23853332746&_u=tl4f5o5d7e5&qq-pf-to=pcqq.c2c"><field name="name" type="text_general" indexed="true" stored="true"></field></a>
意思是这里有一个字段标示名字叫做name,类型text_general,这个时候我们把类型改变成刚刚添加的IK类型text_ik; 变成:
<a target="_blank" href="http://item.taobao.com/item.htm?_u=gl4f5o5c437&id=39393009617"></a><a target="_blank" href="http://item.taobao.com/item.htm?spm=a1z09.5.0.0.xZsiWo&id=23853332746&_u=tl4f5o5d7e5&qq-pf-to=pcqq.c2c"><field name="name" type="text_ik" indexed="true" stored="true"></field> </a>
瞎扯:我想看到这里一些朋友应该就能明白schema.xml干嘛的吧。Schema.xml 就像一张很大很大的描述索引样子的表。里头有很多字段field,然后要定义字段的类型fieldType。在在field里头引用fieldType(有点springIOC的味道 - -..)。
启动tomcat ..
进入solr界面 http://localhost:8080/solr
新手可能对solr的界面还不熟悉。我这里截图说明下。
选择core (这里没有默认配置。要去选一个);我们这里选 collection1
然后再选择 analysis
这个是分词界面。
选择刚刚我们针对配置的 name 字段。 然后输入要分词的词语 “魔兽世界” ,点按钮 “analyse values”; 会发现出现了分词为 “魔兽”“世界”
我们再试试其他没有引用分词器的字段的分词效果。 我选择了 “content” 字段,出现的结果就是全字分词了(solr默认的一种分词方式)。
结束!!!
这里分词的多样化根据分词器来设定。。 个人喜欢使用IK Analyzer分词器;而且配置SOLR比较方便。

MySQLviewshavelimitations:1)Theydon'tsupportallSQLoperations,restrictingdatamanipulationthroughviewswithjoinsorsubqueries.2)Theycanimpactperformance,especiallywithcomplexqueriesorlargedatasets.3)Viewsdon'tstoredata,potentiallyleadingtooutdatedinforma

ProperusermanagementinMySQLiscrucialforenhancingsecurityandensuringefficientdatabaseoperation.1)UseCREATEUSERtoaddusers,specifyingconnectionsourcewith@'localhost'or@'%'.2)GrantspecificprivilegeswithGRANT,usingleastprivilegeprincipletominimizerisks.3)

MySQLdoesn'timposeahardlimitontriggers,butpracticalfactorsdeterminetheireffectiveuse:1)Serverconfigurationimpactstriggermanagement;2)Complextriggersincreasesystemload;3)Largertablesslowtriggerperformance;4)Highconcurrencycancausetriggercontention;5)M

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

Adding MySQL users through the PHP web interface can use MySQLi extensions. The steps are as follows: 1. Connect to the MySQL database and use the MySQLi extension. 2. Create a user, use the CREATEUSER statement, and use the PASSWORD() function to encrypt the password. 3. Prevent SQL injection and use the mysqli_real_escape_string() function to process user input. 4. Assign permissions to new users and use the GRANT statement.

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 Linux new version
SublimeText3 Linux latest version

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software
