저는 Solr in Spring에서 초보자입니다. Solr 4.6과 Spring 3.x를 사용 중입니다.스프링 데이터 Solr 제안을 얻는 방법
Solr을 Spring 어플리케이션에 성공적으로 구성했으며 아래 코드를 사용하여 주소를 검색 할 수 있습니다.
@Query("text:*?0*")
public List<AddressDocument> findAll(String searchText);
내 스키마
<fields>
<field name="id" type="long" indexed="true" stored="true" required="true" multiValued="false" />
<field name="name" type="string" indexed="false" stored="true" required="true" multiValued="false"/>
<field name="number" type="string" indexed="false" stored="true" required="true" multiValued="false"/>
<field name="address" type="text_general" indexed="false" stored="true" required="true" multiValued="false"/>
<field name="city" type="string" indexed="false" stored="true" multiValued="false"/>
<field name="state" type="string" indexed="false" stored="true" multiValued="false"/>
<field name="zipcode" type="string" indexed="false" stored="true" multiValued="false"/>
<field name="country" type="string" indexed="false" stored="true" multiValued="false"/>
<field name="latlng" type="string" indexed="false" stored="true" multiValued="false"/>
<field name="text" type="text_general" indexed="true" stored="false" multiValued="true"/>
<field name="_version_" type="long" indexed="true" stored="true"/>
</fields>
<!-- Configure unique key -->
<uniqueKey>id</uniqueKey>
<copyField source="name" dest="text"/>
<copyField source="number" dest="text"/>
<copyField source="address" dest="text"/>
<copyField source="city" dest="text"/>
<copyField source="state" dest="text"/>
<copyField source="zipcode" dest="text"/>
<copyField source="country" dest="text"/>
지금 내가 맞춤법 검사기를 통합 한 내가 그때 잘못된 철자를 입력 할 때 그것은 나를 로그에 응답을 다음 보여줍니다.
예를 들어 Frgo
을 입력하면 정확한 도시 이름은 Fargo
이고 출력이 아래에 표시됩니다.
2014-01-30 04:09:10,903 DEBUG [http-8080-2] (DirectSolrSpellChecker.java:179) - getSuggestions: [frgo]
2014-01-30 04:09:10,940 DEBUG [http-8080-2] (SpellCheckCollator.java:180) - Collation: text:*fargo* will return 3 hits.
2014-01-30 04:09:10,941 INFO [http-8080-2] (SolrCore.java:1864) - [customer_site_address] webapp=null path=/select params={q=text%3A*frgo*&start=0&rows=0} hits=0 status=0 QTime=43
2014-01-30 04:09:10,944 DEBUG [http-8080-2] (SolrTemplate.java:326) - Executing query 'q=text%3A*frgo*&start=0&rows=1' against solr.
2014-01-30 04:09:10,951 DEBUG [http-8080-2] (DirectSolrSpellChecker.java:179) - getSuggestions: [frgo]
2014-01-30 04:09:10,959 DEBUG [http-8080-2] (SpellCheckCollator.java:180) - Collation: text:*fargo* will return 3 hits.
2014-01-30 04:09:10,960 INFO [http-8080-2] (SolrCore.java:1864) - [customer_site_address] webapp=null path=/select params={q=text%3A*frgo*&start=0&rows=1} hits=0 status=0 QTime=15
2014-01-30 04:09:10,961 DEBUG [http-8080-2] (AbstractMessageConverterMethodProcessor.java:150) - Written [[]] as "application/json;charset=UTF-8" using [org.springf[email protected]1fb032d]
당신이보고 올바른 단어를 제시 로그하지만 난 @Query
또는 다른 주석을 사용하여이 제안을 얻을 수있는 방법을 모를 수 있듯이.
나는 많은 구글을 만들었지 만 완벽한 솔루션을 찾지 못했습니다.
아래의 이유와 의견을 공유하십시오. –