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

Oracle SQL Downloadable Training Videos

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

Sharepoint 2003 form authentication
RE: Using Wildcards in the CONTAINS Predicate
connecting sql and sharepoint
moving items from list to list in another site using workflow
Re: Remove the checkbox --- "Add a listing for this document"
Sharepoint webservices
Alert email setup
Using Wildcards in the CONTAINS Predicate
MOSS 2007 to crawl documents in Livelink
Re: knowing wich previleges i have
Visitor's Insurance