Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

# tigermain 10/2/2007 5:18 PM
Hi guys,

I've been looking at the ContentItem implementation in the SVN repo and have extended the StaticHTML module to implement it (in a similar way to the FileResource does). This has been successful with minimum work using the source provided in the repo. However I have tried as best as possible to merge the code with our own in house solution (based on cuyahoga) and despite various errors we have resolved I am hitting a wall with the StaticHTML ContentItem implementation.

My code has been duplicated exactly the only differences are my namespaces etc but I am consistenly getting the following errors. This one on Application start (which I think is the culprit looking at the Nhibernate Anaylser results):
These classes extend unmapped classes:
Cuyahoga.Modules.StaticHtml.StaticHtmlContent, Cuyahoga.Modules extends Cuyahoga.Core.Domain.ContentItem, Cuyahoga.Core

And this is everytime after initial build
in expected: s [from StaticHtmlContent s where s.Section.Id = ? ]

Below is a copy of the StaticHTML.hbm.xml file. The Module file inherits ContentItem and only has one additional property of Content. All the database tables have been altered as appropriate.
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
	<joined-subclass name="Cuyahoga.Modules.StaticHtml.StaticHtmlContent, Cuyahoga.Modules" extends="Cuyahoga.Core.Domain.ContentItem, Cuyahoga.Core" table="cm_statichtml"<

		<key column="statichtmlid" />
		<property name="Content" column="content" type="StringClob" />

	</joined-subclass>
</hibernate-mapping>
# mgaerber 10/2/2007 8:52 PM
Please check your Core.Service.SessionFactoryHelper class:

The SessionFactoryHelper's AddAssembly method has to skip assembly ordering to make the ContentItem subclasses recognized by NHibernate
	public void AddAssembly(Assembly assembly)
		{
			Configuration nhConfiguration = this._kernel[typeof(Configuration)] as Configuration;
			//has to have the second argument (true) for skipping ordering
            nhConfiguration.AddAssembly(assembly, true);
			ISessionFactory newSessionFactory = nhConfiguration.BuildSessionFactory();
			ReplaceSessionFactory(newSessionFactory);
		}
# tigermain 10/5/2007 1:15 PM
Thanks mgaerber that got it, bar a few more tweaks of my code.

Next problem is, we have implemented the search decorators to and have all seems to be good writing content to the index files, however when the files indexes are searched they return no results

I have deleted the index files and created new ones with both methods (with decorator and without) and have put them in a zip....

http://www.webdynamix.biz/downloads/searchdecorator.zip

....as you can see if you look at the files the copy is in both. So why would the Lucene results always be empty with the same criteria?!?!

# mgaerber 10/5/2007 1:43 PM
Hi,

this is a problem with the IndexQuery class. (Core.Service.Search) the method BuildSecurityQuery is used to add constraints to the query so you will only get results which the user has view rights for. It used to be on section level but I wanted to have rights for individual ContentItems.

I am not sure (yet) but I think this could be a bug in Lucene.net. The only way it can be solved (for now) is to leave the security checking on section level.
# tigermain 10/5/2007 2:29 PM
Thanks, could you tell what it is I need to comment out in order to get it working, I've tried uncommenting both
sectionOrContent.Add(bQueryContent, BooleanClause.Occur.SHOULD);

and
            //add the security constraint - must be satisfied
            query.Add(this.BuildSecurityQuery(sectionIds, userRoleIds), BooleanClause.Occur.MUST);
            //add the category query (if available)
            if (categoryNames != null)
            {
                query.Add(this.BuildCategoryQuery(categoryNames), BooleanClause.Occur.MUST);
            }

independently from IndexQuery.cs but neither has made the searching work, is it something to do with the code that builds the index as well?
# D3grade 10/11/2007 2:34 PM
Right, i've taken a look at this, and it seems to be 2 things stopping this from working.

1) Line 243 of Cuyahoga.Core.Service.Search.IndexBuilder is using Site.Id.ToString() instead of Site.Name

2) Line 247 of Cuyahoga.Core.Service.Search.IndexBuilder has it's index set to Field.Index.NO which should be Field.Index.UN_TOKENIZED

Relating to the second issue though, there is a comment that says
//do not index the sectionid here (since it's used for access filtering)

Can anyone tell me what this means?

Cheers

Matt
# D3grade 10/11/2007 5:41 PM
I also located another problem (not sure if this is just me, or to do with my recent workflow work) but if i did multiple opperations that wrote to the index, it wouldn't update properly.

I tracked it down to the fact that in IndexBuilder the _isClosed property is only ever set to false at it's decleration, so if the Close() method is called, it set to true, and thus any more writes would result in the file being left open.

To remedy this, i have added this._isClosed = false; to the end of the InitIndexWriter method.

Does this sound right? or am i doing something wrong?
# greyd 4/24/2008 6:54 AM
Heeeeelp

Trying to load my new module, NHibernate raise with
These classes extend unmapped classes:
Assembly.With.MyModule.PersistentClassXXXX, BaseAssembly extends BaseAssembly.That.Dont.Contain.Modules.BasePersistentClassXXXX, BaseAssembly

Example: assembly_test contains Client that extends baseassembly.Person (that not is a module, only a assembly)..

Points of Interest:

1. Both hbm files are embbeded resources
2. Container stops catastrophically without Error.aspx be launched (only default yellow/red asp.net page) Could i put some try... catch at Cuyahoga.Core to prevent this????
3. After the message above ("... classes extend ...") new reloads of page will be inform that Container is null...