SolrTemplate.delete(SolrDataQuery查询)不起作用

时间:2017-08-30 12:01:50

标签: sql solr

我尝试使用查询从solr中删除。我的查询如下:MODIFIED_DATE:[* TO 1504094035082]。如果我使用此查询进行选择,则返回结果。我还尝试删除:

# Groupby logic - https://stackoverflow.com/a/45959831/4909087
out = df.groupby((df.C.cumsum() % 10).diff().shift().lt(0).cumsum(), as_index=0).agg('sum')
print(out) 
    A   B   C
0   6  13  11
1  21  16  11

它有效。但我需要使用SolrTemplate。知道为什么这个

SolrClient client = new HttpSolrClient("http://localhost:8983/solr/core");
client.deleteByQuery("MODIFIED_DATE:[* TO 1504094035082]");

client.commit();
client.close();

不工作?

1 个答案:

答案 0 :(得分:0)

最后我找到了答案。我在SimpleQuery和commit中使用了SimpleStringCriteria:

SolrDataQuery dataQuery = new SimpleQuery(new SimpleStringCriteria(SolrEntitiesFieldsIF.MODIFIED_DATE_FIELD + ":[* TO " + (new Date().getTime() - 60 * 10000) + "]"));
comparerSolrTemplate.delete(dataQuery);
comparerSolrTemplate.commit();