3

According to the book 70-489 Study Guide - Developing Microsoft SharePoint Server 2013 Advanced Solutions (Chapter: "Building FQL Queries") it is still possible to use the question mark wildcard in SP 2013 FQL search requests. I tested it, and it isn't working like described.

Prerequisites

Lets say I have the following four documents that are crawled and can be found using the default search:

PROJ-3122-DEV.pdf    
PROJ-3122-HELP.pdf  
PROJ-5442-DEV.pdf   
PROJECT_DEVELOPMENT.pdf  

As described here, I created a custom result source to work with FQL. To test my queries, I'm using the SharePoint 2013 Search Query Tool.

Testing

I need a search request that only returns documents matching the pattern PROJ-####-DEV.pdf

Here are the queries I tried with my expectations and the real results


Title:PROJ

Expected

PROJ-3122-DEV.pdf    
PROJ-3122-HELP.pdf  
PROJ-5442-DEV.pdf   
PROJECT_DEVELOPMENT.pdf

Final

PROJ-3122-DEV.pdf    
PROJ-3122-HELP.pdf  
PROJ-5442-DEV.pdf

Title:PROJ*

Expected and final results are the same

PROJ-3122-DEV.pdf    
PROJ-3122-HELP.pdf  
PROJ-5442-DEV.pdf   
PROJECT_DEVELOPMENT.pdf

Title:PROJ*DEV

Title:PROJ-*-DEV

Title:PROJ-????-DEV

Expected

PROJ-3122-DEV.pdf  
PROJ-5442-DEV.pdf

Final

The query returned zero items

Remarks

As you can see, the search results are often times unexpected. Is there a way to get a simple pattern matching using question marks? As far as I know, the asterisk is used for zero or more characters including spaces, whereas the question mark is used exactly for one character. Maybe the problem with asterisks stems from the fact, that they can only be used for prefix searches; that would explain why Title:PROJ*DEV and Title:PROJ*-*DEV don't return results. So to match the four digits in the document title I assumed searching for PROJ-????-DEV would be the right way.

Additionally I checked the request-URL which contained encoded questionmarks (%3f); I replaced them with real questionmarks but the result was the same.

Any help regarding the topic and how to match that specific pattern would be really appreciated - thanks.

3

Simple, the study book is wrong. ? is not supported. Only post-fix *, meaning at the end of a term. Not at the start, not in the middle. Only at the end.

  • 1
    And using a - negates the terms that follow. – Matthew McDermott Apr 1 '17 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.