Hi all

I have a table look like:

CREATE TABLE [dbo].[Order](
        [OrderID] [int] IDENTITY(1,1) NOT NULL,
        [UserID] [int] NOT NULL,
        [ProductID] [int] NOT NULL,
        [OrderDate] [datetime] NOT NULL,
        [UnitPrice] [money] NOT NULL,
        [Quantity] [float] NOT NULL,
        [Comment] [nvarchar](200) NULL,
) ON [PRIMARY]

I used NHibernate to build search of order history, meanwhile I also
leverage NHibernate.Search to search agains Comment field (due to full
text search reason).

I could build Linq query to search agains UserID, ProductID, OrderDate
fields and so on:
IQueryable<Order> orders = orderRecordRepository.GetList();
orders = orders.Where(o => o.User.Id == 1 && o.Product.Id == 100 &&
o.OrderDate <= DateTime.Now);

Now I come with question that if I need to include Comment field
search, I need to create another fulltext session like:
IFullTextSession fullTextSession =
Search.CreateFullTextSession(this.session);
return
fullTextSession.CreateFullTextQuery<T>(fulltextQuery).List<T>();

The hehavior of first query seems to be isolated from second one. if I
need to search order with UserID, ProductID, OrderDate + some texts
inside Comments, I have to perform 2 separated searches to obtain 2
different lists and then find overlapped result to get final list. It
seems to be very inefficient.

I am just wandering what is your practice in this situation.

Thanks
Hardy

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@googlegroups.com.
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to