Why don't you use a conversion tool like this http://www.developerfusion.com/tools/convert/csharp-to-vb/ to convert the c# examples to VB.Net.

The methods used in c# are the pretty same in VB, what changes is just the sintax.

John

Em 08/04/2012 10:15, Ralf Jantschek escreveu:
Hi Anders,
what am I trying to achieve?

Well, nothing more than to write an application where I can search
previously indexed documents.

Hope this helps.
Unfortunately your snippet did not.

Ralf

-----Ursprüngliche Nachricht-----
Von: Anders Lybecker [mailto:[email protected]]
Gesendet: Samstag, 7. April 2012 19:35
An: [email protected]
Betreff: Re: Newbie on Lucene with visualBasic

Hi Ralf,

You are not giving us much to work with.... What are you trying to archive?

Here is a simple rewrite of a C# program (I'm not sure it compiles, as I
don't have the VB.Net compiler)

Imports Lucene.Net.Analysis;
Imports Lucene.Net.Analysis.Standard;
Imports Lucene.Net.Documents;
Imports Lucene.Net.Index;
Imports Lucene.Net.QueryParsers;
Imports Lucene.Net.Search;
Imports Lucene.Net.Store;

             Dim version = Lucene.Net.Util.Version.LUCENE_29;

             Dim dir = new RAMDirectory();
             Dim analyzer = new StandardAnalyzer(version);

             -- Add content to the index
             Dim indexWriter = new IndexWriter(dir, analyzer,
IndexWriter.MaxFieldLength.UNLIMITED);


             Dim docs = new Document[3];

             docs[0] = new Document();
             docs[0].Add(new Field("id", "0", Field.Store.YES,
Field.Index.NOT_ANALYZED_NO_NORMS));
             docs[0].Add(new Field("name", "Anders Lybecker",
Field.Store.YES, Field.Index.ANALYZED));

             indexWriter.Commit();
             indexWriter.Close();


             -- Search for the content
             Dim parser = new MultiFieldQueryParser(version, new[] {
"biography" }, analyzer);
             Dim q = parser.Parse("Anders");


             Dim searcher = new IndexSearcher(dir, true);

             Dim hits = searcher.Search(q, null, 5, Sort.RELEVANCE);

             Console.WriteLine("Found {0} document(s) that matched query
'{1}':", hits.totalHits, q);
             For Each match As ScoreDoc In hits.scoreDocs
                 Dim doc = searcher.Doc(match.doc);

                 Console.WriteLine("Matched id = {0}, Name = {1}",
doc.Get("id"), doc.Get("name"));
     Next match

             searcher.Close();


:-)
Anders Lybecker

On Fri, Apr 6, 2012 at 4:32 PM, Ralf Jantschek<[email protected]>  wrote:

Hello,

can anyone point me to a hands on tutorial or documentation on how to
implement Lucene with VB?
I found various things using C# but couldn't get them to work under VB.

Thanks in advance

Ralf





Reply via email to