Skip Navigation LinksHome > News Groups > microsoft.public.sharepoint.portalserver.development

.NET development starting at $25 per hour

FullTextSqlQuery contains problem
From jimmy.andersson@modul1.se on 1/19/2007 1:05:28 AM
I have noticed a issue with the FullTextSqlQuery object using contains.
I have written a quick search webpart using the FullTextSqlQuery object
but I noticed that it always return the wrong result when I use
contains on a choice field and use the first value in the field for the
search.

I have 2 documents in the system
Doc1 has its "sector" field set to "Sector 2"
Doc2 has its "sector" field set to "Sector 3"

The possible sector choices are "Sector 1", "Sector 2",
"Sector 3", "Sector 4"


Query 1, should return nothing but returns Doc1
-------------------------------------------------------------------------------------------------------------------------
{SELECT
title, path, sector
FROM SCOPE()
WHERE
CONTAINS(xContent, '"Spec Documents" OR "Dep Documents" OR "Hep
Documents"')
AND CONTAINS(sector, '"Sector 1"')
AND IsDocument=1
AND "scope"='All Sites'}



Query 2, should return Doc1 and does so.
-------------------------------------------------------------------------------------------------------------------------
{SELECT
title, path, sector
FROM SCOPE()
WHERE
CONTAINS(xContent, '"Spec Documents" OR "Dep Documents" OR "Hep
Documents"')
AND CONTAINS(sector, '"Sector 2"')
AND IsDocument=1
AND "scope"='All Sites'}


Query 3, should return Doc2 and does so.
-------------------------------------------------------------------------------------------------------------------------
{SELECT
title, path, sector
FROM SCOPE()
WHERE
CONTAINS(xContent, '"Spec Documents" OR "Dep Documents" OR "Hep
Documents"')
AND CONTAINS(sector, '"Sector 3"')
AND IsDocument=1
AND "scope"='All Sites'}



Query 4, should return nothing and does
-------------------------------------------------------------------------------------------------------------------------
{SELECT
title, path, sector
FROM SCOPE()
WHERE
CONTAINS(xContent, '"Spec Documents" OR "Dep Documents" OR "Hep
Documents"')
AND CONTAINS(sector, '"Sector 4"')
AND IsDocument=1
AND "scope"='All Sites'}




The reason I use contains is that the user can select multiple choices
for sector, so instead of making the query more complex by adding
multiple "OR" statements I picked to use "contains". The syntax
examples are greatly simplified in this examples to verify that its
nothing else in the query that cause the problems.
Any ideas? Are there some problems with the object itself or am I
missing something?

Related Items

Re: How to trap virus error when uploading file to sharepoint programmatically.
Re: SPS horizontal navigation bar
Re: List All Portal Users
Re: Databind DataGrid
RE: InfoPath publish to Sharepoint with Forms Authentication
Increase the multiple line column size for SharePoint document lib
filter site columns
RE: PHPBB in search
Update event fires twice when doclibrary item has been published
Re: Document List Searching