2013-01-09 67 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中