2012-08-10 97 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