【问题标题】:solr: How to store relative path when using FileListEntityProcessorsolr:使用 FileListEntityProcessor 时如何存储相对路径
【发布时间】:2013-02-27 15:39:06
【问题描述】:

我使用 FileListEntityProcessor 来索引本地目录。 This 解决方案有效,但我不想存储绝对路径。相反,我想存储相对于 baseDir 的路径。

这可能吗?

【问题讨论】:

    标签: solr dataimporthandler


    【解决方案1】:

    如果要存储相对路径,可以使用ScriptTransformer使用绝对路径,修改后生成相对路径的新字段。例如

    <dataConfig>
            <script><![CDATA[
                    function retrieveRelativePath(row)    {
                        var absolutePath = row.get('absolutePath');
                        // Curtail to Relative path
                        var relativePath = absolutePath.something();
                        row.put('relativePath', relativePath);
                        return row;
                    }
            ]]></script>
            <document>
                    <entity name="e" pk="id" transformer="script:retrieveRelativePath" query="select * from X">
                    ....
                    </entity>
            </document>
    </dataConfig>
    

    【讨论】:

      猜你喜欢
      • 2010-11-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多