It is my first post on this forum.

I have the following case. In the search engine there is a property id and I have to search by it using the wildcards. The problem is that the id can contain the special characters like - which are treated by search engine as white spaces.

Example. id = ABC-123-XYZ

--- UPDATE ---

Query test cases:

  1. by id, without quotes, not escaped
    • id:ABC-123* - OK
    • id:ABC-123-* - Microsoft.Office.Server.Search.Query.TooComplexQueryException
    • id:ABC-123-X* - OK, but if X replaced by certain characters then Microsoft.Office.Server.Search.Query.TooComplexQueryException
  2. by id, without quotes, minus escaped
    • id:ABC\-123* - OK
    • id:ABC\-123\-* - Microsoft.Office.Server.Search.Query.TooComplexQueryException
    • id:ABC\-123\-X* - OK, but if X replaced by certain characters then Microsoft.Office.Server.Search.Query.TooComplexQueryException
  3. by id with quotes:
    • id:"ABC-123*" - OK
    • id:"ABC-123-*" - OK
    • id:"ABC-123-X*" - no results, but should be
  4. free text, without quotes, not excaped:
    • ABC-123* - Microsoft.Office.Server.Search.Query.TooComplexQueryException
    • ABC-123-* - OK
    • ABC-123-X* - Microsoft.Office.Server.Search.Query.TooComplexQueryException
  5. free text, without quotes, minus escaped:
    • ABC\-123* - Microsoft.Office.Server.Search.Query.TooComplexQueryException
    • ABC\-123\-* - OK
    • ABC\-123\-X* - Microsoft.Office.Server.Search.Query.TooComplexQueryException
  6. free text with quotes
    • "ABC-123*" - OK
    • "ABC-123-*" - OK
    • "ABC-123-X*" - No results, but should be

I can build queries with or without the quotes but search by free text and by property has to work in all combinations. Do you have any idea how to achive this requirement?

I am using Keyword Query Language and I am quering the search engine by webservices.

Thank you for your help!

1 Answer 1


Based on MSDN https://msdn.microsoft.com/en-us/library/microsoft.office.server.search.query.toocomplexqueryexception.aspx

Represents an exception that is thrown when there are too many results for this query.

I believe the wildcard ABC-123-X* returns too many results.

  • There is only few such ids. What I am suspecting is that the query ABC-123-X* is tokenized by dashes to the search terms ABC, 123 and X* and the last term is causing the problem. Is it possible? And how to solve this issue?
    – kpater87
    Commented Apr 10, 2015 at 14:49
  • I need to try it out. How if you try ABC-123? Commented Apr 10, 2015 at 14:50
  • Then search engine is giving the correct results for this query.
    – kpater87
    Commented Apr 10, 2015 at 14:53
  • Have you tried placing the query inside double quotes. Like "ABC-123-X*"? Commented Apr 10, 2015 at 15:01
  • I've updated my question. I hope that is clearer now.
    – kpater87
    Commented Apr 13, 2015 at 6:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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