Random sort order

Vote:
 

Hi guys,

We need to implement random sort order for our application. It should support pagination.

How can we add random sort order to the request?

P.S. I found some solution https://github.com/x2find/Random2Find but it haven't updated. It also throw exseption.

What do you think about this implementation?

Will it works properly with EPiServer Find (now, in the feature)?

Is it good enough according application performance?

I hope for your help

#141365
Nov 13, 2015 10:23
Vote:
 

I have used it, and it works very well with EPiServer Find.  I have tested it with latest Find version (10.0.0.3291).

#141454
Nov 16, 2015 12:29
Vote:
 

I have cheked this plugin but it seems we can't use pagination.

I've tried to improve script but EPiServer Find forbids custom scripts.

Solution available in the elastic:

        public static ITypeSearch<T> OrderRandomSalt<T>(this ITypeSearch<T> search, string salt)
        {
            return new Search<T, IQuery>(search, context =>
            {
                var sortScript = new ScriptSorting
                {
                    Script = "org.elasticsearch.common.Digest.md5Hex(doc['_id'].value + salt)",
                    Language = ScriptLanguage.Native,
                    Type = ScriptSortType.String,
                };
                sortScript.AddParameter("salt", salt);
                
                context.RequestBody.Sort.Add(sortScript);
            });
        }

Are there other ideas on the organization random sort order with pagination?

#141673
Edited, Nov 18, 2015 12:24
Vote:
 

It doesn't really make sense to use pagination if you have random sort order, does it? 

#141674
Nov 18, 2015 12:26
Vote:
 

As Mari says it really does not make sense since the ordering will be different for each request.

If you want pagination the only solution I can think of is to use this but get all content back and do paginations by client side code

#141675
Nov 18, 2015 12:37
Vote:
 

It make sense when you have a lot of items and can't show (retrieve) all of them. 

Sorting can be based on a key value. If you change key than the order will change. If you use the same key you will get the same result.

EPiServer Find returns search result with random order. As a result, I can't show result by portions without applying alphabetical sort order.

#141676
Nov 18, 2015 12:42
Vote:
 

Your original post stated "We need to implement random sort order for our application..." and we suggest to use Random2Find.

It is not clear what you are trying to do....

If you need paging, then you should specify a sort order (can be whatever field you like).  If you want random sort order, then it does not make sense to have paging.

#141677
Nov 18, 2015 12:52
Vote:
 

episerver find does not return results in random order, if you do not specify they will be returned based on relevance and that should be the same for page two as for page one if you have not updated the index in the time it takes for the visitor to klick on page 2 (or if you change any requrements on the search).

#141678
Nov 18, 2015 13:01
Vote:
 

Thanks Henrik Fransas for correcting my mistake

#141679
Nov 18, 2015 14:23
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.