FullTextQuery with field projections doesn't populate fields from IndexEmbedded components or classes

Description

This is actually a very nice feature of NHibernate.Search, because it allows you to query against an lucene index without touching the database if one needs only stored fields from an entity.
Consider the following model:

[Indexed] public class Document { [DocumentId] public virtual Guid Id { get; set; } [Field(Index.Tokenized, Store = NHibernate.Search.Attributes.Store.Yes)] public virtual string Title { get; set; } [Field(Index.Tokenized, Store = NHibernate.Search.Attributes.Store.No)] public virtual string Body { get; set; } [IndexedEmbedded(Prefix = "User.")] public virtual UserDetails User { get; set; } } public class UserDetails { [Field(Store = NHibernate.Search.Attributes.Store.Yes)] public virtual string Username { get; set; } [Field(Store = NHibernate.Search.Attributes.Store.Yes)] public virtual string FullName { get; set; } }

I would like to perform a fulltext query and I need only Id, Title, User.FullName fields from this document

var results = session.CreateFullTextQuery<Document>("Title:django") .SetProjection("Id", "Title", "User.FullName") .SetMaxResults(5) .List();

The problem is a result item does not containt the "User.FullName" field. It seems that the problem is in the DocumentBuilder.ProcessFieldsForProjection private method. This method calls itself for each embedded mapping, but never uses the "Prefix" property of the embeddedmapping class. ITwoWayFieldBridge.Get("User.FullName", document) is ok, however

Environment

None

Attachments

1
  • 18 Nov 2011, 02:36 PM

Activity

Show:

Josh Thompson November 18, 2011 at 2:36 PM

A patch for this issue

Details

Assignee

Reporter

Components

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created April 21, 2011 at 2:10 PM
Updated May 12, 2014 at 10:51 PM
Who's Looking?