Synonym is not working when combined with pre-filters in FS4SP 2010 RRS feed

  • Question

  • We are not able to see synonym expansion in query logs . For example to filter the results we are passing query as k= keyword AND (managedproperty1:value AND managedproperty2:value). But for keyword query expansion is not happening.

    Whether there is any other way of passing pre-filters ??or whether ther is any roundabout method to solve this issue.


    Thursday, August 4, 2011 11:12 AM

All replies

  • Hi!

    If you are using the keyword synonym functionality then please observe that the synonyms only work if the complete query equals the keyword. It says on this page that "Keyword terms in queries must match the keyword or its synonym exactly. Partial matches won’t work.":

    This means that if you search for "keyword something" the synonym will not be applied, it is applied if you search for "keyword" only.

    Are you adding "AND (managedproperty1:value AND managedproperty2:value)" by using the "Append Text To Query" property for the default query result web part? If so, then your query is sent to FS4SP as "keyword AND (managedproperty1:value AND managedproperty2:value)", and does not match "keyword". If you are doing it another way, disregard this, and please specify :)

    I would suggest creating a scope using fql to filter out your results.

    Creating scopes:

    More on FQL:

    I am actually not sure if FS4SP will interpret the added fql as part of the keyword, by I believe it will not.

    Is this something that can work for you?

    Best regards Gunnar

    Thursday, August 4, 2011 2:25 PM
  • Hello Saranya,

    Gunnar gives a good explanation on the issue at hand. You might want to take a look at "SharePoint Search Parts" -, which contains a replacement Core Results Webpart which handles synonym expansion the way you would expect, in addition to supporting fql directly.

    The project is still in early phases and some functionality is not yet implemented, but it might work for your case. Feel free to submit any issues you might have with it, or improvements you need, and I will create rapid releases as it moves along.

    Mikael Svenson 

    Search Enthusiast - SharePoint MVP/WCF4/ASP.Net4
    Thursday, August 4, 2011 7:39 PM
  • @Gunnar/Mikael,

    Thanks alot for your replies. Gunnar,the query we are passing is k="keyword AND (managedproperty1:value AND managedproperty2:value)"

    It may contain even an OR conditions so we cannot create scopes .I have heard that in FQL we can pass all the filters in a separate parameter rather than passing as query.Is there a way to extend the core results web part and use some parameter to pass this filters separately ?? The FQL part we have checked in the QR backend server by applying the ffilter for ex:( AND(keyword,filters(managedproperty1:'value')))  then checked the fast query logs the whole query is getting passed as ( AND(keyword,filters(managedproperty1:'value')))  .

    Mikael,We cannot go with the replacement of the core results web part as its too late :-( . Can you pleaase suggest in any other way we can do this query expansion for synonyms ??

    Can you suggest how can we proceed further in this.



    Friday, August 5, 2011 6:08 AM
  • Hello Saranya,

    It's possible to add the refiners to the r= parameter as a refiner instead of including them in the s= parameter, but it's not straight forward.

    Lucky for you I did a write up on it just now on my blog :) It involves encoding the parameter the correct way and then base64 encode it.


    Mikael Svenson 

    Search Enthusiast - SharePoint MVP/WCF4/ASP.Net4
    Friday, August 5, 2011 7:53 AM
  • Hi Mikael,

    thanks for your reply. Yes this i can use it by putting the r parameter .But one thing i have observed is we cannot apply OR with r parameter also..please correct me if i am wrong.

    For pre-filters it will be applied depending on the user login .how we can handle that? While the user logins the search results will be according to the preferences he saved for the last time.

    Can we do something in configdatasource properties of seach core result web part to pass this pre-filters separately?



    Friday, August 5, 2011 9:50 AM
  • I am afraid your solution is not working for every refiner parameters. I need to reverse engineer the existing fast search and values coming from fast search and your code don't match most of the time. any solution for this? thanks for all the effort
    Thursday, August 18, 2011 4:14 AM
  • Hello sema,

    Is it not giving results, or is it just being encoded different? If it's not giving results, could you give an example and I'll troubleshoot it.

    Mikael Svenson 

    Search Enthusiast - SharePoint MVP/WCF4/ASP.Net4
    Thursday, August 18, 2011 7:06 AM
  • Hi Svenson,

    Can we apply OR condition using r parameter.I even tried it out its internally taking as AND.

    Is there any method to access the two way synonym directly rather than looping in the whole list of synonyms ??


    Monday, September 5, 2011 11:50 AM
  • Hello Altaf,

    Out of the box the r= is treated as an AND, as you have experienced and you cannot change this behavior  (at least not in an easy way afaik).

    And I'm not aware of any smarter synonym API either, so you have to write boilerplate code to iterate the list and pull it out yourself.



    Search Enthusiast - SharePoint MVP/WCF4/ASP.Net4
    • Proposed as answer by POCCoder Thursday, September 22, 2011 3:46 PM
    Monday, September 5, 2011 7:16 PM