Question

I have integrated Lucene.net and nhibernate.search together. I have a domain object that contains a file path, and this file path leads to a file on disc, which has file content. How would I use Lucene.Net/nhibernate.search to search through the file content of a saved file?

My index is being changed automatically with some listeners every time i save/delete/update the domain object.

[Indexed]
public class Book {
    private int id;
    private string name;
    private string filename;

    public Book() {
    }

    public Book(int id,string name, string filename) {
        this.id = id;
        this.name = name;
        this.filename = filename;
    }

    [DocumentId]
    public virtual int Id {
        get { return id; }
        set { id = value; }
    }

    [Field(Index.Tokenized, Store = Store.Yes)]
    public virtual string Name {
        get { return name; }
        set { name = value; }
    }  

    [Field(Index.Tokenized, Store = Store.Yes)]
    public virtual string FileName {
        get { return filename; }
        set { filename = value; }
    }
}
Was it helpful?

Solution

You will have to index that file content first with Lucene.Net

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top