|Okay - I'm back with one more hopefully simply answered query -
searching for sample code on the net and in the Manning book and in the
lucene.net source, the searching is of the form
file:///Incubating-Apache-Lucene.Net-2.0-004-11Mar07.bin/src/Lucene.Net/Overview.html
// Now search the index:
IndexSearcher isearcher = *new *IndexSearcher(directory);
// Parse a simple query that searches for "text":
Query query = QueryParser.parse("text", "fieldname", analyzer);
Hits hits = isearcher.search(query);
assertEquals(1, hits.length());
// Iterate through the results:
*for *(*int *i = 0; i < hits.length(); i++) {
Document hitDoc = hits.doc(i);
assertEquals("This is the text to be indexed.", hitDoc.get("fieldname"));
}
isearcher.close();
directory.close();
Two other samples showing similar code;
http://www.codeproject.com/useritems/Search_with_in_documents.asp
http://www.codeproject.com/aspnet/DotLuceneSearch.asp
However, when I come to actually compile an example like this, I find
the interface is quite different.
Lucene.Net.QueryParser.parse(string Q) only takes a single argument - if
I try the above code I get
[C# Error] WinForm.cs(110): No overload for method 'Parse' takes '3'
arguments
e:\Users\karlg\ChemDist\Incubating-Apache-Lucene.Net-2.0-004-11Mar07.bin\src\Lucene.Net\bin\Release\Lucene.Net.dll:
(Location of symbol related to previous error)
Ditto - IndexSearcher.search takes 4 arguments (weight, filter, docs, sort);
Can someone explain why there is this apparent inconsistency and point
me at a piece of sample searching that uses this interface my compiler
is offering? I am very confused in trying to make a sample search program.
Thanks for the patience.
Karl
|
________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.hi-speed.net.au
________________________________________________________________________