SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to execute a search in SharePoint 2010 with the FullTextSqlQuery class:

using (SPSite site = new SPSite("http://localhost"))
{
  using (FullTextSqlQuery query = new FullTextSqlQuery(site))
  {
    query.QueryText = "SELECT Title, FooText FROM scope() WHERE FooText = 'Foo2'";
    query.ResultTypes = ResultType.RelevantResults;

    //result output here...
  }
}

The SQL statement used above returns some results. But with the following statement, replacing '=' with 'LIKE', no results are returned:

SELECT Title, FooText FROM scope() WHERE FooText LIKE 'Foo2'

Note: FooText is a Managed Property of type Text and single valued.

share|improve this question
up vote 2 down vote accepted

Have you set the "Reduce storage requirements for text properties by using a hash for comparison" option for your FooText managed property?

share|improve this answer
    
Your are right. Setting the "Reduce storage requirements for text properties by using a hash for comparison" option makes the LIKE predicate work. Thank you! – Matthias Sep 30 '10 at 14:54

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.