Copied to clipboard

Flag this post as spam?

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


  • Nguyen Hien 52 posts 133 karma points
    Apr 20, 2016 @ 08:43
    Nguyen Hien
    0

    Customize PostService GetPosts() method in ublogsy

    Hi Anthony,

    I have to implement requirement like this. I need add Audience property to ublogsy Post document type as dropdown list with value (All, Australia, New Zealand) And we need customize GetPosts() method allow filter post by country (AU/NZ). I customize GetPosts method like this:

    public IEnumerable

            // add criteria for tags
            criteria = ExamineSearchHelper.AddSvCriteria(criteria, uBlogsy.BusinessLogic.Constants.Examine.uBlogsySearchableTags, tag, ",");
    
            // add criteria for labels
            criteria = ExamineSearchHelper.AddSvCriteria(criteria, uBlogsy.BusinessLogic.Constants.Examine.uBlogsySearchableLabels, label, ",");
    
            // add criteria for authors
            criteria = ExamineSearchHelper.AddSvCriteria(criteria, uBlogsy.BusinessLogic.Constants.Examine.uBlogsySearchableAuthor, author, ",");
    
            // add criteria for year
            criteria = ExamineSearchHelper.AddSvCriteria(criteria, uBlogsy.BusinessLogic.Constants.Examine.uBlogsySearchableYear, year, ",");
    
            // add criteria for month
            criteria = ExamineSearchHelper.AddSvCriteria(criteria, uBlogsy.BusinessLogic.Constants.Examine.uBlogsySearchableMonth, month, ",");
    
            criteria = ExamineSearchHelper.AddSvCriteria(criteria, uBlogsy.BusinessLogic.Constants.Examine.uBlogsySearchableDay, day, ",");
    
            if (!string.IsNullOrEmpty(audience))
            {
                criteria = ExamineSearchHelper.AddSvCriteria(criteria, "audience", audience, ",");
            }
    

    But when I call GetPosts(params, "Australia") it returns value same as old method and no filter by Audience. Will I need add audience to ExamineIndex.config ? How I can add it?

    Thanks

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Apr 20, 2016 @ 11:08
    Anthony Dang
    0

    I'd say you probably need to inject the audience value for the document. Take a look at the event hooks to see how extra values are injected into the index.

  • Nguyen Hien 52 posts 133 karma points
    Apr 20, 2016 @ 12:43
    Nguyen Hien
    0

    Hi Anthony, I added audience field to External Index Set

    But after rebuild index, GetPosts function always return null. I don't need add to External Index set?

    Can you show me which *.cs file to see to inject index?

    Thanks

Please Sign in or register to post replies

Write your reply to:

Draft