Copied to clipboard

Flag this post as spam?

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


  • Chris 11 posts 30 karma points
    Nov 30, 2011 @ 16:42
    Chris
    0

    Filtering search to a single site

    Is there any way get my search only to return results from a single site when I have multiple sites set up. I have a site copied for translation and it is picking up them.

     

                var criteria = ExamineManager.Instance
                    .SearchProviderCollection[Index]
                    .CreateSearchCriteria();

                var filter = criteria
                    .GroupedOr(new string[] { "nodeName", "bodyText","summary"},
                               searchTerm)
                    .Compile();

                SearchResults = ExamineManager.Instance.SearchProviderCollection[Index]
                    .Search(filter);

  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Dec 01, 2011 @ 10:12
    Ismail Mayat
    0

    Chris,

    You would need to inject into the index using the gatheringnode method an extra field to indentify which site.

    What you could do is inject into it a searchable path, currently by default you will have path field which is comma separated list of the full path and part of that path will have the root home page node id in there, so add new path field in there call it what you like but replace the , with a space. Update your query so that it filters on that path but pass in to the search macro your root home page id as I assume each site will have its own unique home page?

    Regards

     

    Ismail

Please Sign in or register to post replies

Write your reply to:

Draft