Extra Bits and Pieces

Culture

If you have a multi-lingual site then each content node can have different content for the different languages that have been set up. You can instruct Sift to only search in a specific language by adding the data-sift-culture attribute to the Sift outer <div>. The value should be set to the ISO code of the language required. This can be seen in the Umbraco back office, under Languages on the Settings tab.

<div class="sift"
     data-sift-result-document-type="cinemaCento"
     data-sift-culture="it">

    <form class="sift-criteria">
		...
    </form>

    <div class="sift-result">
    </div>

</div>

If you are using a custom partial view to render the results, then you can use the Umbraco functions to specify the culture to display, for example.

@node.Value("description", Model.Criteria.Culture)

Content Root

By default, Sift will return any content in the entire Umbraco content tree that matches the document type and criteria specified. You can limit this to only return content under a specific node in the content tree by adding the data-sift-result-root attribute. This should be set to either the Id or the Guid of the root node.

<div class="sift"
     data-sift-result-document-type="cinemaCento"
     data-sift-result-root="47824d3c-3995-4f5f-a1e2-9de50257afe1">

    <form class="sift-criteria">
		...
    </form>

    <div class="sift-result">
    </div>

</div>

Maximum Number of Results

Sift uses Examine to perform its searches. By default, the number of results returned is limited to 500 content nodes. This maximum can be adjusted by adding a data-sift-max-results attribute to the Sift outer <div>. This should be set to the maximum number of nodes required.

<div class="sift"
     data-sift-result-document-type="cinemaCento"
     data-sift-max-results="1000">

    <form class="sift-criteria">
		...
    </form>

    <div class="sift-result">
    </div>

</div>

Sift Events

Sift contains some simple event management to allow you to add your own JavaScript code when searching. You can specify functions to be called before the search has begun and after results have been returned. Sift will evaluate the functions provided in the data-sift-start-search and data-sift-end-search attributes on the Sift outer <div>. An example use case would be to display an overlay while the search takes place.

<div class="sift"
     data-sift-result-document-type="cinemaCento"
     data-sift-start-search="showOverlay()"
     data-sift-end-search="hideOverlay()">

    <form class="sift-criteria">
		...
    </form>

    <div class="sift-result">
    </div>

</div>

The start search function must return either true or false. If true is returned then the search will proceed, otherwise the search will be cancelled.

<< Back to User Guide