Copied to clipboard

Flag this post as spam?

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


  • Luke 11 posts 91 karma points
    Oct 16, 2020 @ 09:36
    Luke
    0

    Examine CreateQuery() ignoring Boost values made on indextime

    I'm in the process of creating a search function for a website that can boost on certain fieldtypes and tags that we can manage in the backoffice.

    I have figured out how to add a boost value to certain fields on index time via hooking up to the DocumentWriting event of the LuceneIndex and I can see that it works when using a normal search via searcher.Search(query) or in Umbraco in the Examine Management tab.

    However when using the searcher.CreateQuery() method to create a more extensive search functionality where we can filter based on documentType etc, these boost values seem to be completely ignored.

    I noticed that the CreateQuery method doesn't use wildcard search as a default setting and you cannot set it as a default setting either. It has to be added on every field like so:

    .Field("title", filter.MultipleCharacterWildcard())
    

    After you do this however, you cannot use the .Boost() method on this field anymore, chaining is not possible.

    I have seen comments about chaining them like so:

    .Field("title", filter.MultipleCharacterWildcard().Value.Boost(10f))
    

    But this does not work. It ignores all the previous modifiers and only uses the last one.

    Is there another option, method or workaround that I can try to get the expected results?

    Thanks in advance!

Please Sign in or register to post replies

Write your reply to:

Draft