2012-08-10 94 views
1

我想了解为什么我的Solr索引甚至没有被触及,当我删除我的整个索引!从索尔索引删除文件 - 索引不触及

到目前为止,我已经试过直接到Solr的查询:

curl 'http://localhost:8080/solr/update?stream.body=<delete><query>*:*</query></delete>&commit=true' 

我也试过pysolr:

In [242]: from pysolr import Solr 

In [243]: conn = Solr('http://localhost:8080/solr/') 

In [244]: conn.delete(q='*:*') 

上面这两个命令的输出是在卡特琳娜日志相同。

不管我如何努力这一点(甚至从管理面板试过),该指数仍显示相同数量的文档的:

Num Docs: 
323 
Max Doc: 
323 
Version: 
52 
Segment Count: 
1 

起初我还以为是我的Solr/data文件夹的权限问题,但事实并非如此。 我在我的solrconfig.xml中注释了我的缓存,结果是一样的。

这将是伟大的,如果任何人有任何提示!


后来编辑:

每次我运行上面的命令,只有具有更高时间戳的文件被修改(仅拼写检查DIR) - 你也可以看到用户所有权从WWW改变-data到根 - 当我手动运行这些命令

data/index: 
total 2112 
-rw-r--r-- 1 www-data root 1268535 2012-08-10 13:41 _f.fdt 
-rw-r--r-- 1 www-data root 2618 2012-08-10 13:41 _f.fdx 
-rw-r--r-- 1 www-data root 1135 2012-08-10 13:41 _f.fnm 
-rw-r--r-- 1 www-data root 201513 2012-08-10 13:41 _f_Lucene40_0.frq 
-rw-r--r-- 1 www-data root 207400 2012-08-10 13:41 _f_Lucene40_0.prx 
-rw-r--r-- 1 www-data root 419705 2012-08-10 13:41 _f_Lucene40_0.tim 
-rw-r--r-- 1 www-data root 11199 2012-08-10 13:41 _f_Lucene40_0.tip 
-rw-r--r-- 1 www-data root  245 2012-08-10 13:41 _f_nrm.cfe 
-rw-r--r-- 1 www-data root 2751 2012-08-10 13:41 _f_nrm.cfs 
-rw-r--r-- 1 www-data root  382 2012-08-10 13:41 _f.si 
-rw-r--r-- 1 www-data root  20 2012-08-10 13:41 segments.gen 
-rw-r--r-- 1 www-data root  98 2012-08-10 13:41 segments_h 
-rw-r--r-- 1 root  root  0 2012-08-10 13:55 write.lock 

data/spellchecker: 
total 792 
-rw-r--r-- 1 root root 129251 2012-08-10 14:16 _q.fdt 
-rw-r--r-- 1 root root 84282 2012-08-10 14:16 _q.fdx 
-rw-r--r-- 1 root root 1119 2012-08-10 14:16 _q.fnm 
-rw-r--r-- 1 root root 288855 2012-08-10 14:16 _q_Lucene40_0.frq 
-rw-r--r-- 1 root root 257208 2012-08-10 14:16 _q_Lucene40_0.tim 
-rw-r--r-- 1 root root 9355 2012-08-10 14:16 _q_Lucene40_0.tip 
-rw-r--r-- 1 root root 306 2012-08-10 14:16 _q.si 
-rw-r--r-- 1 root root  69 2012-08-10 14:16 segments_1p 
-rw-r--r-- 1 root root  20 2012-08-10 14:16 segments.gen 

data/tlog: 
total 444 
-rw-r--r-- 1 www-data root 363169 2012-08-10 12:11 tlog.0000000000000000019 
-rw-r--r-- 1 www-data root 79280 2012-08-10 12:11 tlog.0000000000000000020 

卡塔利娜登录截短,conn.delete(q = '')跑 - 他再次就是在catalina.log

Aug 10, 2012 3:17:57 PM org.apache.solr.update.DirectUpdateHandler2 commit 
INFO: start commit{flags=0,version=0,optimize=false,openSearcher=true,waitSearcher=true,expungeDeletes=false,softCommit=false} 
Aug 10, 2012 3:17:57 PM org.apache.solr.search.SolrIndexSearcher <init> 
INFO: Opening [email protected] main 
Aug 10, 2012 3:17:57 PM org.apache.solr.core.QuerySenderListener newSearcher 
INFO: QuerySenderListener sending requests to [email protected] main{StandardDirectoryReader(segments_h:52 _f(4.0):C323)} 
Aug 10, 2012 3:17:57 PM org.apache.solr.core.QuerySenderListener newSearcher 
INFO: QuerySenderListener done. 
Aug 10, 2012 3:17:57 PM org.apache.solr.handler.component.SpellCheckComponent$SpellCheckerListener buildSpellIndex 
INFO: Building spell index for spell checker: default 
Aug 10, 2012 3:17:57 PM org.apache.solr.update.DirectUpdateHandler2 commit 
INFO: end_commit_flush 
Aug 10, 2012 3:18:02 PM org.apache.solr.core.SolrCore registerSearcher 
INFO: [collection1] Registered new searcher [email protected] main{StandardDirectoryReader(segments_h:52 _f(4.0):C323)} 
Aug 10, 2012 3:18:02 PM org.apache.solr.update.processor.LogUpdateProcessor finish 
INFO: [collection1] webapp=/solr path=/update/ params={commit=true} {deleteByQuery=*:*,commit=} 0 5608 

后来的后来编辑记录:

我试图通过ID删除和它的作品!因此,出于某种原因删除由

q=*:* 

失败...

+0

你提交了吗? – 2012-08-10 12:27:15

+0

pysolr的删除方法。Solr类的默认情况下提交= True,并在我的查询,我curl我有&提交= True。还不够吗? – 2012-08-10 12:31:41

+0

很奇怪! solr日志文件说什么?它应该记录提交时发生,即使删除被执行,如果我没有记错的话。对不起,如果我问,是你唯一的索引?你在看正确的吗? – javanna 2012-08-10 13:11:58

回答

0

我发现这个问题是在我的schema.xml

我重写它现在就像一个魅力!

+0

太棒了!恭喜! – Chris 2012-08-10 18:33:29

+1

我们可以知道在schema.xml中你的问题是什么吗? – mhlsf 2017-07-05 14:13:09

0

给这个在卷曲了一枪,很适合我过去:

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

希望它能帮助。

+0

我试过没有成功... – 2012-08-10 15:34:25

+0

上面的命令不使用默认端口,但为我工作。 – 2015-02-02 20:52:03

0

我认为你需要切换你的提交和stream.body参数的顺序。从查看catalina日志中的最后一个条目,看起来提交值未包含在删除查询中。

试试这个:

curl 'http://localhost:8080/solr/update?commit=true&stream.body=<delete><query>*:*</query></delete>' 
+0

我试过,没有工作:(......那些得到参数,我不认为顺序很重要 – 2012-08-10 18:14:50