Why are definitions missing ? Lucene.Net 3.0.3 - Fast Vector Highlighter

644 views Asked by At

As a newbie to Lucene.Net/Lucene and to C# I was able to put some lines of code and have a search running.

Now I want to get a snippet of the found area back. I have found below code but Visual Studio keeps telling me that a) "Searcher does contain a definition of getIndexReader" and b) "ScoreDoc does not contain a definition of doc" -and I don't get the point where the problem is!

Is there anybody out there who can help.

I am using Lucene.Net 3.0.3 and Lucene Contrib 3.0.3 on Visual Studio 2010 Express.

See the code I have below.

Thanks for your help!

RC


IndexReader indexReader = IndexReader.Open(directory, true);
            Searcher indexSearch = new IndexSearcher(indexReader);

            var queryParser = new QueryParser(Version.LUCENE_30, "text", analyzer);
            var query = queryParser.Parse("\"system AKZ\"~10");

            Console.WriteLine("Searching for: " +  query);

            TopDocs hits = indexSearch.Search(query,500);
            /// Highlighter 


            FastVectorHighlighter fvHighlighter = new FastVectorHighlighter(true, true);
            for (int i = 0; i < hits.ScoreDocs.Length; i++)
                {
                    string bestfragment fvHighlighter.GetBestFragment(fvHighlighter.GetFieldQuery(query),indexSearch.getIndexReader(), hits.ScoreDocs[i].doc, "text", 20);
                    MessageBox.Show(bestfragment);
                }

            Console.WriteLine("Results Found: " + hits.TotalHits);
3

There are 3 answers

0
Mark Leighton Fisher On

I would pull out something like ILSpy to examine what methods actually are available.

0
Dillorscroft On

This is just a problem with the case of the method names. It's GetIndexReader() for example not getIndexReader(). You are probably basing this on docs for the Java implementation.

0
Mouine Med On

in Lucene.net this method's name is IndexReader.