【问题标题】:Apache Solr 6.6.1 number mapping in Urdu language乌尔都语中的 Apache Solr 6.6.1 数字映射
【发布时间】:2018-02-27 09:02:03
【问题描述】:

我已将 Apache Solr 6.6.2 配置为稍后索引和搜索文档。我面临一些问题。如果文档中有一个数字,例如 1234,我希望它应该映射(复制)到相应的乌尔都语数字,例如 1234。如果用户输入 1234 或 1234,最终将有助于检索文档。 Solr 中是否有任何内置解决方案或如何使用此功能?

【问题讨论】:

    标签: java apache solr lucene tokenize


    【解决方案1】:

    如果您使用 Java/SolrJ 客户端进行索引...

    将 junidecode 依赖添加到您的项目中

    毕业典礼

    compile group: 'junidecode', name: 'junidecode', version: '0.1.1'
    

    对于 Maven:

    <dependency>
        <groupId>junidecode</groupId>
        <artifactId>junidecode</artifactId>
        <version>0.1.1</version>
    </dependency>
    

    索引时...索引一个附加字段...

    import net.sf.junidecode.Junidecode;
    String converted = Junidecode.unidecode("۱۲۳۴") 
    // converted == 1234
    

    【讨论】:

    • 感谢回复;我的问题是如何为数字映射自定义 Solr。我的想法是我必须编写一些标记器来执行此操作,但直到现在我还没有确认
    • 你能告诉我你是如何索引数据的,是通过 SolrJ 客户端还是数据是静态 json/xml 格式。这个想法是您需要在字段或文本字段中添加额外的转换(关联)数据,无论您是在将数据发布到 solr 之前修改数据还是通过编写 solr 过滤器等。您可能还想检查:lucene.apache.org/solr/guide/6_6/…
    • 我正在通过 post.sh 脚本和 XML 中的数据索引数据
    • 你试过 ASCIIFoldingFilter 了吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-20
    • 2016-02-02
    相关资源
    最近更新 更多