Does SolrNet support pdf/doc file upload

136 views
Skip to first unread message

ravi kanasagra

unread,
Apr 29, 2015, 7:12:19 AM4/29/15
to sol...@googlegroups.com

Does SolrNet support pdf/doc file upload? If yes, can you please share sample code snippet.

Mauricio Scheffer

unread,
Apr 29, 2015, 7:17:19 AM4/29/15
to sol...@googlegroups.com

ravi kanasagra

unread,
Apr 29, 2015, 8:47:52 AM4/29/15
to sol...@googlegroups.com
@Mauricio,

I have created a sample code that worked by taking latest zip code, built it and refer that dlls worked for me. If I take latest pre released solrnet dll from nuget, it is not working and throwing "400" error. 

Sample Code:

public interface IndexDocument
   
{


   
}


   
class Program
   
{
       
static void Main(string[] args)
       
{
           
try
           
{
               
Startup.Init<IndexDocument>("http://localhost:8090/solr/Core3");
               
var solr = ServiceLocator.Current.GetInstance<ISolrOperations<IndexDocument>>();


               
using (FileStream fileStream = File.OpenRead(@"D:\Ravi\Solr\SolrClient\SolrClient\solr-word.pdf"))
               
{
                   
var response =
                        solr
.Extract(
                           
new ExtractParameters(fileStream, "doc3")
                           
{
                               
ExtractFormat = ExtractFormat.Text,
                               
ExtractOnly = false
                           
});
               
}


                solr
.Commit();


               
Console.ReadLine();
           
}
           
catch (Exception ex)
           
{
               
Console.WriteLine(ex.Message);
           
}
       
}
   
}

I am very new to solr and solrnet. Can you please help me providing some details that what different things I can add in interface "IndexDocument" and "ExtractParameters" i.e. different variations.

Regards,
Ravi

---------------------------------------------------------------

Mauricio Scheffer

unread,
May 3, 2015, 9:30:29 AM5/3/15
to sol...@googlegroups.com
You need to get the error message, either from the SolrNet Exception or the Solr log.
Reply all
Reply to author
Forward
0 new messages