QnaList > Groups > Lucene-Solr-User > Sep 2012
faq

Error In SolrNet:The Remote Server Returned An Error: (400) Bad Request

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>(typeof(T).Name +
"_" + language);*
*public ResponseHeader UpdateItems(IEnumerable 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
--
View this message in context: http://lucene.472066.n3.nabble.com/Error-in-SolrNet-The-remote-server-returned-an-error-400-Bad-Request-tp4010417.html
Sent from the Solr - User mailing list archive at Nabble.com.

asked Sep 26 2012 at 06:21

mihirhapaliya's gravatar image



1 Replies for : Error In SolrNet:The Remote Server Returned An Error: (400) Bad Request
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 wrote:
> 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(typeof(T).Name +
> "_" + language);*
> *public ResponseHeader UpdateItems(IEnumerable 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
> 
>
>
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Error-in-SolrNet-The-remote-server-returned-an-error-400-Bad-Request-tp4010417.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

answered Sep 27 2012 at 16:24

Mauricio Scheffer's gravatar image


Related discussions

Tagged

Group Lucene-solr-user

asked Sep 26 2012 at 06:21

active Sep 27 2012 at 16:24

posts:2

users:2

©2013 QnaList.com . QnaList is part of ZisaTechnologies LLC.