Example in VB using SolrNet

770 views
Skip to first unread message

Merlin

unread,
Jun 2, 2011, 1:32:43 AM6/2/11
to sol...@googlegroups.com

All,

 

I’m looking for an example written in Visual Basic that uses SolrNet.  Preferably, this example would not be a local installation, but show how to deploy the example accessed via the web.

 

Thanks in advance.

 

FF

 

Ted Forsman

unread,
Jun 2, 2011, 1:54:41 AM6/2/11
to sol...@googlegroups.com

Mauricio Scheffer

unread,
Jun 2, 2011, 10:06:06 AM6/2/11
to sol...@googlegroups.com
I'm not aware of any code samples of SolrNet using VB.NET, but C# and VB.NET are pretty much the same language (only syntax is different, and some minor details).
In fact there are many automatic converters from/to C# / VB.NET, see http://www.google.com/search?q=convert+C%23+to+vb.net

About deploying it, the sample app itself is no different from deploying any ASP.NET app.
There are many guides to install Solr on Windows, see for example:

--
Mauricio



--
You received this message because you are subscribed to the Google Groups "SolrNet" group.
To post to this group, send email to sol...@googlegroups.com.
To unsubscribe from this group, send email to solrnet+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/solrnet?hl=en.

Anthony Fassett

unread,
Aug 8, 2013, 9:25:33 AM8/8/13
to sol...@googlegroups.com, tfor...@ix.netcom.com, mer...@fantasyfootballcrystalball.com
I know this is an old post but since it's the first result in Google for a vb.net example using Solrnet I wanted to give people an update. I was able to get an working example by adding the following code...

//Inside Global.asax.vb file, inside your Application_Start()
Startup.Init(Of SearchResult)("http://localhost:8983/solr") //<--this connected the solrnet app.

//Inside your controller, SearchResult is just class like the one shown in the solrnet examples.
Dim solr As Object = ServiceLocator.Current.GetInstance(Of ISolrOperations(Of SearchResult))() <--Gets Instance.
Dim search = solr.Query(New SolrQueryByField("name", "solr")) //<--This is a just a basic Query.

This just a sample but the idea is there and people should what they need to get started. Like Mauricio stated you can just use a C# to VB.net converter to get the code you want by converting the Solrnet examples on the documentation site.

As a side note I did also created a WebAPI (C#) app that would in another way achieve this without having to write any VB.net code, simple call the WebAPI service in a Ajax call and that would remove the need to add Solrnet to an legacy (Vb.net) application like the one I was working. So if anyone else comes across this post, you have two option to work with.

Mauricio Scheffer

unread,
Aug 8, 2013, 10:00:48 AM8/8/13
to sol...@googlegroups.com
Hi Anthony, careful, the code above is not well-typed. I strongly recommend "option strict on" and "option infer on" whenever using VB.NET.

About WebAPI + Ajax, I think it's ok if you're using a client-side framework like angular/ember/etc as you're basically moving a lot of development effort to the browser, but otherwise it's not comparable to calling Solr directly on the web server.

Cheers






--
Mauricio


--
You received this message because you are subscribed to the Google Groups "SolrNet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to solrnet+u...@googlegroups.com.

To post to this group, send email to sol...@googlegroups.com.
Visit this group at http://groups.google.com/group/solrnet.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages