방금 Solr에 대해 조금 놀기 시작했고 Tomcat 서블릿 컨테이너 내에서 실행되도록 관리했습니다. 봄 데이터의 저장소 접근법을 사용하고 싶습니다. 그러나 위도/경도 필드 (즉, 지형 공간 데이터)를 처리하려고 할 때 갇혀 있습니다. 트윗과 유사한 데이터를 저장하고 싶습니다. 이것은 내가 현재 사용하고있는 스키마입니다 (따라하려고 wiki) :스프링 데이터 Solr 지오 어 큐브
이 내 POJO에 매핑하는 방법을 모르는 지리적 필드없이 잘 작동 할<?xml version="1.0" encoding="UTF-8" ?>
<schema name="tweets" version="1.1">
<types>
<fieldType name="string" class="solr.StrField"/>
<fieldType name="text1" class="solr.TextField">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.HunspellStemFilterFactory"
dictionary="../../dictionaries/es_ANY.dic"
affix="../../dictionaries/es_ANY.aff"
ignoreCase="true" />
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
</fieldType>
<fieldType name="text2" class="solr.TextField">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
<fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
<dynamicField name="*_coordinate" type="tdouble" indexed="true" stored="false"/>
<fieldType name="date" class="solr.DateField"/>
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
</types>
<fields>
<field name="id" type="string" indexed="true" stored="true" multiValued="false"/>
<field name="username" type="string" indexed="true" stored="true" multiValued="false"/>
<field name="pictureURL" type="string" indexed="false" stored="true" multiValued="false"/>
<field name="topic" type="string" indexed="true" stored="true" multiValued="false"/>
<field name="content" type="text1" indexed="true" stored="true"/>
<field name="hashtags" type="text2" indexed="true" stored="true"/>
<field name="geo" type="location" indexed="true" stored="true"/>
<field name="timestamp" type="date" indexed="true" stored="true"/>
<field name="_version_" type="long" indexed="true" stored="true"/>
</fields>
<uniqueKey>id</uniqueKey>
<defaultSearchField>id</defaultSearchField>
</schema>
은 (둘 다 사용하여 이중 시도 [] MongoDB를 훨씬 성공하지 지리적 필드 문자열) 같은
public class Tweet {
@Id
@Field
private String id;
@Field
private String username;
@Field
private String pictureURL;
@Field
private String topic;
@Field
private String content;
@Field
private List<String> hashtags;
@Field
private String geo;
@Field
private Date timestamp;
/** Getters/setters omitted **/
}
(단순한 문자열로서 지리적 영역을 매핑 [위도]는 [LNG])을 발생 예외이다
org.springframework.data.solr.UncategorizedSolrException: undefined field: "geo_0_coordinate"; nested exception is org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: undefined field: "geo_0_coordinate"
ried는 project tests을 보았지만 지역 필드를 사용하여 POJO를 찾지 못했습니다.
진행 방법에 대해 알고 싶습니다.
감사합니다.
'solr.LatLonType' 매핑을 위해'String' 또는'GeoLocation' 속성을 사용할 수 있습니다. 원인은 서버가 오류로 응답 할 때 매핑 자체가 아니라 쿼리 자체에있는 것으로 보입니다. 웹 인터페이스에서 서버를 직접 호출 할 때 실행중인 쿼리는 무엇이고 그 결과는 무엇입니까? –
안녕하세요 @ChristophStrobl, 내 단일 핵심 인스턴스에 새 문서를 추가하려고하고 그냥 지오 분야없이 잘 작동합니다. 더 이상의 제안? – jarandaf
'geo' 필드는'required'가 아니기 때문에'geo' 필드 없이도 작동합니다. 당신은 solr 로그를 보거나'MappingSolrConverter' 대신에'SolrJConverter'를 사용할 수 있습니다. 테스트와 샘플 사용을 위해서는'ITestMappingSolrConverter # convertedGeoLocationCorrectly'를보십시오. –