I believe the EPiSearchClient class has been renamed as SearchClient (EPiServer.Find.Framework) and I did find the GetPagesResult method in the EPiServer.Find.Cms assembly - forgot that it was an extension method :)
Now need to figure out how to include/exclude certain page properties during indexing...
Hi Tamim!
You can find information about excluding properties here and general information about customizing serialization here.
Both those links are about the general .NET API but applies to the CMS integration as well. If you go with the approach of customizing serialization through modifying the SearchClient's conventions you should do so at application startup, preferably in an initialization module. Let me know if you want me to create a simple example.
Hi Joel,
Thanks for the reply.
Yes, I did check out those posts earlier but I'm having trouble locating the ForInstancesOf<T> method on the Conventions object. Again not sure if this has been renamed. The version of the EPiServer.Find.dll and related assemblies I'm currently referencing is 1.0.0.170.
Also, please correct me if I'm wrong in the approach I need to take:
Since all the required properties have been included in the conventions (first step), I assume I wouldn't require to include properties again using the 'InFields' method while retrieving the search results?
Hi!
The ForInstancesOf<T> method is located in the EPiServer.Find.ClientConventions and is an extension method for IClientConventions which is returned by the client's Conventions property. Let me know if it still doesn't work?
The approach you mention is absolutely viable, but it has two drawbacks:
I would recommend explicitly specifying fields to search in and only use ExcludeField to exclude fields that either causes problems while indexing. This approach has the drawback that you need to be able to specify fields which may not exist in all page types which is tricky to do in a strongly typed way. Therefor I generally recommend adding a custom "all field" in the form of a property which contains the searchable text. This can then vary between different page types. Doing that also makes it easier to work with highlighting. See this blog post, especially the headling "Indexing a special property for highlighting", for some more details and inspiration.
Thanks for the explanation. Two points though:
- I've been looking at PageIndexer.Instance.Conventions for the ForInstancesOf method all the while, so changed it to use SearchClient as you pointed out and it's all fine now. I think the code examples at http://find.episerver.com/Documentation/episerver-cms-integration-indexing need updating as the Conventions object on the PageIndexer instance is of type IPageIndexerConventions which doesn't seem to have a corresponding ForInstancesOf extension method.
- Basically I have a pagetype with two text based properties - MainBody and SecondaryBody. However, no content from these two properties seems to be captured when pages of this pagetype are indexed. Hence, these pages do not come up in the results if I search for a word present in the content of MainBody or SecondaryBody. Initially, I'd expected that I wouldn't need to explicitly include these properties in the conventions using the IncludeField method. But since content from these properties is not being indexed, I'm then trying to explicitly include them in the conventions. Is it not the case that all text based properties in a pagetype get indexed automatically?
There's an ForInstancesOf extension method for IPageIndexerConventions which resides in a different namespace which wasn't clear from the documentation. I've updated it with using statements in the code examples now :)
Are you using Page Type Builder and have declared the MainBody and SecondaryBody properties through code?
Thanks.
I'm using the standard 6R2 Alloy Tech demo site, so it's without PTB. All pagetypes and properties have been manually added.
Ah! Find is designed for sites using PTB or typed pages in the next version of the CMS so properties that aren't strongly typed, meaning pretty much everything except PageName and a few other built in properties, won't be indexed. It's definitely possible to still use Find without having strongly typed page types, but then you have to do as you've done so far, explicitly modify the conventions to include them.
To utilize the full potential of Find I'd strongly recommend you to use PTB. Doing so on an existing site can quite easily be done thanks to a great plug-in created by Erik Nordin which will create classes from an existing database with page types.
Makes sense now. I basically wanted to try out Find, so I'd simply installed the demo site as it is. Will use a PTB based site now :)
Thanks a lot for your help.
Maybe I haven't researched enough but I'm not able to find the EPiSearchClient class in any of the EPiServer.Find and related assemblies as mentioned in the following URLs:
http://find.episerver.com/Documentation/episerver-integration
http://find.episerver.com/Documentation/episerver-cms-integration-getpagesresult-and-getfilesresult
The closest I could find is the EPiServer.Find.SearchClient class (in the EPiServer.Find.Frameword dll) but this class doesn't seem to have the GetPagesResult or GetFilesResult methods.
Not sure if the EPiSearchClient class or the GetPagesResult method has been replaced by another one or if I'm completely treading on the wrong track... Please advise. Thanks.