Question

This code works fine:

Query query = parser.Parse(expression);

IFullTextSession session = Search.CreateFullTextSession(this.Session);

IFullTextQuery fullTextQuery = session.CreateFullTextQuery(query, new[] { typeof(MappedSequence) });

var l1 = fullTextQuery.List();

as long as the query does not return too many objects. If the query contains too many objects the generated sql code is too long and sql server throws an exception. One working solution is to obtain all objects using paging which is fairly slow. Is there a better solution?

Thanks.

C

Was it helpful?

Solution

If I remember correctly, fullTextQuery.List() does a big

select ... where ID_COL IN ( id1, id2, id3, id4 ... )

where id1, id2 ... are parameters, which number is limited in SQL Server. This way, you get NHibernate entities from lucene documents. Long story short, there is no workaround, except paging.

You can use page size of 1000 elements, if you REALLY need to get this much of data.

Getting 1000's of entities would be slow somewhere : when you display them on screen, for exemple.

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