API
Version 7.x > API > Smart Search By Culture View modes: 
User avatar
Certified Developer 9
Certified Developer 9
piyushkothari3 - 2/11/2014 11:17:19 PM
   
Smart Search By Culture
i have implemented a smart search for resources on our site, it contains results from all the cultures documents are in,

for ex: if DocumentA in en-US and de-DE culture, it would return both documents in search result

now i want user to be able to search in one/more of the culture they select
using checkbox list or dropdown smart search filter

what values should i put in smart search filter

i tried these values
DocumentCulture;en-US;English
DocumentCulture;de-DE;German

but it doesn't return anything

User avatar
Kentico Support
Kentico Support
kentico_romank - 2/13/2014 2:11:49 AM
   
RE:Smart Search By Culture
Hi,

Since Piyush has valid maintenance contract, we have been in contact via email. Here is the possible solution, in case that anyone else has similar requirement.

There are few options how you can achieve this scenario, but first of all please make sure that you have done the following things:

1) DocumentCulture field must be searchable and tokenized (Site Manager -> Development -> System tables -> Ecommerce - SKU -> Search fields -> DocumentCulture)
2) You have to include all culture in your index (SM -> Administration -> Smart search -> your index -> Cultures)
3) In search result web part, set culture code property to ##ALL##

Now lets discuss the option you have (I suppose you are using smart search dialog, smart search filter and smart search results web parts on your page):

First option
In search filter set following properties:
- filter mode property: radio button
- values:
;;All
+DocumentCulture;cs-cz;Cesky
+DocumentCulture;en-us;English
-filter clause: none

There should be three radio buttons: All - all documents of all cultures are displayed, Cesky - only documents in Czech culture are displayed, English - only documents in English culture are displayed.

Second option
In search filter set following properties:
- filter mode property: checkbox
-values:
DocumentCulture;cs-cz;Cesky
DocumentCulture;en-us;English
-filter clause: must not

Now there should be two checkboxes, if you enter some search text without any checkbox enabled all documents of all cultures will be displayed. If you enable English checkbox, only documents in Czech culture will be displayed and vice versa. In case you will enable both checkboxes no documents will be displayed.. This approach might not be very user-friendly, but you can invert the behavior of the checkboxes, so for example if you check English, only documents in English culture will be displayed. In this case you will have to modify smart search filter web part, specificaly checkbox control and there invert this behavior.

Third option
Please note that this option will be functional only after applying the hotfix number 75.

In Search filter set following properties:
-filter mode property: checkbox
-values:
DocumentCulture;cs-cz;Cesky
DocumentCulture;en-us;English
DocumentCulture:(en) OR DocumentCulture;cs;English + Czech
-filter clause: must

Best Regards,
Roman Konicek