solr4.7 Chinese word breaker (ik-analyzer) configuration

Source: Internet
Author: User
Tags solr

SOLR itself on the Chinese word processing is not too good, so the Chinese application often need to add a Chinese word breaker to Chinese word processing, Ik-analyzer is one of the good Chinese word breaker.


First, version information

SOLR version: 4.7.0

Requires Ik-analyzer version: IK Analyzer 2012ff_hf1

Ik-analyzer:http://code.google.com/p/ik-analyzer/downloads/list


Second, the configuration steps

Download the compressed Extract folder after extracting the following directory structure:

We copy the Ikanalyzer2012ff_u1.jar to the Solr\web-inf\lib under the SOLR service.

We copy the IKAnalyzer.cfg.xml and Stopword.dic to the Conf of the core that needs to use the word breaker, and a directory for the core Schema.xml file.

To modify the schema.xml of the core, add the following configuration between the <types></types> configuration items:

[HTML]View Plaincopy
    1. <FieldType name="Text_ik" class= "SOLR. TextField ">
    2. <analyzer class="Org.wltea.analyzer.lucene.IKAnalyzer"/>
    3. </FieldType>

We've got a Text_ik field type, and the word breaker used by this type is Ik-analyzer.

We can use Text_ik when we configure the field type in the schema.xml of this core.

[HTML]View Plaincopy
    1. <field name="name" type="Text_ik" indexed="true" stored="true" Multi valued="false" />


Third, Chinese word segmentation test

[HTML]View Plaincopy
    1. IKT
    2. Text
    3. Raw_bytes
    4. Start
    5. End
    6. Type
    7. Position
    8. People's Republic of China
    9. [E4 b8 ad e5 8d 8e e4 ba ba e6 b0 e5 b1 e5 8c e5 9b BD]
    10. 0
    11. 7
    12. Cn_word
    13. 1
    14. Chinese people
    15. [E4 b8 ad e5 8d 8e e4 ba ba e6 b0 91]
    16. 0
    17. 4
    18. Cn_word
    19. 2
    20. Chinese
    21. [E4 b8 ad e5 8d 8e]
    22. 0
    23. 2
    24. Cn_word
    25. 3
    26. Chinese
    27. [E5 8d 8e e4 ba Ba]
    28. 1
    29. 3
    30. Cn_word
    31. 4
    32. People's Republic
    33. [E4 ba ba e6 b0 e5-B1 e5 8c e5 9b BD]
    34. 2
    35. 7
    36. Cn_word
    37. 5
    38. People
    39. [E4 ba ba e6 b0 91]
    40. 2
    41. 4
    42. Cn_word
    43. 6
    44. Republic
    45. [E5 b1 e5 8c e5 9b BD]
    46. 4
    47. 7
    48. Cn_word
    49. 7
    50. Republican
    51. [E5 b1 e5 8c]
    52. 4
    53. 6
    54. Cn_word
    55. 8
    56. Country
    57. [E5 9b BD]
    58. 6
    59. 7
    60. Cn_char
    61. 9

solr4.7 Chinese word breaker (ik-analyzer) configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.