Hi Everyone I am using SolNet Api for using Solr in my .Net project.When I am
trying to index the data solr throws an *Error:The remote server returned an
error: (400) Bad Request.*
/* Stacktrace */ at SolrNet.Impl.SolrConnection.Post(String relativeUrl, String s) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrConnection.cs:line 104 at SolrNet.Commands.AddCommand`1.Execute(ISolrConnection connection) in c:\prg\SolrNet\svn\SolrNet\Commands\AddCommand.cs:line 60 at SolrNet.Impl.SolrBasicServer`1.Send(ISolrCommand cmd) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrBasicServer.cs:line 87 at SolrNet.Impl.SolrBasicServer`1.SendAndParseHeader(ISolrCommand cmd) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrBasicServer.cs:line 91 at SolrNet.Impl.SolrBasicServer`1.AddWithBoost(IEnumerable`1 docs) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrBasicServer.cs:line 74 at SolrNet.Impl.SolrServer`1.Add(IEnumerable`1 docs) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrServer.cs:line 128 at Suvado.Solr.Common.SolrWrapper`1.UpdateItems(IEnumerable`1 items, Boolean commit) in D:\ArticleMgmt\ArticleMgmt\Suvado\Suvado.Solr.Common\SolrWrapper.cs:line 91 at Suvado.Solr.Indexing.ArticlesIndexingProcess.AddToSolr(IEnumerable`1 articlesToAdd) in D:\ArticleMgmt\ArticleMgmt\Suvado\Suvado.Solr.Indexing\ArticlesIndexingProcess.cs:line 148 at Suvado.Solr.Indexing.ArticlesIndexingProcess.RunInternal(DataGateway dataGateway) in D:\ArticleMgmt\ArticleMgmt\Suvado\Suvado.Solr.Indexing\ArticlesIndexingProcess.cs:line 82
* /Following is my cod/e *
*var Solr = ServiceLocator.Current.GetInstance<ISolrOperations&lt;T>>(typeof(T).Name + "_" + language);* *public ResponseHeader UpdateItems(IEnumerable<T> items, bool commit = false) { var result = Solr.Add(items); if (commit) Solr.Commit(); return result; }*
where *T is Article*
* /Article.cs/ * public class Article { [SolrUniqueKey] public long ArticleId{ get; set; }
[SolrField] public string Title { get; set; }
[SolrField] public string Description { get; set; }
[SolrField] public string ArticleURL { get; set; }
[SolrField] public string ImageURL { get; set; }
[SolrField] public string ArticleImageURL { get; set; }
[SolrField] public DateTime DateModified { get; set; }
[SolrField] public string Language { get; set; }
[SolrField] public string ArticleContent { get; set; }
public bool Deleted { get; set; }
}
Please find Schema for article_en here schema.xml <http://lucene.472066.n3.nabble.com/file/n4010417/schema.xml>
--
mihirhapaliya's gravatar image asked Sep 26 2012 at 06:21 in Lucene-Solr-User by mihirhapaliya

1 Answers

Check the Solr log. Most likely there's a mismatch between the fields in the Solr schema and the fields defined in your Article class. Also, please use the SolrNet mailing list for questions about SolrNet: https://groups.google.com/forum/?fromgroups#!forum/solrnet
-- Mauricio
On Wed, Sep 26, 2012 at 3:21 AM, mihirhapaliya Hi Everyone I am using SolNet Api for using Solr in my .Net project.When I > am > trying to index the data solr throws an *Error:The remote server returned > an > error: (400) Bad Request.* > > /* > Stacktrace > */ > at SolrNet.Impl.SolrConnection.Post(String relativeUrl, String s) in > c:\prg\SolrNet\svn\SolrNet\Impl\SolrConnection.cs:line 104 > at SolrNet.Commands.AddCommand`1.Execute(ISolrConnection connection) in > c:\prg\SolrNet\svn\SolrNet\Commands\AddCommand.cs:line 60 > at SolrNet.Impl.SolrBasicServer`1.Send(ISolrCommand cmd) in > c:\prg\SolrNet\svn\SolrNet\Impl\SolrBasicServer.cs:line 87 > at SolrNet.Impl.SolrBasicServer`1.SendAndParseHeader(ISolrCommand cmd) > in > c:\prg\SolrNet\svn\SolrNet\Impl\SolrBasicServer.cs:line 91 > at SolrNet.Impl.SolrBasicServer`1.AddWithBoost(IEnumerable`1 docs) in > c:\prg\SolrNet\svn\SolrNet\Impl\SolrBasicServer.cs:line 74 > at SolrNet.Impl.SolrServer`1.Add(IEnumerable`1 docs) in > c:\prg\SolrNet\svn\SolrNet\Impl\SolrServer.cs:line 128 > at Suvado.Solr.Common.SolrWrapper`1.UpdateItems(IEnumerable`1 items, > Boolean commit) in > D:\ArticleMgmt\ArticleMgmt\Suvado\Suvado.Solr.Common\SolrWrapper.cs:line 91 > at Suvado.Solr.Indexing.ArticlesIndexingProcess.AddToSolr(IEnumerable`1 > articlesToAdd) in > > D:\ArticleMgmt\ArticleMgmt\Suvado\Suvado.Solr.Indexing\ArticlesIndexingProcess.cs:line > 148 > at Suvado.Solr.Indexing.ArticlesIndexingProcess.RunInternal(DataGateway > dataGateway) in > > D:\ArticleMgmt\ArticleMgmt\Suvado\Suvado.Solr.Indexing\ArticlesIndexingProcess.cs:line > 82 > > > * > /Following is my cod/e > * > > *var Solr = > ServiceLocator.Current.GetInstance<ISolrOperations<T>>(typeof(T).Name + > "_" + language);* > *public ResponseHeader UpdateItems(IEnumerable<T> items, bool commit = > false) > { > var result = Solr.Add(items); > if (commit) > Solr.Commit(); > return result; > }* > > where *T is Article* > > * > /Article.cs/ > * > public class Article > { > [SolrUniqueKey] > public long ArticleId{ get; set; } > > [SolrField] > public string Title { get; set; } > > [SolrField] > public string Description { get; set; } > > [SolrField] > public string ArticleURL { get; set; } > > [SolrField] > public string ImageURL { get; set; } > > [SolrField] > public string ArticleImageURL { get; set; } > > [SolrField] > public DateTime DateModified { get; set; } > > [SolrField] > public string Language { get; set; } > > [SolrField] > public string ArticleContent { get; set; } > > public bool Deleted { get; set; } > > } > > Please find Schema for article_en here schema.xml > <http://lucene.472066.n3.nabble.com/file/n4010417/schema.xml> > > > > > > > -- >
Mauricio Scheffer's gravatar image answered Sep 27 2012 at 16:24 by Mauricio Scheffer
Facebook Google+ Twitter Linkedin
 Discussion Overview

 Group: Lucene-solr-user

 asked: Sep 26 2012 at 06:21

 active: Sep 27 2012 at 16:24

 posts: 2

 users: 2