I want to limit my full text SQL query to a single site collection and I am calling the SharePoint search.asmx web service directly from Javascript. Is there some way to limit this using something in the Query Schema? This is on SharePoint 2010 Standard. I realize that Foundation would limit the results on its own, so there must be a way.
-
Could you paste your code here?– Falak MahmoodJun 5, 2012 at 15:32
1 Answer
You can add something like this to your query:
AND site = 'http://blah/subsite/anothersite'
But in general I'd recommend that you move to KeywordQuery syntax instead of FullTextSqlQuery as the later isn't supported by FAST.
-
Thanks, I'll give this a shot. This is custom work for a single client that does not use FAST. I wanted to use a Keyword Query, but the requirements were such that I only query particular fields (not the entire record) so I set up Metadata properties for them. I know keyword queries can handle this, but I had a few other restrictions which caused the keyword query to never return results. Jun 5, 2012 at 16:44
-
Question: Are alternate access mappings handled properly? If my site can be accessed as blah/sites/a or blah/sites/a or blah.com/sites/a would all work if there are AAMs defined? Jun 5, 2012 at 16:45
-
You need to specify the url from the zone which you're crawling.
RebaseUriWithAlternateUri
from SPAlternateUrlCollectionManager may help you get that Jun 5, 2012 at 16:51 -
-
I missed your answer to the AAMs before I responded and we have different answers. My observations indicate that that AAMs do work. In my case the site name had the servername in one test and a publicly available host header in the second. Both worked and both returned 0 results if I put a character at the end of the URL (making it a different site). Jun 5, 2012 at 16:55