0

Solr4.1を実行しています。バージョンフィールドはありますが、時間に関してクエリで削除する方法がわかりません。スキーマにタイムスタンプが表示されているフィールドがありません。

私がやろうとしているのは、たとえば30日より古いすべてのドキュメントを削除するクエリを実行することです。

私はネット上で見つけることができるすべてを試しました。

curl http://localhost:8983/solr/update?commit=true -H "Content-Type: text/xml" --data-binary '<delete><query>_version_:[* TO NOW-60DAYS] </query></delete>'

curl http://localhost:8983/solr/update?commit=true -H "Content-Type: text/xml" --data-binary '<delete><query>timestamp:[* TO NOW-60DAYS] </query></delete>'

curl http://localhost:8983/solr/update?commit=true -H "Content-Type: text/xml" --data-binary '<delete><query>createTime:[* TO NOW-60DAYS] </query></delete>'

他の削除は正常に機能します。

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

1 に答える 1

2

コメントアウトされているだけで、schema.xmlに含まれているタイムスタンプフィールドを有効にできます。そのフィールドには、ドキュメントがインデックスに挿入されるたびに、現在の日時が自動的に入力されます。schema.xmlで次を探します。

 <!-- Uncommenting the following will create a "timestamp" field using
      a default value of "NOW" to indicate when each document was indexed.
   -->
 <!--
 <field name="timestamp" type="date" indexed="true" stored="true" 
    default="NOW" multiValued="false"/>
 -->

この値を設定するには、ドキュメントのインデックスを再作成する必要があります。

于 2013-02-28T01:27:22.070 に答える