views:

35

answers:

1

Hi,

I'm trying to add a search field to my web site (ASP.NET MVC 2) and was told it'd be a good idea to use Nhibernate.Search, seeing that I was already using Nhibernate in the rest of the project.

Anyway, I followed a coulpe tutorials, namely this one, and some questions and answeres on this site, but in the end, it does not build an index, and searches come empty.

I know this question might be a bit vague, but it seems strange that nothing works even after I've done everything I was told.

Well, almost everything. At some point, in one of the tutorials, it tells me to type:

using (IFullTextSession s = Search.CreateFullTextSession(sf.OpenSession(new SearchInterceptor()))) {

        QueryParser qp = new QueryParser("id", new StopAnalyzer());

        IQuery NHQuery = s.CreateFullTextQuery(qp.Parse("Summary:series"), typeof(Book));

        IList result = NHQuery.List();

        Debug.Assert(result.Count == 2);
}

wich does not work because SearchInterceptor does not exist anywhere...

Am I missing something here? Is there a way to better write the search queries? In which part of my application does it build the index?

Thanks in advance.

A: 

Ok, after meddling a little more, I think I found where the problem might be.

Everything, including the query is fine, even the tagging in the class.

The only thing that is not happening is the indexing. When i "run" the application it creates a folder (where i told it to) with folders for each indexed class, with a segments file in each folder, which seems to be the supposed behaviour, except that the segments files have only 20bytes and seem to contain information about when they were created only, there is no actual index...

Any clues on how to fix this?

JLago