On 17.11.2010 21:15, asmcad wrote:

it's a simple index and search application but i couldn't make it work.
it doesn't give any error but it doesn't give any results too.


You're not adding a field with the name "contents"...

System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
39.
doc.Add(new

("text",encoding.GetBytes(file_text),Field.Store.YES));
40.
doc.Add(new
Field("path",encoding.GetBytes(@"C:\z\"),Field.Store.YES));
41.
doc.Add(new Field("title",
encoding.GetBytes(filename), Field.Store.YES));
42.
indexwrtr.AddDocument(doc);


... but here you rely on such a field name:

QueryParser parser = new QueryParser("contents", new
StandardAnalyzer());
54.

Awful source code formatting, BTW. Please take some care next time.

Robert

Reply via email to