Introduction

In this post I will describe a common mistake that occurs when you write your own FQL that impacts the search results that depends on Relevancy Ranking (Using Full Text Index Mapping).

 

Scenario

Lets consider that we have a list of products that we would like to search through that have a custom managed property weights defined to control Relevancy; The Full Text Index Mapping is configured as following:

  • ProductName: Level 7 (High Importance)
  • ProductDesc: Level 1 (Low Importance)

and lets say that other Dynamic Ranking options are disabled (such as Freshness, Boosts, Authority Weight ... etc.) in this scenario to make things easier. So what happens if I searched for the product "XBox" using the following FQL:

(

    (

        ProductName:string(

            "XBox",

             mode="simpleany"

        )

    )

) or (

       ProductDesc:string(

            "XBox",

             mode="simpleany"

        )

)

 

What I expect to see is that the search results will bring the result items that has the word "Xbox" in the ProductName first due to my relevancy configuration, but that doesn't happen, why?

 

 

The Problem:

To understand the problem lets check the official definition of FQL from Microsoft MSDN Site:

The FAST Query Language (FQL) is a powerful query language that enables developers to perform exact searches and to narrow the scope of your search to values that belong to a specific managed property or a full-text index.

So what happened here is that the Exact Managed Property Search kicked in and disabled the Dynamic Ranking (using Full Text Index Mapping).

 

Solution 

 To solve this issue you need to remove the managed properly names from your query and rephrase it as following:

 

(

    (

        string(

            "XBox",

             mode="simpleany"

        )

    )

)

 

This will enable the Full Text Index Mapping on your reach results and brings in the results that are ordered in the ProductName first.

 

Note:

For the sake of this scenario I disregarded the number of occurrence of the word "Xbox" in the search results to make it easier to understand, please note that this issue will also affect the order of the search results.

 

 

 

Additional References

More useful information can be found in the below links: