views:

24

answers:

2

I've spent the past few days at the school of hard knocks learning how to search Sharepoint via the http://{servername}/_vti_bin/spsearch.asmx Web Service.

The remaining issue to overcome is that when I perform a search, only the first 10 results are returned. In the returned XML I can see:

<StartAt>1</StartAt>
<Count>10</Count>
<TotalAvailable>42</TotalAvailable>

So I can see that there's a total of 42 total results, but I'm only getting the first 10 return.

The query I'm passing to the Web Service's Query() method is:

<?xml version='1.0' encoding='utf-8' ?><QueryPacket xmlns='urn:Microsoft.Search.Query' Revision='1000'><Query domain='QDomain'><SupportedFormats><Format>urn:Microsoft.Search.Response.Document.Document</Format></SupportedFormats><Context><QueryText language='en-US' type='STRING'>{0}</QueryText></Context></Query></QueryPacket>

How can I modify my query so that it'll return all the results at once?

+1  A: 

You need to tell the search how many results you want. You can view the search query schema on MSDN. The relevant section for you is:

<Range>
   <StartAt />
   <Count />
</Range>

You will want something like the following in your Tag

<Range>
   <StartAt>0</StartAt>
   <Count>50</Count>
</Range>

(You probably don't need StartAt as it defaults to 0)

Estyn
A: 
<QueryPacket xmlns="urn:Microsoft.Search.Query" Revision="1000">
      <Query domain="QDomain">
            <SupportedFormats>
                  <Format>urn:Microsoft.Search.Response.Document.Document</Format>
            </SupportedFormats>
            <Range>
                  <Count>MaxNumberGoesHere</Count>
            </Range>
            <Context>
                  <QueryText language="en-US" type="STRING">Maria</QueryText>
            </Context>
      </Query>
</QueryPacket>

I thought I'd tried this before and got an error, hence me asking here. Looks like I must have got the query wrong.

Peter Bridger