Copied to clipboard

Flag this post as spam?

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


  • Michel Rochon 1 post 71 karma points
    1 week ago
    Michel Rochon
    0

    Lucene query and Umbraco.tags fields

    Hello all,

    I'm experimenting with UmbracoExamine engine and Lucene searches. So far I'm quite impressed with the flexibility and performance. I'm having a bit of an issue dealing with Umbraco.tags fields. I have a use case where I need to search for Unpublished documents with a specific tag value.

    Now, I can confirm that my field (which is called "englishKeywords") is indexed in both the Internal and External indexers (user fields in Examine Management screen). I also realize that only the Internal indexer is allowed by default to search for Unpublished documents.

    So I can search in my Umbraco.Tags field using ExternalIndexer...but cannot combine search for Unpublished documents. And then I can search for Unpublished documents using InternalIndexer but combining search to Umbraco.Tags fields does not work. What am I missing? Should I rebuild my indexes or something?

    I've tried the Examine Management searchers and also by code using something like this:

    var searcher = ExamineManager.Instance.SearchProviderCollection["InternalSearcher"];
    var criteria = ExamineManager.Instance.DefaultSearchProvider.CreateSearchCriteria(IndexTypes.Content);
    criteria.NodeTypeAlias("multiLanguagePage");
    var tag = "featured";
    //This combination will not work:
    //var query = criteria.Field("isPublished", "false").And().Field("englishKeywords", tag.Escape());
    //This will work:
    var query = criteria.Field("isPublished", "false");
    
    var results = searcher.Search(query.Compile());
    

    A bit of help would be very much welcomed.

Please Sign in or register to post replies

Write your reply to:

Draft