2013-01-09 68 views
0

我用Apache Solr 4和我在Solr新的,我想通過date chooser添加last_modified,但我得到異常,當我添加一些文件,它有自己的last_modified。我得到這個例外。 org.apache.solr.common.SolrException:壞請求Solrj查詢兩個日期例外

我加場shema.xmllas_date,但現在我不能查詢範圍內的兩個日期這樣 attr_las_date:2013-01-00T20:00:00Z TO 2013-01-10T19:59:59Z] ,因爲在schema.xmlattr_ *格式String

public static void indexFilesSolrCell(String fileName, String solrId,String fileAuthor, String fileDate,String fileDescription, String fileTitle) 
    throws IOException, SolrServerException { 

    String urlString = "http://localhost:8983/solr"; 
    SolrServer solr = new CommonsHttpSolrServer(urlString); 

    ContentStreamUpdateRequest up 
     = new ContentStreamUpdateRequest("/update/extract"); 
    up.addFile(new File(fileName)); 
    up.setParam("literal.id", solrId.replaceAll("\\s","").replaceAll("\\(","").replaceAll("\\)", "")); 
    up.setParam("literal.url", fileName); 
    up.setParam("literal.name", solrId); 
    up.setParam("literal.content_type",solrId); 
    up.setParam("uprefix", "attr_"); 
    up.setParam("fmap.content", "content"); 
    up.setParam("literal.owner",fileAuthor);  
    up.setParam("literal.last_modified", fileDate); 
    up.setParam("literal.description", fileDescription); 
    up.setParam("literal.title", fileTitle); 
    up.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true); 


    solr.request(up); 

    QueryResponse rsp = solr.query(new SolrQuery("*:*")); 
} 

我如何添加日期的文件?

+0

我知道,我加入這個領域<字段名= 「las_date」 類型= 「日期」 索引= 「真正的」 存儲=「真「/>,但是當我在兩年之間的範圍內工作真的,但是當我在兩天內我沒有得到任何東西 – user527

回答

0

應該有

<field name="las_date" type="date" indexed="true" stored="true" /> 

在schema.xml中