Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure the synonyms of Solr4.7

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "how to configure the synonyms of Solr4.7". In the daily operation, I believe that many people have doubts about how to configure the synonyms of Solr4.7. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "how to configure synonyms of Solr4.7". Next, please follow the editor to study!

In the search, often need to use related words (synonyms), for example, search for "Lenovo" brand, then we also search for "lenovo" and so on. Solr provides us with a synonym filter solr.SynonymFilterFactory.

Configuring search synonyms is simple, as long as you define a filter in the schema field

Add it to the tag of schema.xml as follows:

In solr.SynonymFilterFactory configuration, synonyms is a synonym configuration file

IgnoreCase: true, which means converting to lowercase matching and ignoring case.

Expand: involves the configuration of synonyms.txt

Synonyms.txt configures one line as a unit to establish keyword connections.

# The ASF licenses this file to You under the Apache License, Version 2. (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 "ASIS" 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.#----#some test synonym mappings unlikely to appear in real input textaaafoo = > aaabarbbbfoo = > bbbfoo bbbbarcccfoo = > cccbar cccbazfooaaa,baraaa,bazaaa# Some synonym groups specific to this exampleGB,gib,gigabyte GigabytesMB,mib,megabyte,megabytesTelevision, Televisions, TV, TVs#notice we use "gib" instead of "GiB" so any WordDelimiterFilter coming#after us won't split it into two words. China, UK, Japan # Synonym mappings can be used for spelling correction toopixima = > pixma

That is to say, = > means one-to-one, with groups separated by commas, that is, many-to-many.

Of course, this also has to define the relevant fields as this type, as follows.

At this point, the study on "how to configure the synonyms of Solr4.7" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report