I have a field defined :

[Field, FullText("English")]
         public string Html { get; set; }

I have checked the postgres config and the free text config is setup.

I am getting the following error on domain build and not sure what it means:

TestFixture failed: Xtensive.Storage.DomainBuilderException : Unable to build full-text indexes for hierarchy 'NNet.Model.Content.Content' with InheritanceSchema.ClassTable. at Xtensive.Storage.Building.Builders.IndexBuilder.BuildFullTextIndexesClassTable(TypeInfo root, IEnumerable`1 hierarchyIndexes) at Xtensive.Storage.Building.Builders.IndexBuilder.BuildFullTextIndexes() at Xtensive.Storage.Building.Builders.IndexBuilder.BuildIndexes() at Xtensive.Storage.Building.Builders.ModelBuilder.BuildModel() at Xtensive.Storage.Building.Builders.ModelBuilder.Run() at Xtensive.Storage.Building.Builders.DomainBuilder.BuildModel() at Xtensive.Storage.Building.Builders.DomainBuilder.BuildDomain(DomainConfiguration configuration, DomainBuilderConfiguration builderConfiguration) at Xtensive.Storage.Upgrade.UpgradingDomainBuilder.BuildStageDomain(UpgradeStage stage) at Xtensive.Storage.Upgrade.UpgradingDomainBuilder.Build(DomainConfiguration configuration) at Xtensive.Storage.Domain.Build(DomainConfiguration configuration) at NNet.Model.Test.AutoBuildTest.BuildDomain(DomainConfiguration configuration) in D:\Project\NNet-Web\NNet-Model-Test\AutoBuildTest.cs:line 37

full code :

namespace NNet.Model.Content.Article {

    class Article : Content {

        [Field, LengthConstraint(Min = 2, Max = 50), NotNullOrEmptyConstraint]
        /// <summary>Title of Article</summary>
        public string Title { get; set; }

        [Field, LengthConstraint(Min = 2, Max = 150), NotNullOrEmptyConstraint]
        /// <summary>Summary of Article</summary>
        public string Summary { get; set; }

        [Field, FullText("English")]
        /// <summary>Article content</summary>
        public string Html { get; set; }


namespace NNet.Model.Content {
    class Content : Entity {
        [Field, Key]
        public long Id { get; private set; }

This thread was imported from our support forum. The original discussion may contain more detailed answer.

asked Jun 22 '10 at 18:31

Tony's gravatar image


One Answer:

There is really the following restriction:

if (hierarchyIndexes.Any(fti => fti.Type.UnderlyingType != root.UnderlyingType) || indexesToDefine.Count > 1)
        throw new DomainBuilderException(string.Format(Strings.ExUnableToBuildFulltextIndexesForHierarchyWithInheritanceSchemaClassTable, root.Name));

I.e. full-text indexes can be declared only in hierarchy root types for class-table inheritance schema. Other inheritance schemas don't have this limitation. I'll ask the guys why it is enforced here - there must be some strong reasons for this.

Ok, so I got the explanation.

There are two important rules that determine such behavior:

  • Query.FreeText<t>(...) must return all the suitable descendants of T as well. I.e. we expect that Query.FreeText<tbase>(condition).Where(match => match.Entity is TDescendant).Select(match => match.Entity) returns the same set of entities as Query.FreeText<tdescandant>(condition).Select(match => match.Entity).
  • Placing [FullText] on a field means it will be included into full-text index that is bound to table related to this type.

Now note that we have 3 cases based on inheritance mapping strategy:

  • SingleTable: ideal case, since all the fields are included into the only full-text index for the whole hierarchy. So query for any T there will use this index; further we'll filter results based on Entity.TypeId - that's it.
  • ClassTable: good case as well, but only if all full-text fields (and thus - full-text index) are declared in hierarchy root. Otherwise query like Query.FreeText<cat>("mammal") won't return most of Cats, because "Mammal" is value of Animal.Class field (full-text indexed as well), but its index is bound to Animal-related table, but not Cat-related table. So in this case rule 1 is is broken, and the only way to satisfy it is to support full-text fields on hierarchy root only.
  • ConcreteTable: bad case, since there is no way to enforce this at all. I think now you'll easily conclude, why. Btw, currently it's allowed to create full-text indexes here, although we consider disabling this case at all, since rule 1 is anyway broken in this case: currently Query.FreeText<t>(...) here returns only entities with exact type T.

answered Jun 22 '10 at 22:00

Alex%20Yakunin's gravatar image

Alex Yakunin

Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview


Once you sign in you will be able to subscribe for any updates here



Asked: Jun 22 '10 at 18:31

Seen: 3,956 times

Last updated: Jun 22 '10 at 18:31

powered by OSQA