Skip to content
June 21, 2014 / kiranpatils

MultiList with Search returns duplicate results

Challenge:

We’ve been using Multilist with Search It was working fine. But while working on one of our project we observed a strange behavior. Whenever we searched anything it was returning us duplicate results like this:

MultiList-With-Search-Duplicate-Results

After doing bit of a research we found that, It was because the items which we were seeing twice do have Multiple versions – Here by Version I meant to say Item’s Version and NOT Language version. So, if you would like to reproduce this scenario. Just add multiple versions of Item and give it a go.

So, If you are facing similar challenge and looking for a solution then this post is for you!

Solution:

To find a root cause of this issue, as per our practice we Googled it (So, as yours?!) and found following posts:

Check their comments section:

“Hi Guys,

Is there any way to get the repository items with newest version?
I’ve got an issue in multilist with search, I’m trying to get items as source in multilist but the item should only visible the latest version. Right now whole version appear in selection box, if one item has 3 version whole version visible in selection box.

Thanks,
NK ”

“Seconding Novan’s comment here. Multiple language versions are also listed – is there a possibility to limit the search to only search for items that exist in a specific language? ”

Second post, article has written this comment:

Hi Patrick,

Is there way to pick the latest version of the item and default the language to the items language. For example I have an item “ABC” with two version in English and one in Chinese. When i search the treelist with search control on a Chinese item, i get all the above 3 versions with no other information on what is what. Instead i would expect the a query that would return me version 1 of the Chinese item.

Where authors said, It’s not possible 😦

Then raised it in SDN Forum — http://sdn.sitecore.net/SDN5/Forum/ShowPost.aspx?PostID=61608

There also no reply 😦 And then reached out to the best guys in this Sitecore world — Sitecore Support  team, and they helped us to find a solution!

Here’s what they shared (Just a note : We got this hot-fix for Sitecore 7.2 Update 2 version. So, If your vesion is different. Please do talk to Sitecore support guys by mentioning Ticket#412194):

The cause of the issue is composed query that uses wrong language parameter (__language with double underscore) and that’s why returns no results. I will let you know as soon as I find out a solution.

I didn’t figure out how to cease the initial cause of the issue. Right now I can propose you to use the following workaround:
1. Copy the attached Sitecore.Support.412550.dll to the bin folder.
2. Add the following processor to the very bottom of the contentSearch.translateQuery pipeline in \Website\App_Config\Include\Sitecore.ContentSearch.config:
<contentSearch.translateQuery>

<processor type=”Sitecore.Support.ContentSearch.Pipelines.TranslateQuery.TrimmingSearchQuery, Sitecore.Support.412550″ />
</contentSearch.translateQuery>
3. Use filter with _latestversion:*, e.g. on my side I used the following filter:
StartSearchLocation={110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}&TemplateFilter={76036F5E-CBCE-46D1-AF0A-4143F9B557AA}&Filter=+_language:en|+_latestversion:*

Just a note: such a filter seems to be working well in IE even without the suggested fix, but not in Chrome.

In summary, they accepted that this is a BUG, and  they provided us a hot-fix to overcome this challenge.

Quick tips : While working on this challenge found few gems, which would like to share with you:

P.S. : Special thanks to  Alexander Sharamok (Sitecore Support) for providing this suggestion Marcia who worked on this challenge!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: