Forum Discussion

Mackdewack's avatar
Mackdewack
Copper Contributor
Nov 26, 2019

Result search query for managed properties

Hi all,

I have build an search query for a search site with an refinement webpart.

Here is my query:

path:https://xxx.sharepoint.com/ {?Title:{searchboxquery}*} OR {?RefinableString1:{searchboxquery}*} OR {?RefinableString2:{searchboxquery}*} OR {?RefinableString3:{searchboxquery}*} ContentType:xxx

The problem is, i can't use a word for the title and a managed property. With the query I can now use multi words for the Title but u cant use two words together, 1 for the Title and one for the managed property.

So the question, is it possible to build an query so I can use multiple words for the title and managed properties.

12 Replies

  • Mackdewack first off you might end up with loose OR's in that statement when searchboxquery is empty. What you are looking for is adding () around the variable as I blogged about at https://www.techmikael.com/2019/08/search-nugget-grouping-property.html

     

    Also, adding a *, will only wildcard enable the last term you input. An remember that adding * to a term, will remove it from getting rank points. Only individual terms are ranked, so relevance might drop when using wildcards.

    • Mackdewack's avatar
      Mackdewack
      Copper Contributor

      Mikael Svenson i'm almost there, i hope :smile:

      This is my input query: 

       

       

      ContentType:xxx (Title:{searchboxquery}) OR (RefinableString1:{searchboxquery})

       

       

      With the query i can search on titles and on the refinablestring1. When i start with the refinablestring after my results i can add extra words for the the title.  

       

       

      ContentType:xxx (Title:Microsoft 777) OR (RefinableString31:Microsoft 777) -ContentClass=urn:content-class:SPSPeople

       

       

      Refinablestring = Microsoft
      Title 777

       

      When i use Microsoft 777 i see my result but when i use 777 Microsoft i got no results, doenst make any sense to me. Is there an explanation for? 

      • Mikael Svenson's avatar
        Mikael Svenson
        Steel Contributor
        You need to read better.

        (RefinableString1:{searchboxquery}) should be RefinableString1:({searchboxquery})
    • Mackdewack's avatar
      Mackdewack
      Copper Contributor
      Thnx for the response! So you think it's possible to combine the managed properties? Tomorrow I can try the new query.
      • Mikael Svenson's avatar
        Mikael Svenson
        Steel Contributor
        Yes, but you need to read up on KQL syntax a bit and how to best use the {?...} syntax 🙂

Resources