Copied to clipboard

Flag this post as spam?

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


  • Thomas 212 posts 480 karma points c-trib
    Nov 13, 2020 @ 13:40
    Thomas
    0

    Examine Lucene

    Hey I'm trying to make a raw query string for my search.

    I would like to only allow nodes with specific alias

    I have tried with this.

    var nodeAlias = new List<string>() { "articlePage", "sectionPage" };
                var allowedContentTypes = string.Join(" ", nodeAlias.Select(x => $"{x}"));
                if (allowedContentTypes.Any()) query.Append($" AND +(__NodeTypeAlias:{string.Join(" ", allowedContentTypes)})");
    

    That gives me this AND +(__NodeTypeAlias:articlePage sectionPage File)

    It only looks at the first alias..

    How do I add more then one alias?

    Thanks :)

  • Thomas 212 posts 480 karma points c-trib
    Nov 13, 2020 @ 14:03
    Thomas
    100

    Got it to work :)

    var nodeAlias = new List<string>() { "articlePage", "sectionPage", "File" };
                var allowedContentTypes = string.Join(" OR ", nodeAlias.Select(x => $"__NodeTypeAlias:{x}"));
                if (allowedContentTypes.Any()) query.Append($" AND (+({allowedContentTypes}))");
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies