SHAREPOINTSearch.com

Welcome to SHAREPOINTSearch.com Sign in | Join

in Search
Skip Navigation Links
Home
Resource CenterExpand Resource Center
Research CenterExpand Research Center
BIG Resource List
Blog Zone
Forums
RequestsExpand Requests
About Us

FullTextQuery errors when more than 10 properties are in the where clause.

Last post 10-03-2007 11:36 AM by notorioustech. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 10-03-2007 8:27 AM

    FullTextQuery errors when more than 10 properties are in the where clause.

    We have successfully implemented a fulltextquery webpart allowing users to add filter conditions based on multichoice properties (mapped to managed properties).  However we have found that once a user selects more than 10 properties you get a “query is malformed” error message. This is a sample query: SELECT WorkId, Rank, Title, Author, Size, Path, Description, Write, SiteName, CollapsingStatus, HitHighlightedSummary, HitHighlightedProperties, ContentClass, IsDocument, PictureThumbnailURL, DocType, Year, Source FROM Scope () WHERE (\"scope\" ='Reports') AND  FREETEXT (defaultproperties, 'any') AND ( Geography ='Belgium'  OR  Geography ='Brazil' OR Geography ='Canada' OR  Geography ='Chile' OR  Geography ='China' OR  Geography ='Colombia' OR  Geography ='Croatia') AND ( DocType ='Pulse Documents' OR  DocType ='Annual' OR  DocType ='Country Reports' ) ORDER BY Rank DESC If you run this query we get results back however if the user adds one more property selection e.g. one more country the results error.We’ve tried putting these into comparison arrays but again the same error occurs. I’ve checked in the advanced search web part (looking at the executed query in the logs) and you can get a working query with a lot more than 10 properties together.Does anyone have any ideas as to what is doing this????

     

  • 10-03-2007 8:43 AM In reply to

    • lars
    • Top 10 Contributor
    • Joined on 06-04-2007
    • Posts 17

    Re: FullTextQuery errors when more than 10 properties are in the where clause.

    I cannot tell if this is a bug in SharePoint or if there is actually a limit to how many filter criteria you can apply to the metadata store. But you could try using CONTAINS instead og Equal To. The latter goes to the SQL Table of the metadata store whereas the first goes to the text index.

    So try using CONTAINS instead as follows:

    CONTAINS(Geography, ' "Belgium" OR "Brazil" OR "Canada" OR "Chile") AND CONTAINS(DocType, ' "Pulse Documents" OR "Annual" ')

    Cheers
    Lars F.

     

    Filed under: ,
  • 10-03-2007 8:56 AM In reply to

    Re: FullTextQuery errors when more than 10 properties are in the where clause.

    Thanks for the quick reply Lars

     Originally the code did look like this, however we found that these properties were also being returned in the hithighlighted sentences - which seems fairly illogical when you're specifying a particular property.

     Thanks,

     James.

  • 10-03-2007 9:44 AM In reply to

    Re: FullTextQuery errors when more than 10 properties are in the where clause.

    Thanks Lars. 

    I have been able to get up to 180 standard OR clauses into the where statement. The difference is that they were smaller ("workid"=1) so I think the limit you are hitting is the size limit of the query itself. The advanced search uses CONTAINS as Lars says.

    Another limiit that I know exists is for the ANY and SOME ARRAY clause  ( ANY ARRAY[1,2,4] ) which is 60 items. 

    Christopher Even
    SHAREPOINTSearch.com founder
  • 10-03-2007 10:43 AM In reply to

    Re: FullTextQuery errors when more than 10 properties are in the where clause.

    Hi Christopher

    I presumed that you must be able to specify more than 10 properties, that's what's been puzzling us.  We've tried putting the values into an array to cut down the query text, the code below fails, but if you remove one property from any of the arrays it works!!?  We've also tried it on a year field which has a smaller text size.

    SELECT Rank, Title, Size, Path, Description, HitHighlightedSummary, HitHighlightedProperties, IsDocument, PictureThumbnailURL, DocType, Year, Source

    FROM Scope ()

    WHERE ("scope" ='Reports (US)'  or "scope" =’Reports Worldwide'  or "scope" =’Gauge'  or "scope" =’Youth' )

    AND (DocType = ANY ARRAY ['Pulse Documents','Annual','Teleconferences','Data Tables','Methodology','Questionnaires','Works','Report 2','Review','Other Reports & Presentations'])

    AND (Category = ANY ARRAY ['Food and Beverage'])

    AND  FREETEXT (defaultproperties, 'any') ORDER BY Rank DESC

     

    Incedentally when we run the sql below (taken from the logs) created by the advanced search webpart it runs without any errors

     

    SELECT WorkId, Rank, Title, Author, Size, Path, Description, Write, SiteName, CollapsingStatus, HitHighlightedSummary, HitHighlightedProperties, ContentClass, IsDocument, PictureThumbnailURL  from scope() where freetext(defaultproperties,'+roper') And (DetectedLanguage = 12 Or DetectedLanguage = 7 Or DetectedLanguage = 17 Or DetectedLanguage = 10 Or DetectedLanguage = 69 Or DetectedLanguage = 27 Or DetectedLanguage = 30 Or DetectedLanguage = 22 Or DetectedLanguage = 36 Or DetectedLanguage = 38 Or DetectedLanguage = 24 Or DetectedLanguage = 25 Or DetectedLanguage = 29 Or DetectedLanguage = 42 Or DetectedLanguage = 14 Or DetectedLanguage = 10 Or DetectedLanguage = 15 Or DetectedLanguage = 33 Or DetectedLanguage = 8 Or DetectedLanguage = 1) And (Author like '%asdasda%' Or Author like '%adsadasd%' Or Author like '%adsadasd%') 

     

    Could it be because the properties we are using are managed properties (text) fields?
  • 10-03-2007 11:36 AM In reply to

    Re: FullTextQuery errors when more than 10 properties are in the where clause.

    So we know there are limits: size of total query and number of items in an Array construct ( may actually be size related too because I could fit 60 integers into the array, your strings take up more space )

    Some further tests that would be helpful:

    Run an advanced search with every possible managed property picked with multiple, see if there is a limit.

    Monitor the search database to see how this is all translated into SQL.

     

    Thank you for participating on the site with this!

    Christopher Even
    SHAREPOINTSearch.com founder
Page 1 of 1 (6 items)
SHAREPOINTSearch.com is not affiliated with or endorsed by the Microsoft Corporation.See our Terms, Conditions and Privacy Statements
SharePoint is a trademark of the Microsoft Corporation.