1. Add some testing data to solr
open command prompt, and cd D:\solr_home\exampledocs
D:\solr_home\exampledocs>java -Durl=http://localhost:8080/solr/update -jar post jar *xml
If you can see the following information, adding index is successfully.
SimplePostTool version 1.5
Posting files to base url [http://localhost:8080/solr/update|http://localhost:8080/solr/update] using content-type
pplication/xml..
POSTing file gb18030-example.xml
POSTing file hd.xml
POSTing file ipod_other.xml
POSTing file ipod_video.xml
POSTing file manufacturers.xml
POSTing file mem.xml
POSTing file money.xml
POSTing file monitor.xml
POSTing file monitor2.xml
POSTing file mp500.xml
POSTing file sd500.xml
POSTing file solr.xml
POSTing file utf8-example.xml
POSTing file vidcard.xml
14 files indexed.
COMMITting Solr index changes to [http://localhost:8080/solr/update|http://localhost:8080/solr/update]..
Here, if use command D:\solr_home\exampledocs>java -jar post jar *xml
will has the error SimplePostTool: FATAL: IOException while posting data: java.net.ConnectException: Connection refused: connect
that's because solr uses default port 8983, here is using port 8080.
2. modify configuration
open file D:\solr_home\solr\collection1\conf\solrconfig.xml
add configuration:
<searchComponent name="suggest" class="solr.SpellCheckComponent">
<lst name="spellchecker">
<str name="name">suggest</str>
<str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
<str name="lookupImpl">org.apache.solr.spelling.suggest.tst.TSTLookup</str>
<str name="field">name</str>
<float name="threshold">0.005</float>
<str name="buildOnCommit">true</str>
<!--<str name="storeDir">spellchecker</str>-->
</lst>
</searchComponent>
<requestHandler name="/suggest" class="org.apache.solr.handler.component.SearchHandler">
<lst name="defaults">
<str name="spellcheck">true</str>
<str name="spellcheck.dictionary">suggest</str>
<str name="spellcheck.count">10</str>
<str name="spellcheck.onlyMorePopular">true</str>
<str name="spellcheck.collate">true</str>
</lst>
<arr name="components">
<str>suggest</str>
</arr>
</requestHandler>
3. test
In the browser input http://localhost:8983/solr/suggester/?q=s , you will set the following result:
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">2</int>
</lst>
<lst name="spellcheck">
<lst name="suggestions">
<lst name="s">
<int name="numFound">10</int>
<int name="startOffset">0</int>
<int name="endOffset">1</int>
<arr name="suggestion">
<str>sdram</str>
<str>system</str>
<str>some</str>
<str>server</str>
<str>series</str>
<str>sp2514n</str>
<str>samsung</str>
<str>spinpoint</str>
<str>sata</str>
<str>search</str>
</arr>
</lst>
<str name="collation">sdram</str>
</lst>
</lst>
</response>
interface
http://wiki.apache.org/solr/Suggester
- 大小: 4.5 KB
- 大小: 64.9 KB
分享到:
相关推荐
ik,suggest 已经配置好了,可以在Windows/linux直接启动
solr cloud6.x.x 都可以用,solr的拼音分词
6. Suggest查询 7. SolrJ 章节三:Solr高级(上) 1. Solr Cloud 2. 函数查询 3. 地理位置查询 4. JSON Facet 章节四:Solr高级(下) 1. 深度分页 2. Solr Join查询 3. 相关度排序 4.Solr缓存 5.Spring Data Solr ...
solr-smart-建议您需要将以下 jar 文件包含到类路径中以编译 solr-smart-suggest 组件: lucene-core-4.10.3-SNAPSHOT.jar lucene-analyzers-common-4.10.3-SNAPSHOT.jar lucene-suggest-4.10.3-SNAPSHOT.jar solr-...
10 Auto-suggest 11 Result grouping / Field collapsing – AVAILABLE 12 Taking Solr to production PART 3: TAKING SOLR TO THE NEXT LEVEL 13 Scaling Solr / Solr Cloud 14 Multi-lingual search 15 Complex ...
类似京东,淘宝搜索自动补全功能。通过suggest.js插件来完成功能开发。
建议样本这是 Solr Suggester 的示例 UI。
pinyinAnalyzer 拼音检索jar包,solr suggest ,很有用的工具.
应用场景:1: 按拼音排序2: 中文网站一般都有suggest功能,是支持拼音的suggest的用到的技术:1,开源的Pinyin4j2,开源的lucene3,开源的solr如何在Lucene里使用? public static void testExec()throws ...
[search|suggest] - if set, we run the given benchmark -c int benchmark concurrency (default 4) -duration int number of seconds to run the benchmark (default 5) -engine string [redis|elastic|...