Hi there,
I really hope someone can help me with the following.
In short:
When trying to get search results from SharePoint (Office SharePoint Server Search), I get some, but not all the results I expect. I’m talking about a custom search implementation here, using either the object model, or the SharePoint Web Services to access the Search mechanism. With the object model, I use a FullTextSqlQuery to query the index and I’m looking for articles in a page library created with custom Page Layouts and Content Types. After creating the appropriate managed properties and performing a full crawl, I get only 2 of the 7 articles I expect. When I modify my query, i.e. by sorting my results on a different field, different articles are being returned, but always just 2.
No, unfortunately my row limit is not set to 2.
In detail:
The case:
I’m trying to build a News Article Management Solution that allows cross-Site-Collection article roll-up. The articles are targeted to users based on their User Profile properties.
Currently, it consists of the following:
Feature 1 (Site Collection scope), contains
- 6 Site Columns, of which 5 of type Choice, and 1 of type Text
- 1 Base Content Type, using all 6 Site Columns specified in previous bullet, and
o 8 Content Types, deriving from the Base Content Type
- 9 Page Layouts, each bound to their Associated Content Type as specified in previous bullet
Feature 2 (Site scope), contains
- 9 ContentTypeBinding elements, binding all previously specified ContentTypes to the page library “Pages”
1 custom Site Definition, based on the default News site definition as available in MOSS2007, only with Feature 2 automatically activated.
1 custom Web Part, using the object model to retrieve News Articles targeted to the logged on user, based on his Profile Properties.
The following steps led to the unexpected behavior:
I have a clean MOSS2007 environment, no SP1 installed, on which I install the features, site definition and web part mentioned above.
I create a new Collaboration Portal (default), and activate Feature 1.
I delete the default News subsite and create a new one based on my custom Site Definition.
In the Pages library, I create 7 News Articles, 5 of ContentType A, and 2 of ContentType B, all with different properties. The articles have names like “Article 1” to “Article 5” and “Press Release 1” and “Press Release 2”.
I let the search do a full crawl, I create the appropriate managed properties and perform another Full Crawl. (Checking the Crawl Log shows that each article url is crawled properly)
The web part, which uses the logged on user’s profile properties to generate a filter query, fires that query to the system but comes up with only part of the results I expect.
So I started debugging…
First I downloaded the MOSS Query Tool, to take out my custom Web Part code as a possible cause of the problem. In this new case, it’s just me, the query tool, and the SharePoint Search index. (Url of the MOSS Query Tool: The tool uses SharePoint Web Services to access the SharePoint environment, instead of the object model I use in the web part)
First of all, I started with the query my web part generated, it’s something like this:
SELECT Title, Path, NewsType, Created, NewsBusinessUnit, NewsSubBusinessUnit, NewsFunctionalArea, NewsCountry, NewsArticleLanguage FROM SCOPE() WHERE ("NewsType" > '') AND ("NewsBusinessUnit"='Business Unit A' OR "NewsBusinessUnit"='ALL') AND ("NewsSubBusinessUnit"='Business Unit A – Sub A.1' OR "NewsSubBusinessUnit"='ALL') AND ("NewsFunctionalArea"='Information Technology' OR "NewsFunctionalArea"='ALL') AND ("NewsCountry"='Netherlands' OR "NewsCountry"='ALL') AND ("NewsArticleLanguage"='Dutch' OR "NewsArticleLanguage"='English') ORDER BY created DESC
The part after “WHERE” is generated dynamically, based on the user logged on.
I get only 2 results, “Article 2” and “Article 5”, where I expect 4 (4 articles match to the User’s profile properties, “Article 2”; “Article 5”; “Press Release 1”; “Press Release 2”).
After a lot of things I tried, I came across a very weird phenomenon. When I remove the ORDER BY clause in the query I described, or change the field on which to order, I get different results! They’re always valid results, but never ALL results, always just 2. So for instance if I order by Title, descending, I get “Press Release 2” and “Press Release 1”.
I stripped the query to a minimum, just to see what’s in the index:
SELECT Title, Path, Created FROM SCOPE()
Of course, this returned a lot more than just news articles, because it returns everything that’s been indexed. But among all the results are still just 2 articles, where I expect all 7 to be in the lot.
Does anyone recognize this problem, where it seems like the Search provider wants to keep results to itself, even though in theory it should return them?
I really hope someone can help me with the following.
In short:
When trying to get search results from SharePoint (Office SharePoint Server Search), I get some, but not all the results I expect. I’m talking about a custom search implementation here, using either the object model, or the SharePoint Web Services to access the Search mechanism. With the object model, I use a FullTextSqlQuery to query the index and I’m looking for articles in a page library created with custom Page Layouts and Content Types. After creating the appropriate managed properties and performing a full crawl, I get only 2 of the 7 articles I expect. When I modify my query, i.e. by sorting my results on a different field, different articles are being returned, but always just 2.
No, unfortunately my row limit is not set to 2.
In detail:
The case:
I’m trying to build a News Article Management Solution that allows cross-Site-Collection article roll-up. The articles are targeted to users based on their User Profile properties.
Currently, it consists of the following:
Feature 1 (Site Collection scope), contains
- 6 Site Columns, of which 5 of type Choice, and 1 of type Text
- 1 Base Content Type, using all 6 Site Columns specified in previous bullet, and
o 8 Content Types, deriving from the Base Content Type
- 9 Page Layouts, each bound to their Associated Content Type as specified in previous bullet
Feature 2 (Site scope), contains
- 9 ContentTypeBinding elements, binding all previously specified ContentTypes to the page library “Pages”
1 custom Site Definition, based on the default News site definition as available in MOSS2007, only with Feature 2 automatically activated.
1 custom Web Part, using the object model to retrieve News Articles targeted to the logged on user, based on his Profile Properties.
The following steps led to the unexpected behavior:
I have a clean MOSS2007 environment, no SP1 installed, on which I install the features, site definition and web part mentioned above.
I create a new Collaboration Portal (default), and activate Feature 1.
I delete the default News subsite and create a new one based on my custom Site Definition.
In the Pages library, I create 7 News Articles, 5 of ContentType A, and 2 of ContentType B, all with different properties. The articles have names like “Article 1” to “Article 5” and “Press Release 1” and “Press Release 2”.
I let the search do a full crawl, I create the appropriate managed properties and perform another Full Crawl. (Checking the Crawl Log shows that each article url is crawled properly)
The web part, which uses the logged on user’s profile properties to generate a filter query, fires that query to the system but comes up with only part of the results I expect.
So I started debugging…
First I downloaded the MOSS Query Tool, to take out my custom Web Part code as a possible cause of the problem. In this new case, it’s just me, the query tool, and the SharePoint Search index. (Url of the MOSS Query Tool: The tool uses SharePoint Web Services to access the SharePoint environment, instead of the object model I use in the web part)
First of all, I started with the query my web part generated, it’s something like this:
SELECT Title, Path, NewsType, Created, NewsBusinessUnit, NewsSubBusinessUnit, NewsFunctionalArea, NewsCountry, NewsArticleLanguage FROM SCOPE() WHERE ("NewsType" > '') AND ("NewsBusinessUnit"='Business Unit A' OR "NewsBusinessUnit"='ALL') AND ("NewsSubBusinessUnit"='Business Unit A – Sub A.1' OR "NewsSubBusinessUnit"='ALL') AND ("NewsFunctionalArea"='Information Technology' OR "NewsFunctionalArea"='ALL') AND ("NewsCountry"='Netherlands' OR "NewsCountry"='ALL') AND ("NewsArticleLanguage"='Dutch' OR "NewsArticleLanguage"='English') ORDER BY created DESC
The part after “WHERE” is generated dynamically, based on the user logged on.
I get only 2 results, “Article 2” and “Article 5”, where I expect 4 (4 articles match to the User’s profile properties, “Article 2”; “Article 5”; “Press Release 1”; “Press Release 2”).
After a lot of things I tried, I came across a very weird phenomenon. When I remove the ORDER BY clause in the query I described, or change the field on which to order, I get different results! They’re always valid results, but never ALL results, always just 2. So for instance if I order by Title, descending, I get “Press Release 2” and “Press Release 1”.
I stripped the query to a minimum, just to see what’s in the index:
SELECT Title, Path, Created FROM SCOPE()
Of course, this returned a lot more than just news articles, because it returns everything that’s been indexed. But among all the results are still just 2 articles, where I expect all 7 to be in the lot.
Does anyone recognize this problem, where it seems like the Search provider wants to keep results to itself, even though in theory it should return them?