我是新的SolrNet和Asp.Net也:) 請打我回答,如何配置SolrNet的Web窗體。Solrnet與Web窗體
400 http error http://clip2net.com/clip/m12007/1276888290-clip-13kb.png
public partial class CreateIndex : System.Web.UI.Page {
//http://localhost:8983/solr
private static readonly string solrURL = ConfigurationManager.AppSettings["solrUrl"];
protected void Page_Load(object sender, EventArgs e) {
var connection = new SolrConnection(solrURL);
Startup.Init<SolrProductDTO>(connection);
Entities db = new Entities();
var index = (from i in db.ItemBases.OfType<Product>()
where i.Quantity != null && i.Category != null
select new SolrProductDTO()
{
Category = i.Category.Name,
Id = i.Id,
InStock = i.IsDeleted,
Timestamp = i.CreatedDate,
Description = i.Description,
Title = i.Name
}).ToList();
var solr = ServiceLocator.Current.GetInstance<ISolrOperations<SolrProductDTO>>();
solr.Delete(SolrQuery.All);
solr.Add(index);
solr.Commit();
}
這纔是我的DTO:
public class SolrProductDTO {
[SolrUniqueKey("id")]
public int Id { get; set; }
[SolrField("cat")]
public string Category { get; set; }
[SolrField("title")]
public string Title { get; set; }
[SolrField("desc")]
public string Description { get; set; }
[SolrField("inStock")]
public bool InStock { get; set; }
[SolrField("timestamp")]
public DateTime Timestamp { get; set; }
}
請幫助!!!!
你通過控制檯運行Solr嗎? (即'java -jar start.jar'?)檢查Solr控制檯日誌。 – 2010-06-18 20:46:55
我在Apache Tomcat下使用LucidWorks => Solr。 – omoto 2010-06-19 07:48:19
你可以檢查Solr日誌併發布完整的異常消息嗎? – 2010-06-19 07:50:54