- 浏览: 28351 次
- 性别:
- 来自: 济南
最新评论
最近研究solr 结合网上的方法 自己实践
版本apache-solr-1.4.1.tgz
java容器用的自带的jetty
简单快速方法
解压后 进入example java -jar start.sh
后台运行输出
java -jar /usr/local/webserver/solr/example/start.jar >>/tmp/solr.log 2>&1 &
访问 http://localhost:8983 如果打不开 检查端口是否打开
具体配置以后再研究 下面研究solr的配置
现在新建一个通讯录 搜索 采用多核心 即一个目录
进入solr 目录 发现 有data conf 等目录
新建一个contact 将 data conf 移进去
在外面新建 solr.xml
之后重启 发现solr 下生成data
进入contact 目录修改 solrconfig.xml
找到 dataDir 注掉 <dataDir>${solr.data.dir:./solr/data}</dataDir>
重要的配置文件是 conf 下的 solrconfig.xml 和 schema.xml
下面是我的配置 详情见
http://blog.csdn.net/escaflone/article/details/5720597
http://blog.csdn.net/escaflone/article/details/5726320
sorconfig.xml
schema.xml 重点是文件后面的 field配置
版本apache-solr-1.4.1.tgz
java容器用的自带的jetty
简单快速方法
解压后 进入example java -jar start.sh
后台运行输出
java -jar /usr/local/webserver/solr/example/start.jar >>/tmp/solr.log 2>&1 &
访问 http://localhost:8983 如果打不开 检查端口是否打开
具体配置以后再研究 下面研究solr的配置
现在新建一个通讯录 搜索 采用多核心 即一个目录
进入solr 目录 发现 有data conf 等目录
新建一个contact 将 data conf 移进去
在外面新建 solr.xml
<?xml version="1.0" encoding="UTF-8" ?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- All (relative) paths are relative to the installation path persistent: Save changes made via the API to this file sharedLib: path to a lib directory that will be shared across all cores --> <solr persistent="false"> <!-- adminPath: RequestHandler path to manage cores. If 'null' (or absent), cores will not be manageable via request handler --> <cores adminPath="/admin/cores"> <core name="contact" instanceDir="contact" /> </cores> </solr>
之后重启 发现solr 下生成data
进入contact 目录修改 solrconfig.xml
找到 dataDir 注掉 <dataDir>${solr.data.dir:./solr/data}</dataDir>
重要的配置文件是 conf 下的 solrconfig.xml 和 schema.xml
下面是我的配置 详情见
http://blog.csdn.net/escaflone/article/details/5720597
http://blog.csdn.net/escaflone/article/details/5726320
sorconfig.xml
<?xml version="1.0" encoding="UTF-8" ?> <config> <updateHandler class="solr.DirectUpdateHandler2" /> <requestDispatcher handleSelect="true" > <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" /> </requestDispatcher> <requestHandler name="standard" class="solr.StandardRequestHandler" default="true" /> <requestHandler name="/update" class="solr.XmlUpdateRequestHandler" /> <requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" /> <requestHandler name="/admin/ping" class="PingRequestHandler"> <lst name="defaults"> <str name="qt">standard</str> <str name="q">0</str> <str name="echoParams">all</str> </lst> </requestHandler> <!-- config for the admin interface --> <admin> <defaultQuery>0</defaultQuery> </admin> </config>
schema.xml 重点是文件后面的 field配置
<?xml version="1.0" encoding="UTF-8" ?> <schema name="contact" version="1.2"> <types> <fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/> <!-- boolean type: "true" or "false" --> <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true"/> <!--Binary data type. The data should be sent/retrieved in as Base64 encoded Strings --> <fieldtype name="binary" class="solr.BinaryField"/> <!-- Default numeric field types. For faster range queries, consider the tint/tfloat/tlong/tdouble types. --> <fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/> <fieldType name="float" class="solr.TrieFloatField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/> <fieldType name="long" class="solr.TrieLongField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/> <fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/> <fieldType name="tint" class="solr.TrieIntField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/> <fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/> <fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/> <fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/> <fieldType name="date" class="solr.TrieDateField" omitNorms="true" precisionStep="0" positionIncrementGap="0"/> <!-- A Trie based date field for faster date range queries and date faceting. --> <fieldType name="tdate" class="solr.TrieDateField" omitNorms="true" precisionStep="6" positionIncrementGap="0"/> <!-- --> <fieldType name="pint" class="solr.IntField" omitNorms="true"/> <fieldType name="plong" class="solr.LongField" omitNorms="true"/> <fieldType name="pfloat" class="solr.FloatField" omitNorms="true"/> <fieldType name="pdouble" class="solr.DoubleField" omitNorms="true"/> <fieldType name="pdate" class="solr.DateField" sortMissingLast="true" omitNorms="true"/> <!-- --> <fieldType name="sint" class="solr.SortableIntField" sortMissingLast="true" omitNorms="true"/> <fieldType name="slong" class="solr.SortableLongField" sortMissingLast="true" omitNorms="true"/> <fieldType name="sfloat" class="solr.SortableFloatField" sortMissingLast="true" omitNorms="true"/> <fieldType name="sdouble" class="solr.SortableDoubleField" sortMissingLast="true" omitNorms="true"/> <fieldType name="random" class="solr.RandomSortField" indexed="true" /> <!-- A text field that only splits on whitespace for exact matching of words --> <fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100"> <analyzer> <tokenizer class="solr.WhitespaceTokenizerFactory"/> </analyzer> </fieldType> <!-- A text field that uses WordDelimiterFilter to enable splitting and matching of words on case-change, alpha numeric boundaries, and non-alphanumeric chars, so that a query of "wifi" or "wi fi" could match a document containing "Wi-Fi". Synonyms and stopwords are customized by external files, and stemming is enabled. --> <fieldType name="text" class="solr.TextField" positionIncrementGap="100"> <analyzer type="index"> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" /> <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.SnowballPorterFilterFactory" language="English" protected="protwords.txt"/> </analyzer> <analyzer type="query"> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" /> <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.SnowballPorterFilterFactory" language="English" protected="protwords.txt"/> </analyzer> </fieldType> <!-- Less flexible matching, but less false matches. Probably not ideal for product names, but may be good for SKUs. Can insert dashes in the wrong place and still match. --> <fieldType name="textTight" class="solr.TextField" positionIncrementGap="100" > <analyzer> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="false"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/> <filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="0"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.SnowballPorterFilterFactory" language="English" protected="protwords.txt"/> <!-- this filter can remove any duplicate tokens that appear at the same position - sometimes possible with WordDelimiterFilter in conjuncton with stemming. --> <filter class="solr.RemoveDuplicatesTokenFilterFactory"/> </analyzer> </fieldType> <!-- A general unstemmed text field - good if one does not know the language of the field --> <fieldType name="textgen" class="solr.TextField" positionIncrementGap="100"> <analyzer type="index"> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" /> <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="0"/> <filter class="solr.LowerCaseFilterFactory"/> </analyzer> <analyzer type="query"> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" /> <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="0"/> <filter class="solr.LowerCaseFilterFactory"/> </analyzer> </fieldType> <!-- A general unstemmed text field that indexes tokens normally and also reversed (via ReversedWildcardFilterFactory), to enable more efficient leading wildcard queries. --> <fieldType name="text_rev" class="solr.TextField" positionIncrementGap="100"> <analyzer type="index"> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" /> <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="0"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.ReversedWildcardFilterFactory" withOriginal="true" maxPosAsterisk="3" maxPosQuestion="2" maxFractionAsterisk="0.33"/> </analyzer> <analyzer type="query"> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" /> <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="0"/> <filter class="solr.LowerCaseFilterFactory"/> </analyzer> </fieldType> <!-- This is an example of using the KeywordTokenizer along With various TokenFilterFactories to produce a sortable field that does not include some properties of the source text --> <fieldType name="alphaOnlySort" class="solr.TextField" sortMissingLast="true" omitNorms="true"> <analyzer> <!-- KeywordTokenizer does no actual tokenizing, so the entire input string is preserved as a single token --> <tokenizer class="solr.KeywordTokenizerFactory"/> <!-- The LowerCase TokenFilter does what you expect, which can be when you want your sorting to be case insensitive --> <filter class="solr.LowerCaseFilterFactory" /> <!-- The TrimFilter removes any leading or trailing whitespace --> <filter class="solr.TrimFilterFactory" /> <!-- The PatternReplaceFilter gives you the flexibility to use Java Regular expression to replace any sequence of characters matching a pattern with an arbitrary replacement string, which may include back references to portions of the original string matched by the pattern. See the Java Regular Expression documentation for more information on pattern and replacement string syntax. http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/package-summary.html --> <filter class="solr.PatternReplaceFilterFactory" pattern="([^a-z])" replacement="" replace="all" /> </analyzer> </fieldType> <fieldtype name="phonetic" stored="false" indexed="true" class="solr.TextField" > <analyzer> <tokenizer class="solr.StandardTokenizerFactory"/> <filter class="solr.DoubleMetaphoneFilterFactory" inject="false"/> </analyzer> </fieldtype> <fieldtype name="payloads" stored="false" indexed="true" class="solr.TextField" > <analyzer> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter class="solr.DelimitedPayloadTokenFilterFactory" encoder="float"/> </analyzer> </fieldtype> <!-- lowercases the entire field value, keeping it as a single token. --> <fieldType name="lowercase" class="solr.TextField" positionIncrementGap="100"> <analyzer> <tokenizer class="solr.KeywordTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory" /> </analyzer> </fieldType> <!-- since fields of this type are by default not stored or indexed, any data added to them will be ignored outright. --> <fieldtype name="ignored" stored="false" indexed="false" multiValued="true" class="solr.StrField" /> </types> <fields> <field name="id" type="int" indexed="true" stored="true" required="true"/> <field name="uid" type="int" indexed="true" stored="true" required="true"/> <field name="contactid" type="int" indexed="true" stored="true" required="true"/> <field name="email" type="text" indexed="true" stored="true" required="true"/> <field name="cellphone" type="text" indexed="true" stored="true" required="true"/> <field name="contact" type="text" indexed="true" stored="true"/> <field name="source" type="int" indexed="true" stored="true"/> <field name="time" type="int" indexed="true" stored="true" required="true"/> <field name="text" type="text" indexed="true" stored="true" multiValued="true"/> </fields> <uniqueKey>id</uniqueKey> <solrQueryParser defaultOperator="OR"/> <defaultSearchField>text</defaultSearchField> <copyField source="contact" dest="text"/> <copyField source="email" dest="text"/> <copyField source="cellphone" dest="text"/> </schema>
相关推荐
Tomcat和solr安装配置说明,详细记录了Tomcat和solr安装配置
本篇将详细介绍如何在本地环境中安装并配置 Solr,包括单核心(core)和多核心的设置。 **一、Solr 单核心安装配置** 1. 首先,我们需要从 Apache Tomcat 官网下载 Tomcat,这将作为 Solr 的服务器容器。Tomcat ...
本文将详细介绍如何在本地环境中安装和配置 Solr。 首先,我们需要准备的环境是 JDK 和 Tomcat。Solr 建立在 Java 之上,所以必须先安装 JDK 1.6 或以上版本。在安装 JDK 后,需要设置相应的环境变量,例如 `JAVA_...
本文将详细介绍如何进行 Solr 的安装与配置。 首先,安装 Solr 需要先确保你的系统已经安装了 Java Development Kit (JDK) 1.6 或以上版本,因为 Solr 需要依赖 JDK 来运行。你可以从 Oracle 的官方网站下载并安装...
#### 三、Solr配置细节 ##### 1. 配置核心 - **配置核心信息**:每个索引都需要一个核心(Core),核心是Solr的一个实例,包含一个或多个索引。在`D:\Solr\solr1\home`目录下,可以通过编辑`core.properties`文件来...
Solr配置安装(一) Apache Solr是一款基于Java的开源搜索服务器,由Apache软件基金会开发。它提供了全文检索、命中高亮、拼写检查、实时索引和多种数据类型支持等强大功能,常用于构建高性能的搜索应用。本文将...
3. **修改Solr配置**: - 在`$SOLR_HOME/collection1/conf/schema.xml`文件中,在`<types></types>`之间添加以下内容: ```xml <fieldType name="text_ik" class="solr.TextField"> ``` - 同时,修改`...
### Solr搜索服务器安装配置详解 #### 一、Solr简介 Apache Solr是一款开源的高性能全文搜索引擎,基于Lucene库构建。它采用Java开发,提供了丰富的API接口,支持多种编程语言,使得开发者能够轻松地集成搜索功能到...
在Linux系统上如何搭建了solr搜索服务,同时运用到项目中
在 Solr 8 中,为了确保系统的安全性和数据的隐私性,配置用户登录验证是非常重要的步骤。本文将详细介绍如何对手动配置 Solr 8 的用户登录验证。 首先,我们需要了解 Solr 的安全组件——Jetty 容器。Solr 默认...
"Tomcat 和 Solr 的配置安装过程" 在本文中,我们将详细介绍 Tomcat 和 Solr 的配置安装过程。Tomcat 是一个开源的 Web 服务器软件,而 Solr 是一个基于 Lucene 的搜索服务器。它们都是 Java 语言开发的,因此可以...
Solr 的基本安装配置主要包括 Solr 配置所需包、Solr 配置文件详解和 Solr 服务配置说明三个部分。 Solr 配置所需包 Solr 需要的配置包主要包括 JDK、Apache Tomcat 和 Apache ZooKeeper 等。 Solr 配置文件详解 ...
【Solr入门配置说明】 ...总的来说,配置Solr涉及JDK、Tomcat的安装与环境变量设置,以及Solr自身的部署和核心配置。一旦完成这些步骤,你就能够利用Solr的强大搜索功能来提升你的应用程序的用户体验。
Solr安装配置相对直接,可以从其官方网站下载特定版本(如Solr4.10.3),并根据运行环境(Linux或Windows)选择相应的安装包。Solr使用指南亦可在其官方wiki页面找到。安装后,Solr主要目录结构包括bin(运行脚本)...
本压缩包“Solr安装与配置solr.rar”包含了Solr的安装和配置步骤,对于理解和使用Solr进行全文检索、索引和查询操作具有重要的参考价值。 首先,我们需要了解Solr的基本架构。Solr的核心组件包括索引库、请求处理器...
1. **修改Solr配置文件**: - 打开`solr\home\conf\solrconfig.xml`文件。 - 在`<dataDir>`标签中指定Solr数据存储路径,例如: ```xml ${solr.data.dir:D:\developmenttools\solr\home\data} ``` - 其中`D:\...