In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "how to achieve solr4.7 spell checking". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to implement solr4.7 spell check".
Unlike other fields, ① spell checking requires word segmentation when indexing, but no word segmentation is needed for retrieval, so create a special field for spell checking:
Set what fields are in the required spell check fields in the schema.xml file:
② is set in the solrconfig.xml file:
Text_spell default spell solr.DirectSolrSpellChecker internal 0.5 2 1 5 2 0.01 solr.FileBasedSpellChecker file spellings.txt UTF-8 spellcheckerFile spell default on true true spellerror
Code in ③ solrj
/ * * @ method: testSpellCheck * @ Description: spell check * * @ author: ChenYW * @ date 2014-4-15 06:14:56 * / public String spellCheck (String word) {SolrQuery query = new SolrQuery (); query.set ("defType", "edismax"); / / weighted query.set ("qf", "name ^ 20.0") Query.set ("spellcheck", "true"); query.set ("spellcheck.q", word); query.set ("qt", "/ spell"); query.set ("spellcheck.build", "true"); / / when new check words are encountered, query.set is automatically added to the index ("spellcheck.count", 5) Try {QueryResponse rsp = server.query (query); SpellCheckResponse re=rsp.getSpellCheckResponse (); if (re! = null) {if (! re.isCorrectlySpelled ()) {String t = re.getFirstSuggestion (word); / / get the first recommendation System.out.println ("recommendation:" + t); return t } catch (SolrServerException e) {e.printStackTrace ();} return null;} at this point, I believe you have a better understanding of "how to implement solr4.7 spell checking". You might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.