Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • David Veksler 81 posts 166 karma points
    Sep 06, 2015 @ 11:07
    David Veksler
    0

    smart 404 pages - how to use Examine to find matches for 404 content?

    We just migrated a large website to umbraco, and among other stategies, I implemented a smart 404 pages which tries to find the best match. I want it to find matches in the same way as the built-in search in the back office.

    But it doesn't work: Here is my code: https://gist.github.com/DavidVeksler/d26d8cfcfc40e2ce4b1e

    This 404: http://fee.org/freeman/why-the-poor-need-property should return this as the top match: http://fee.org/freeman/why-the-poor-need-property-rights/

    But it doesn't. Is there a better way to do this?

  • Veronica Burd 76 posts 201 karma points
    Sep 06, 2015 @ 19:17
    Veronica Burd
    0

    Hi,

    I see you are using the InternalSearcher. Did you add the "articleTitle" field to the Internal index via the config file?

    You can check which fields are indexed in the Internal index via the backend Examine dashboard.

    HTH

    Veronica

  • David Veksler 81 posts 166 karma points
    Sep 07, 2015 @ 02:49
    David Veksler
    0

    Apparently the answer is to boost the node name:

                    //node name exactly boost x 10
                sb.Append("+(__nodeName:");
                sb.Append("\"");
                sb.Append(query.ToLower());
                sb.Append("\"");
                sb.Append("^10.0 ");
    
                //node name normally with wildcards
                sb.Append(" __nodeName:");
                sb.Append("(");
                foreach (var w in querywords)
                {
                    sb.Append(w.ToLower());
                    sb.Append("* ");
                }
                sb.Append(") ");
    

    Anyway, since I liked the built-in back office search, I copied EntityController.cs from Umbraco core, which works perfectly.

Please Sign in or register to post replies

Write your reply to:

Draft