簡體   English   中英

org.apache.solr.client.solrj.impl.HttpSolrServer $ RemoteSolrException

[英]org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException

在我的Java程序中(QueryResponse response = solr.query(query);),我在線程“ main”中得到異常org.apache.solr.client.solrj.impl.HttpSolrServer $ RemoteSolrException:點必須位於“ lat,lon”或“ 'xy'格式:amazon.com。 我不明白我在這里犯的錯誤。

碼:

 public class Get {
    public static void main(String[] args) throws MalformedURLException, SolrServerException {
        HttpSolrServer solr = new HttpSolrServer("http://localhost:8080/solr");

        SolrQuery query = new SolrQuery();
        query.setQuery("sony digital camera");
        query.addFilterQuery("cat:electronics","store:amazon.com");
        query.setFields("id","price","merchant","cat","store");
        query.setStart(0);    
        query.set("defType", "edismax");

        QueryResponse response = solr.query(query);
        SolrDocumentList results = response.getResults();
        for (int i = 0; i < results.size(); ++i) {
          System.out.println(results.get(i));
        }
      }
}

沒人幫忙...謝謝。

原因是您要為字段store添加過濾器,如果您正在嘗試Solr發行版中example/目錄中的example/ ,則會使用location字段類型進行定義。 如示例中所定義的位置字段類型需要一個以緯度和經度表示的位置。 當您為該字段添加過濾器查詢以查找文本amazon.com (與store:amazon.com ),類型不匹配。 在嘗試通過string過濾時,該字段期望以latitude,longitude對的形式出現。

從示例schema.xml

<field name="store" type="location" indexed="true" stored="true"/>

[...]

<fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>

如果要使用單個字符串,則可以將字段store的字段類型改為string

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM