FullTextQuery with field projections doesn't populate fields from IndexEmbedded components or classes
-----------------------------------------------------------------------------------------------------
Key: NHSR-38
URL: http://216.121.112.228/browse/NHSR-38
Project: NHibernate.Search
Issue Type: Bug
Components: Core
Affects Versions: 2.0.1
Reporter: Vasile Bujac
Assignee: Paul Hatcher
Priority: Minor
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
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|