這篇文章主要講解了“solr自動聚類怎么實現(xiàn)”,文中的講解內(nèi)容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“solr自動聚類怎么實現(xiàn)”吧!
創(chuàng)新互聯(lián)建站主打移動網(wǎng)站、網(wǎng)站建設、做網(wǎng)站、網(wǎng)站改版、網(wǎng)絡推廣、網(wǎng)站維護、域名注冊、等互聯(lián)網(wǎng)信息服務,為各行業(yè)提供服務。在技術實力的保障下,我們?yōu)榭蛻舫兄Z穩(wěn)定,放心的服務,根據(jù)網(wǎng)站的內(nèi)容與功能再決定采用什么樣的設計。最后,要實現(xiàn)符合網(wǎng)站需求的內(nèi)容、功能與設計,我們還會規(guī)劃穩(wěn)定安全的技術方案做保障。
Solr 使用Carrot2完成了聚類功能,能夠把檢索到的內(nèi)容自動分類, Carrot2聚類示例:
要想Solr支持聚類功能,首選要把Solr發(fā)行包的中的dist/ solr-clustering-4.2.0.jar, 復制到\solr\contrib\analysis-extras\lib下.然后打開solrconfig.xml進行添加配置:
<searchComponent name="clustering" enable="${solr.clustering.enabled:true}" class="solr.clustering.ClusteringComponent" > <lst name="engine"> <str name="name">default</str> <str name="carrot.algorithm">org.carrot2.clustering.lingo.LingoClusteringAlgorithm</str> <str name="LingoClusteringAlgorithm.desiredClusterCountBase">30</str><!--2~100--> <str name="LingoClusteringAlgorithm.clusterMergingThreshold">0.70</str><!--0~1--> <str name="LingoClusteringAlgorithm.scoreWeight">0</str><!--0~1--> <str name="LingoClusteringAlgorithm.labelAssigner">org.carrot2.clustering.lingo.SimpleLabelAssigner</str><!--org.carrot2.clustering.lingo.UniqueLabelAssigner --> <str name="LingoClusteringAlgorithm.phraseLabelBoost">1.5</str><!--0~10--> <str name="LingoClusteringAlgorithm.phraseLengthPenaltyStart">8</str><!--2~8--> <str name="LingoClusteringAlgorithm.phraseLengthPenaltyStop">8</str><!--2~8--> <str name="TermDocumentMatrixReducer.factorizationQuality">HIGH</str><!--LOW,MEDIUM,HIGH--> <!-- org.carrot2.matrix.factorization.PartialSingularValueDecompositionFactory org.carrot2.matrix.factorization.NonnegativeMatrixFactorizationEDFactory org.carrot2.matrix.factorization.NonnegativeMatrixFactorizationKLFactory org.carrot2.matrix.factorization.LocalNonnegativeMatrixFactorizationFactory org.carrot2.matrix.factorization.KMeansMatrixFactorizationFactory --> <str name="TermDocumentMatrixReducer.factorizationFactory">org.carrot2.matrix.factorization.NonnegativeMatrixFactorizationEDFactory</str> <str name="TermDocumentMatrixBuilder.maximumMatrixSize">37500</str><!--MinValue5000--> <str name="TermDocumentMatrixBuilder.titleWordsBoost">2.0</str><!--2~10--> <str name="TermDocumentMatrixBuilder.maxWordDf">0.9</str><!--0~1--> <!--org.carrot2.text.vsm.LogTfIdfTermWeighting,org.carrot2.text.vsm.LinearTfIdfTermWeighting--> <str name="TermDocumentMatrixBuilder.termWeighting">org.carrot2.text.vsm.TfTermWeighting</str> <str name="MultilingualClustering.defaultLanguage">CHINESE_SIMPLIFIED</str> <str name="MultilingualClustering.languageAggregationStrategy">org.carrot2.text.clustering.MultilingualClustering.LanguageAggregationStrategy.FLATTEN_MAJOR_LANGUAGE </str><!--FLATTEN_ALL,FLATTEN_NONE--> <str name="GenitiveLabelFilter.enabled">true</str> <str name="StopWordLabelFilter.enabled">true</str> <str name="NumericLabelFilter.enabled">true</str> <str name="QueryLabelFilter.enabled">true</str> <str name="MinLengthLabelFilter.enabled">true</str> <str name="StopLabelFilter.enabled">true</str> <str name="CompleteLabelFilter.enabled">true</str> <str name="CompleteLabelFilter.labelOverrideThreshold">0.65</str><!--0~1--> <str name="DocumentAssigner.exactPhraseAssignment">false</str> <str name="DocumentAssigner.minClusterSize">2</str><!--1~100--> <str name="merge-resources">true</str> <str name="CaseNormalizer.dfThreshold">1</str><!--1~100--> <str name="PhraseExtractor.dfThreshold">1</str><!--1~100--> <str name="carrot.lexicalResourcesDir">clustering/carrot2</str> <str name="SolrDocumentSource.solrIdFieldName">id</str> </lst> </searchComponent> |
配好了聚類組件后,下面配置requestHandler:
<requestHandler name="/clustering" startup="lazy" enable="${solr.clustering.enabled:true}" class="solr.SearchHandler"> <lst name="defaults"> <str name="echoParams">explicit</str> <bool name="clustering">true</bool> <str name="clustering.engine">default</str> <bool name="clustering.results">true</bool> <str name="carrot.title">category_s</str> <str name="carrot.snippet">content</str> <str name="carrot.url">path</str> <str name="carrot.produceSummary">true</str> </lst> <arr name="last-components"> <str>clustering</str> </arr> </requestHandler> |
有兩個參數(shù)要注意carrot.title,carrot.snippet是聚類的比較計算字段,這兩個參數(shù)必須是stored="true".carrot.title的權(quán)重要高于carrot.snippet,如果只有一個做計算的字段carrot.snippet可以去掉(是去掉不是值為空).設完了用下面的URL就可以查詢了
http://localhost:8080/skyCore/clustering?q=*%3A*&wt=xml&indent=true
感謝各位的閱讀,以上就是“solr自動聚類怎么實現(xiàn)”的內(nèi)容了,經(jīng)過本文的學習后,相信大家對solr自動聚類怎么實現(xiàn)這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關知識點的文章,歡迎關注!
分享標題:solr自動聚類怎么實現(xiàn)
網(wǎng)頁地址:http://jinyejixie.com/article46/iisieg.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站設計、軟件開發(fā)、用戶體驗、網(wǎng)站制作、外貿(mào)網(wǎng)站建設、定制網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)