...
If you want to trigger automatically rebuild of the new index, when the synchronization is done, then look at the pipeline DFS.BatchSync
in App_Config\Include\damforsitecore\DFS.Pipelines.config. Change the indexName to your new index.
...
Example of searching
gfghfghHere is an example of how to search the index. We have 4 query filters.
First we say give me all entries where assetId is not empty.
Give me all assets, that are not crops.
Giv me only the assettype 4, which is images.
Last we freetext search the title.
Code Block | ||
---|---|---|
| ||
var index = ContentSearchManager.GetIndex("dfs_contentsearch_master_index"); using (var searchContext = index.CreateSearchContext(SearchSecurityOptions.DisableSecurityCheck)) { var queryable = searchContext.GetQueryable<AssetResultItem>().Where(q => q.AssetId != string.Empty); queryable = queryable.Where(q => q.Derivedfrom == "0"); queryable = queryable.Where(q => q.Assettype == "4"); queryable = queryable.Where(q => q.Title.Contains(freeText)); var res = queryable.GetResults(); foreach (var searchResult in res) { renderList.assets.Add(new asset() { htmlTag = searchResult.Document.Thumbhtmltag, title = searchResult.Document.Title }); } } |
...