Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Questions related to Searches View modes: 
User avatar
Certified Developer v7
Certified  Developer v7
Gitesh - 4/13/2012 12:37:10 AM
   
Questions related to Searches
Hi Guys,

Question 1:
I am creating a smart search filter.
I am using this code which is working perfect:

;;All
+classname;cms.smartphone;Smartphones
+classname;cms.laptop;Laptops
+classname;cms.itservice;IT services


So it is looking for the appropriate document type (e.g. smartphone or laptop)

Is it possible to look for a specific field inside a document type. e.g: cms.laptop.FieldName

So the smart search will see if that option is ticked for that page then only it will come up in the search results.

Question 2:
Where condition in the SQL search results can only look for default document fields(e.g. DocumentName) and cannot see the custom document type fields.
When I look for any custom document type in where condition: e.g.: Fieldname LIKE '%Anything%'. It says Invalid Column Name.
Is that how it works? can we not look for the custom document type in the where condition?

Question 3:
Can we show the results of a smart search dialog in a repeater?

Thanks
Gitesh Shah

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 4/17/2012 2:13:54 AM
   
RE:Questions related to Searches
Hi,

1. If you will check the search syntax documentation you can see that you can use just the Field name (e.g. NewsID: (int)10). The filed has to be set as searchable.

2. I am confused with the SQL search you mentioned but I think you still mean the smart search where condition - you can use it but in this case you need to create a sub-query in the where condition where you will select appropriate document type data.

3. Yes, you can use it - you will need to call the Search method which returns the dataset of results and then you can display this dataset using repeater.

Best regards,
Juraj Ondrus

User avatar
Member
Member
info-kentico-template - 4/19/2012 2:43:56 AM
   
RE:Questions related to Searches
Hi Juraj,


3. Yes, you can use it - you will need to call the Search method which returns the dataset of results and then you can display this dataset using repeater.


Can I do this with the portal engine? If yes, Which webparts will I be using?

Thanks


User avatar
Kentico Support
Kentico Support
kentico_jurajo - 4/19/2012 2:47:53 AM
   
RE:Questions related to Searches
Hi,

Yes, you can do it in portal engine too - it is custom coding. You will need to call the Search method on your own (the default control and its logic is here - \CMSModules\SmartSearch\Controls\SearchResults.ascx.cs) and this will return a dataset of the results. Then, you need to bind the dataset to some web part, e.g. to a basic repeater or whatever web part you want after the customization.

Best regards,
Juraj Ondrus

User avatar
Member
Member
info-kentico-template - 4/21/2012 8:47:21 PM
   
RE:Questions related to Searches
Hi juraj,

can you think of any examples where you/someone have already done this custom coding? So I can have a look and replicate as per my needs.

I can understand how the dataset is working now but not sure how to connect it with a repeater.

Thanks


User avatar
Member
Member
kentico_michal - 4/22/2012 7:27:55 AM
   
RE:Questions related to Searches
Hi,

Once you have retrieved the dataset, you can bind it to, for example, the repeater control:

BasicRepeater.DataSource = SearchResultsDataset;
BasicRepeater.DataBind();


Anyway, I would recommend you to go throught the following file that demonstrates how to use the SearchHelper.Search method as well as how to bind the repeater with the search results dataset: \CMSModules\SmartSearch\Controls\SearchResults.ascx.cs.

Best regards,
Michal Legen