Installation and deployment Questions on installation, system configuration and deployment to the live server.
Version 4.x > Installation and deployment > Searching file attachements on custom documents View modes: 
User avatar
Member
Member
bluerhino_avanmeter - 3/11/2009 12:20:16 PM
   
Searching file attachements on custom documents
I've created a custom document called BRC.RhinoOnlineArticle that has 4 fields -
Name [Text]
Search Summary [Long Text]
Content [Long Text]
Attached File [File]

Searching the attached file is working correctly - however, I'm not able to display the custom Article fields in search results that match words within the file.

When the attached file is matched during the search, the ClassName in the search results table is set to "BRC.RhinoOnlineArticle", but none of the custom fields are returned.

I'd like to be able to show the Search Summary field along with the link to the document when the attached file is matched, instead of just the SearchResultName.

Is there a way to rewrite the searchtree or searchattachments queries to return the custom fields of the document the file is attached to?

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 3/16/2009 9:49:03 AM
   
RE:Searching file attachements on custom documents
Hello,

You can create custom function for transformation (http://www.kentico.com/docs/devguide/adding_custom_functions_to_tra.htm) that will check the type of document actually processed by transformation and in case of "BRC.RhinoOnlineArticle" type it return value of SearchSummary, while in other case it returns empty string. You can pass NodeID of document actually processed by transformation to your function and then use SelectNode (http://www.kentico.com/docs/devguide/selecting_nodes.htm) method to get TreeNode object of given document.

Best Regards,

Martin Dobsicek

User avatar
Member
Member
bluerhino_avanmeter - 3/17/2009 3:06:46 PM
   
RE:Searching file attachements on custom documents
I was hoping to avoid having to call the DB again for each attachment returned in the search results. Is there no way to write a searchattachments query for the BRC.RhinoOnlineArticle document type that would return the relevant fields?

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 3/18/2009 6:01:10 AM
   
RE:Searching file attachements on custom documents
Hi,

For this you need to create custom query which will search only the attachments. Then you can use this query e.g. in Query repeater.
you can use e.g. a text box for search and after clicking on the button, you will set the WHERE condition of your query dynamically.

Best Regards,
Juraj Ondrus