代码之家  ›  专栏  ›  技术社区  ›  Raju Paladiya

Solr错误-流体已禁用

  •  0
  • Raju Paladiya  · 技术社区  · 8 年前

    我正在从浏览器url中删除文档。

    我在用solr-7.4.0

    我正在使用此查询删除文档

    http://localhost:8983/solr/test/update?stream.body=<delete><query>*:*</query></delete>&commit=true
    

    这是返回下面的错误消息。

    {
      "error":{
        "metadata":[
          "error-class","org.apache.solr.common.SolrException",
          "root-error-class","org.apache.solr.common.SolrException"],
        "msg":"Stream Body is disabled. See http://lucene.apache.org/solr/guide/requestdispatcher-in-solrconfig.html for help",
        "code":400}}
    

    我也试过

    http://localhost:8983/solr/test/update?commit=true -H "Content-Type: text/xml" --data-binary '<delete><query>*:*</query></delete>'
    

    但运气不好。 此返回消息如下:

    {
      "responseHeader":{
        "status":0,
        "QTime":1}}
    

    但文件没有删除。

    我用DIH输入数据。

    我的data-config.xml文件是

    <dataConfig>
    <dataSource type="JdbcDataSource" driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://127.0.0.1\SQL2017;databaseName=mydatabase"   user="sa" password="mypassword"/>
    
        <document>
          <entity name="Product"  
            pk="Id"
            query="select Id, [Name] from Product"
            deltaImportQuery="SELECT Id, [Name] from Product WHERE Id='${dih.delta.id}'"
            deltaQuery="SELECT Id FROM Product  WHERE updated_at > '${dih.last_index_time}'"
            >
             <field column="Id" name="Id"/>
             <field column="Name" name="Name"/>       
          </entity>
        </document>
    </dataConfig>
    
    1 回复  |  直到 8 年前
        1
  •  2
  •   Raju Paladiya    8 年前

    我是邮递员修好的

    方法: 岗位 内容类型: 应用程序/json 正文:

    {
        "set-property": [{
                "requestDispatcher.requestParsers.enableRemoteStreaming": true
            },
            {
                "requestDispatcher.requestParsers.enableStreamBody": true
            }
        ]
    }
    

    网址: http://localhost:8983/api/cores/test5/config

    之后运行以下URL:

    http://localhost:8983/solr/test5/update?stream.body=%3Cdelete%3E%3Cquery%3E*:*%3C/query%3E%3C/delete%3E&commit=true
    

    而且效果很好。