1

我有一个这样的日期时间字段。

<field name="rel_date" type="date" indexed="true" stored="true" default="NOW" multiValued="false"/>

我尝试通过 curl 查询删除 rel_date 字段上的一些特定日期。

curl http://$SOLR_IPADDR:$SOLR_PORT/solr/update/?commit=true -H "Content-Type: text/xml" -d "<delete><query>rel_date:\[2012-03-10\])</query></delete>"

但是它在 SOLR 响应上出现 Invalid date string 错误。

HTTP 状态 400 - 无效的日期字符串:'[2012-03-10]'

如何使用 CURL 查询删除 SOLR 记录上的特定日期?

4

3 回答 3

3

你也需要时间。

DateField javadocs

日期字段的格式应为 1995-12-31T23:59:59Z 结尾的“Z”表示 UTC 时间并且是强制性的(有关 UTC 的说明,请参见下文)。允许可选的小数秒,只要它们不以尾随 0 结尾(但任何超过毫秒的精度都将被忽略)。所有其他部分都是强制性的。

另请参阅: http: //lucidworks.lucidimagination.com/display/lweug/Solr+Date+Format

于 2012-03-24T23:33:58.850 回答
0

I did it with following curl comment:

curl http://$SOLR_IPADDR:$SOLR_PORT/solr/update/?commit=true -H "Content-Type: text/xml" -d "(rel_date:[2012-03-10T00:00:00Z TO 2012-03-10T00:00:00Z])"

Of cource you have to change $SOLR_IPADDR and $SOLR_PORT from your environment.

于 2012-03-28T06:26:21.660 回答
0

curl http://host:port/solr/core_name/update?commit=true -H "Content-Type: text/xml" --data-binary'<delete><query>rel_date:[2019-03-25T00:00:01Z TO 2019-03-25T23:59:59Z]</query></delete>'

于 2019-03-27T09:08:48.963 回答