views:

23

answers:

0

I'm using Lucene.net and C# to carry out a wildcard search on a folder containing text documents. The content of the text documents is contained in the field using a reader, like this:

doc.Add(new Field("contents", new System.IO.StreamReader(
    pathToFile, System.Text.Encoding.Default)));

An example search term might be "poss*" which I would expect to match "posse", "possible", "possibility" and so on. The Hits returned by Lucene do match the documents I expect, so I know the search is working correctly.

What I'm struggling with is how to find the word(s) matched in each document. For example, did it find "possible" or "posse" in a particular hit.

Any help would be gratefully received!