alexshyba / SitecoreSearchContrib

Extension to Sitecore.Search namespace. Includes AdvancedDatabaseCrawler and Searcher. Make sure to check out the website for the project.
http://sitecorian.github.io/SitecoreSearchContrib
25 stars 21 forks source link

Pipe delimited template IDs not working #1

Closed tohams closed 11 years ago

tohams commented 12 years ago

I'm trying to search based on several template IDs. This code does not return anything:

var searchParam = new SearchParam { Database = Sitecore.Context.Database.Name, Language = Sitecore.Context.Language.Name, TemplateIds = "{F05D8987-0241-48A1-A3FE-8F32872867C9}|{3333EF02-EA66-4FEA-8A9B-B82A72C34756}|{91B4744D-B60F-4FA8-A420-E32E4519A1D6}" };

However, this code does return results:

var searchParam = new SearchParam { Database = Sitecore.Context.Database.Name, Language = Sitecore.Context.Language.Name, TemplateIds = "{F05D8987-0241-48A1-A3FE-8F32872867C9}" };

My understanding is that the GUIDs should be pipe delimited, so I'm not sure why it doesn't work.

Is it me? Thanks!!

alexshyba commented 12 years ago

Hi Tohams,

I've reviewed the code of SearchParam class, and can see that multiple GUIDs are not supported for the Template filter. While I cannot recall why I decided not to do it for this filter, you can change this behavior by altering the ApplyTemplateFilter() method and call ApplyIdFilter from there which would take multiple GUIDs into account. This is quite a straightforward change, and I think I will incorporate it into the next ver. Please let me know if this does not work. I briefly tested locally, seems to be working great.

tohams commented 12 years ago

Totally worked. Easy money. Thanks!

bige54 commented 11 years ago

I am not quite as smart as Tohams and I need a little bit more help. Can you list ApplyTemplateFilter with the update you are talking about? I see that ApplyIdFilter has 2 paramaters, fieldname and filter, that are not in ApplyTemplateFilter, and I am not sure what values to put in there. Thanks.

bige54 commented 11 years ago

I figured it out, guess I'm a bit smarter than I thought. Thanks for the great tool!