2015-09-02 18 views
2

嘗試以下:如何在SOLR 5.X中擁有動態位置字段?

<dynamicField name="Meta_p_*" type="location"  indexed="true" stored="true"/> 
    <dynamicField name="Meta_p_*_0_coordinate" type="double" indexed="true" stored="true" /> 
    <dynamicField name="Meta_p_*_1_coordinate" type="double" indexed="true" stored="true" /> 

了Solr的錯誤時拋出

Caused by: Dynamic field name 'Meta_p_*_0_coordinate' should have either a leading or a trailing asterisk, and no others. 

嘗試:

<dynamicField name="Meta_p_*" type="location"  indexed="true" stored="true"/> 
    <Field name="Meta_p_*_0_coordinate" type="double" indexed="true" stored="true" /> 
    <Field name="Meta_p_*_1_coordinate" type="double" indexed="true" stored="true" /> 

給自己買了空的核心,但試圖插入新文檔時有:

Error adding field 'Meta_p_mylocation'='45.17614,-93.87341' msg=LatLonType uses multiple fields. 

quastion - 有沒有辦法在Solr 5.X中添加動態字段?

回答

0

動態字段「Meta_p _ * _ 0_coordinate」是double的類型。

它只會像存儲雙45.17614值..

Solr的給了一個例外,因爲你試圖樣的存儲字符串('45 0.17614,-93.87341' )值。

我認爲solr不支持動態字段中的LatLon類型字段。

如果你想使用Solr的空間搜索功能,您需要定義字段(非動態),它的類型是solr.LatLonType的

參見:https://wiki.apache.org/solr/SpatialSearch