Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

using Search.asmx to search for more than two items at a time

$
0
0

Is it possible to search for more than two items at a time?

This is the string I'm trying to search by:

red OR blue OR green 

Only two of the three items are returned. If I search for each item individually, the item is returned.

private string GetXMLString()
        {
            StringBuilder xmlString = new StringBuilder("<QueryPacket xmlns='urn:Microsoft.Search.Query'><Query><SupportedFormats><Format revision='1'> urn:Microsoft.Search.Response.Document:Document</Format></SupportedFormats><Range><Count>500</Count></Range><Context><QueryText language='en-US' type='STRING'>");
            xmlString.Append(queryTextBox.Text);
            xmlString.Append(@" scope:""My Scope""");
            xmlString.Append("</QueryText></Context></Query></QueryPacket>");
            return xmlString.ToString();
        }

private void buttonSearch_Click(object sender, EventArgs e)
	{
		try
		{
			searchServiceRef.QueryService queryService = new searchServiceRef.QueryService();
			queryService.Credentials = System.Net.CredentialCache.DefaultCredentials;
			System.Data.DataSet queryResults = queryService.QueryEx(GetXMLString());

			resultsGrid.DataSource = queryResults.Tables[0];
		}
		catch (Exception ex)
		{
			resultsLabel.Text = ex.ToString();
		}
	}



www.SharePointed.com


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>