2017-08-21 53 views

回答

1

您可以使用Hibernate Search的空間特徵:

import org.hibernate.search.annotations.*; 

@Entity 
@Indexed 
@Spatial 
public class Hotel { 

    @Latitude 
    Double latitude 

    @Longitude 
    Double longitude 

    // ... 
} 

最後你會與你的文檔中名爲location一個geo_point場。

欲瞭解更多信息:https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#spatial

+0

嗨約恩,我使用的空間註解,但得到的異常以下。 org.hibernate.search.engine.metadata.impl.TypeMetadata $ Builder.getAnalyzerReference(TypeMetadata.java:631)。任何建議? –

+0

回答了https://stackoverflow.com/questions/45818907/how-to-use-spatial-annotation/45822540#45822540專用問題 –

相關問題