I'm writing a module for Orchard and I need to know how to query the Orchard DB for ContentItems with a specific part. I want to do this in my PartDriver so I can return a SelectList with all the ContentItems present. I understand most of what I need to do except for the part where I query Orchard for the ContentItems.
Any one? Thanks in advance!
Inject IContentManager and Query<YourPart, YourPartRecord>
Related
this is my first question, thanks in advance.
I am trying to customize the liferay results portlet and facets, with custom results. I need to filter the results once the search is launched, and remove the results that do not have layoutId :
with->
layoutIds = journalContentSearchLocalService.getLayoutIds(groupId,false,articleIdResult);
I´m doing this in a jsp fragment, but i think that it´s not correct.
I have been searching and i think the correct way is to modify the java class with the action, for example with acction coomand hook, is this correct?
Please, can you explain me the correct way to modify this functionalities?
Regards!!
ok. it looks you want result of journalarticle having display page is set. in that case, you need to look for JournalarticleModelPreFiltercontributor component extension or journalarticlepostprocessor if you are using legacy search api. when article gets indexed layoutuuid field is also indexed for each article. that field will have value if display page is set for specific web content or article.
So, you can use any of the above mentioned way to add check that this field should not be empty as search term. which will filter your result in request itself. instead adding overhead on result as later filtering in jsp.
I'm trying to create a content part in Orchard that will perform a request to a web server and display the results of the request. The problem I'm running into is that my part requires no user input and thus I have left the part and part record classes empty. I have a Migrations.cs file that adds a description to the part and makes it attachable as well as creates a content item with the part attached to it. When I go to create a new instance of my content type it tries writing to the database and fails. How do you create a content part in orchard that doesn't try to save to the database? Thank you.
The actual error I receive is:
null id in Orchard.ContentManagement.Records.ContentTypeRecord
I'm pretty sure you don't need to create new table since there are many parts which don't have any in Orchard. Try to remove MyCustomPartRecord.cs and change MyCustomPart.cs
public class MyCustomPart : ContentPart<MyCustomPartRecord>
to
public class MyCustomPart : ContentPart
Then just add driver and view and you should be good without extra tables ... In theory :D
The answer to my problem is even when your part ins't actually saving anything in the database you still need to include a table for the part so it can store the id. I just added the following to my Migrations.cs file and it fixed the problem.
SchemaBuilder.CreateTable("MyCustomPartRecord",
table => table
.ContentPartRecord()
);
I have HtmlBlock field and I want to add this field to Orchard CMS index.
Is there some stuff I have to implement to add field in index, like OnIndexing method for custom part indexing described here: https://orchard.codeplex.com/discussions/255183
To enable custom fields indexing you need to describe fields in FieldDriver.
protected override void Describe(DescribeMembersContext context)
{
context
.Member(null, typeof(string), T("HTML"), T("The HTML value of the field."))
.Enumerate<HtmlBlockField>(() => field => new[] { field.HTML });
}
Okay, so after I actually read your question instead of just writing a dumbass comment repeating random words you had written, fields in Orchard automagically get that "include in index" added to them. This is done in the Indexing module in Settings/EditorEvents.cs. It should then go ahead and index your field. Make sure you enable Indexing :)
I did just test it on my super quickly made field and it did appear to work. But I wouldn't say I'm 100% sure ^_^
I am trying to create a new content type in liferay. Just as the existing content types it already has (blogs,discussions or posts) , we would like to have a new content type holder(example : photo) in our application which can have the same features as the existing ones.
Firstly is it possible to customize liferay to achieve this ?
If yes, any pointers to the same will be of great help !!
Thanks.
Extends the portal-ext.properties:
journal.article.types=announcements,blogs,general,news,press-release,test
How do you order items when you override the QueryOverride property of the Content Query Web Part?
I have been given responsibility for a Web Part which extends the Content Query Web Part. The QueryOverride property of this Web Part is programmatically changed. Currently, the Web Part does not function as designed, as it does not order the items according to the appropriate field.
If I add an <OrderBy> node to the QueryOverride property I get an error message along the lines of 'something wrong with the query this web part is...' and the Content Query Web Part doesn't seem to have an OrderBy property which I could use instead.
The "QueryOverride property" part of this msdn article seems to suggest I should be able to add an <OrderBy> node to the QueryOverride but a number of web sites I've been reading suggest that this is not true.
So, how do you order items when you override the QueryOverride property of the Content Query Web Part?
Does your QueryOverride statement contain any Whitespace/linebreaks by any chance? I think I recall a while back having a situation where the QueryOverride needed to be all contained on one line, with no spaces between xml tags.
Weird I know, but try it out.
Also, for reference see the first community comment on the MSDN page http://msdn.microsoft.com/en-us/library/aa981241.aspx
THanks for this. Just to clarify, there should be no white spaces before or after the tags as well.
This did not work:
<![CDATA[
<OrderBy><FieldRef Name="EndDate" Ascending="False"/></OrderBy>
<Where>
But this did:
<![CDATA[<OrderBy><FieldRef Name="EndDate" Ascending="False"/></OrderBy><Where>
Wierd but thanks again for posting this answer, it saved me a lot of time.