views:

145

answers:

1

We are experiencing an issue where a FullTextSqlQuery is only returning the default 100 results whenever certain criteria are added in the WHERE clause. We are setting the RowLimit to int.MaxValue, and when a wide-open search is done, we are receiving the max results. It's only an issue when tacking-on CONTAINS clauses. Has anyone else seen this issue? I wasn't able to dig up anything on Google/Bing.

FullTextSqlQuery kRequest = new FullTextSqlQuery(ServerContext.Current);
kRequest.KeywordInclusion = KeywordInclusion.AnyKeyword;
kRequest.ResultTypes = ResultType.RelevantResults;
kRequest.TrimDuplicates = false;
kRequest.RowLimit = int.MaxValue;
kRequest.Timeout = 120000;
ResultTableCollection resultTbls = kRequest.Execute();

Query Code:

string query = "SELECT Title, Path, Facility, OwnerDepartment, 
    FacilityActiveDate, FacilityInactiveDate, ScheduledReviewDate, DocID, 
    Version FROM SCOPE() WHERE ";
query += "Path like '%" + site.Url + "%'";

// when it hits the else statement is an example of when it will only 
// return 100 results
if (FacilitySelectedIndex == 1)
  {
    query += " AND Facility IS NOT NULL";
  }
else
  {
    query += " AND CONTAINS(Facility, '\"*" + FacilityShortName.Trim() + "*\"')";
    queryText.Add("Facility=" + FacilityShortName);
  }
}
A: 

If I recall correctly, the RowLimit max value is actually less than int.MaxValue, only it won't tell you that. Try setting the RowLimit to some arbitrary large number that is still smaller than int.MaxValue, such as 99999

zincorp
I was under the impression that was corrected in SP1. I will say that having it at int.MaxValue is probably overkill (I can't take credit for the original code), but there are no issues when criteria are not used. A wide-open search in this system currently will return around 700 docs per 'facility'. As soon as a 'facility' is added in the else statement shown above, it will return exactly 100.
Logan
zincorp - I have to admit I'm confused as to why, but changing RowLimit to a value did fix it. Thanks for your help.
Logan
In SharePoint, there is no "why"... only "bwuhhh?"
zincorp