Recursos para Profesionales de TI > Página principal de foros > SharePoint - Search > Searching multiple scopes with All Content and an exclude rule returns "The search query is malformed"
Formular una preguntaFormular una pregunta
 

PreguntaSearching multiple scopes with All Content and an exclude rule returns "The search query is malformed"

  • martes, 02 de septiembre de 2008 11:39mr2008 Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     Tiene código
    Hi,

    I have two scopes which are being used in an Advanced Search Box web part. The two scopes contain the following rules:

    Scope1:
        rule: All Content
        behavior: Include

    Scope2:
        rule: ContentSource = MyContentSource
        behavior: Include
       
    In the Advanced Search Box web part for the option "Only the scope(s)" I am able to check both scopes and perform a successful search*.

    For Scope1 a new rule is added that excludes a content source; after adding this exclude rule I am unable to search both scopes together.  The web part outputs the string "Your search cannot be completed because of a service error. Try your search again or contact your administrator for more information"

    The SharePoint logs contains: "Microsoft.Office.Server.Search.Query.QueryMalformedException: Your query is malformed. Please rephrase your query" thrown from Microsoft.Office.Server.Search.Query.FullTextSqlQuery.Execute.

    I tested with the web service /_vti_bin/search.asmx and executed the following search query:

    using (search.QueryService qs = new WebService.search.QueryService())  
    {  
        qs.Credentials = System.Net.CredentialCache.DefaultCredentials;  
        StringBuilder query = new StringBuilder();  
        query.Append("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");  
        query.Append("<QueryPacket xmlns=\"urn:Microsoft.Search.Query\" Revision=\"1000\">");  
        query.Append("<Query domain=\"QDomain\">");  
        query.Append("<SupportedFormats>");  
        query.Append("<Format>urn:Microsoft.Search.Response.Document.Document</Format>");  
        query.Append("</SupportedFormats>");  
        query.Append("<Context>");  
        query.Append("<QueryText language=\"en-US\" type=\"MSSQLFT\">");  
        query.Append("SELECT ");  
        query.Append("Title, Path, Description, Write, Rank, Size ");  
        query.Append("FROM SCOPE() ");  
        query.Append("WHERE ");  
        query.Append("((\"Scope\"='Scope1') OR (\"Scope\"='Scope2')) ");  
        query.Append("AND FREETEXT(DEFAULTPROPERTIES,'jpg')");  
        query.Append("</QueryText>");  
        query.Append("</Context>");  
        query.Append("</Query>");  
        query.Append("</QueryPacket>");  
        string results = qs.Query(query.ToString());  
        using (System.IO.StreamWriter file = new System.IO.StreamWriter("SearchResults.xml"))  
        {  
            file.Write(results);  
        }                          

    And got the same results:

    <ResponsePacket> 
    <Response domain="QDomain">  
    <Status>ERROR_BAD_QUERY</Status> 
    <DebugErrorMessage> 
    Your query is malformed. Please rephrase your query.  
    </DebugErrorMessage> 
    </Response> 
    </ResponsePacket> 

    The condition that triggers the failed search is when a scope contains the "All Content" rule and a rule that performs an exclude on a content source or a content class property, and more than one scope is used in the search query.  Having exclude rules in scopes that do not have the "All Content" rule will not trigger this problem.

    Is a scope with the rules including All Content and then excluding specific content sources supported?

    The way I see to work around this problem so my users do not see this error is to create a new display group used for the Advanced Search Box web part that does not include the scope using the "All Content" rule.

    I'm running MOSS 20007 version 12.0.0.6219.

    Thanks
    Matt

    * searching against multiple scopes where one contains the All Content rule might not make much sense; with the current display groups our site has from user testing users have checked all the scopes available and run into this problem.

Todas las respuestas

  • miércoles, 14 de enero de 2009 19:31Poochi74 Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    Hi,

      Were you able to fix the problem? I am having the same issue (2 scopes, 1 with 'All Content'). The query generating algorithm is generic and I have about ~120 scopes. So, excluding may not the option for me. Is there anyway to instruct the MOSS query engine that if there is an 'All Content' scope, ignore the other scopes?

    I would appreciate any help...

    Thanks,
  • domingo, 12 de julio de 2009 22:47Part Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     

    I have the same problem.  does anyone have any update? This isssue is not consistent either, all my dev and test servers are working without any issues.(all macines are same version, security updates etc etc)