2014-04-04 12 views
2

我場長期矢量方面:使用docValues計算中這樣定義我的Solr模式上串場

<field name="text_t" type="text_t" indexed="true" multiValued="true" termVectors="true" /> 

此字段用於搜索,但我們也算過這樣的場面。方面工作正常,但使用相當多的資源,可能是因爲與條件相反的指數必須(重新)倒置。在任何提交之後構建fieldValud-Cache非常慢並且存在嚴重的性能問題。閱讀我認爲的文檔,該docValues應該解決這個問題。但是,如果我添加docValues="true"到外地的定義,我得到以下錯誤:

Field type text_t{class=org.apache.solr.schema.TextField,analyzer=org.apache.solr.analysis.TokenizerChain,args={class=solr.TextField, positionIncrementGap=100}} does not support doc values 

任何暗示如何獲得docValues與具有termVector字符串領域工作?或者如何加速在這樣一個領域的面對?

+0

docValues在TextField上不起作用。你可以在字符串字段上嘗試 – Mysterion

回答

3

在您遇到問題的那個旁邊添加第二個字段,其類型爲StrField。使用這個新的領域進行刻面,並做任何你想要的與另一個。

一般來說,我不建議在Solr中爲太多目的使用一個字段。如果您想要在某個字段中進行搜索,請針對該搜索目的對其進行優化,如果您想在該字段方面添加爲分面優化的第二個字段。如果這需要在多個領域複製內容,那就這樣做吧。

如果go by Solr's Wiki要使用的刻面的字段具有以下規格

Because faceting fields are often specified to serve two purposes, human-readable text and drill-down query value, they are frequently indexed differently from fields used for searching and sorting:

  • They are often not tokenized into separate words
  • They are often not mapped into lower case
  • Human-readable punctuation is often not removed (other than double-quotes)
  • There is often no need to store them, since stored values would look much like indexed values and the faceting mechanism is used for value retrieval.

爲什麼我寫的這一切,因爲我可以看到你已經使用了自定義字段類型,我認爲這個字段類型使用某種類型的標記。這可以解釋爲什麼你開始看到性能問題。