Copied to clipboard

Flag this post as spam?

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


  • Chris Mahoney 242 posts 454 karma points
    Apr 02, 2015 @ 04:20
    Chris Mahoney
    0

    Unpublished pages showing up in Examine

    Hi,

    I have an Examine search set up, and it's returning both published and unpublished pages, despite having supportUnpublished="false" in the Examine configuration.

    ExamineSettings.config:

    <add name="WebsiteIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"
              dataService="UmbracoExamine.DataServices.UmbracoDataService, UmbracoExamine"
              supportUnpublished="false"
              supportProtected="false"
              analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"
    enableDefaultEventHandler="true"/>
    <add name="WebsiteSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine" analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"/> 

    ExamineIndex.config:

    <IndexSet SetName="WebsiteIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/WebsiteIndexSet/" />

    The relevant code:

    var searcher = ExamineManager.Instance.SearchProviderCollection["WebsiteSearcher"];
    var searchCriteria = searcher.CreateSearchCriteria(BooleanOperation.Or);
    var luceneString = composeSearchString(searchTerm, "search term");
    var query = searchCriteria.RawQuery(luceneString);
    var searchResults = searcher.Search(query).OrderByDescending(x => x.Score);

    Yet when this is executed, searchResults contains unpublished pages. The resulting links on the page just go to "#". Can anyone tell me why this is happening? I'm running Umbraco 6.2.5.

    Thanks,
    Chris

  • Chris Mahoney 242 posts 454 karma points
    Apr 15, 2015 @ 02:02
    Chris Mahoney
    100

    I've resolved the issue. It turned out that the unpublished page in question shared the same name as a media item. The search was returning the media item (but with a URL of "#") and I thought that it was the unpublished page. I don't want media items returned in any case so have added "File" to ExcludeNodeTypes in ExamineIndex.config and everything seems to be working now.

Please Sign in or register to post replies

Write your reply to:

Draft