Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

In my query I use the freetext predicate:

and freetext(Contents, 'my search string')

I'm getting some unexpected results from this search, namely the documents contain no relevant content, yet are getting returned. I would like to return this Contents field used by the predicate to examine what it contains. Just putting it in the select columns:

select filename, path, fileextension, author, lastmodifiedtime, site, Contents from scope()

throws a SOAP exception:

Property doesn't exist or is used in a manner inconsistent with schema settings.

This query runs fine when the Contents column is not selected for return. How can I examine the Content column of the returned results?

Here is my total query:

<QueryPacket xmlns="urn:Microsoft.Search.Query">
    <Query>
        <SupportedFormats>
            <Format>urn:Microsoft.Search.Response.Document:Document</Format> 
        </SupportedFormats>
        <Context>
            <QueryText type="MSSQLFT" language="en-us">select filename, path, fileextension, author, lastmodifiedtime, site, Contents from scope() where IsDocument= TRUE and contentclass = 'STS_ListItem_DocumentLibrary' and (fileextension != 'dotx' and fileextension != 'dot' and fileextension != 'dotm' and fileextension != 'xltx' and fileextension != 'xlt' and fileextension != 'xltm' and fileextension != 'potx' and fileextension != 'pot' and fileextension != 'potm' and fileextension != 'accdt' and fileextension != 'vst') and (Site = 'http://my.sharepointsite/personal/somedocumentlibrary')</QueryText> 
            </Context>
        <Range>
            <StartAt>1</StartAt> 
            <Count>500</Count> 
        </Range>
        <EnableStemming>true</EnableStemming> 
        <TrimDuplicates>false</TrimDuplicates> 
        <IgnoreAllNoiseQuery>true</IgnoreAllNoiseQuery> 
        <ImplicitAndBehavior>true</ImplicitAndBehavior> 
        <IncludeRelevanceResults>true</IncludeRelevanceResults> 
        <IncludeSpecialTermResults>false</IncludeSpecialTermResults> 
        <IncludeHighConfidenceResults>false</IncludeHighConfidenceResults> 
    </Query>
</QueryPacket>
share|improve this question
add comment

1 Answer 1

To search within the document, you dont need specify content as a selected column. Simply write

SELECT column1,column2, column3
FROM scope()
WHERE FREETEXT('my search string')
and column1 = 'something'

If you want to use freetext (or contain) against column ie title etc, you can specify column name in query

FREETEXT([<full-text_column>,]'<contains_condition>')

But if you want to use it against document content, you dont need to specify it. The full-text column reference is optional. For relevance purposes, MSDN recommend that you specify DEFAULTPROPERTIES here. For example:

WHERE FREETEXT(DEFAULTPROPERTIES, 'computer software')

will searches for documents that contain the search terms "computer" and "software".

share|improve this answer
    
Thanks for your reply. That is not what I asked though - the search is finding false positives on results and I would like to know why. Exactly the same results are returned whether Content is specified or not. DefaultProperties is no good either - I only want to search content, not metadata. –  sennett Jul 19 '12 at 3:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.