嘿我正在尝试将自动填充功能添加到我的应用程序中,但它给了我错误。
sunspot-2.1.1/lib/sunspot/dsl/fields.rb:93:in
rescue in method_missing': undefined method
autocomplete' for #Sunspot::DSL::Fields:0x000001029b7cd0 (NoMethodError)
以下是我所做的更改。感谢您的帮助。
模型
rescue in method_missing': undefined method
Solr Schema.xml
def category_name
self.name
end
searchable do
text :name
autocomplete :category_name, :as => :name
end
HTML
<fieldType name="autocomplete" class="solr.TextField" positionIncrementGap="100">
<!-- The index analyzer adds parts of the field from 2 - 25 chars including whitespace etc. -->
<analyzer type="index">
<tokenizer class="solr.NGramTokenizerFactory" minGramSize="2" maxGramSize="25"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<!-- The query analyzer takes the whole input, whitespace and all -->
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
<fieldType name="autosuggest" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.LetterTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="25" />
</analyzer>
<analyzer type="query">
<tokenizer class="solr.LetterTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
答案 0 :(得分:0)
我将JRE从openJDK更改为Oracle并重新安装了所有内容。它现在有效。