How to include custom managed metadata in FullTextSQLQuery searches?

Hi,

I am using spservices jquery libraries to make sql search queries to the search service. I created a managed metadata called DocumentGUID which is mapped to the document guid crawled property. I ran a full crawl and when I try this query, the result contains no field for the DocumentGUID. I did some research and found these:


http://stackoverflow.com/questions/2293066/how-do-i-perform-a-moss-fulltextsqlquery-and-filter-people-results-by-the-skills

http://sharepoint.stackexchange.com/questions/17644/sp-2010-fulltextsqlquery-display-managed-properties-in-query-results

It seems I need to enable them. So from the first link, I am trying this c# console app, that will do it for me, but I am getting errors with the code.

These two

using Microsoft.Office.Server;
using Microsoft.Office.Server.Search.Administration;

are not being found....

Does anyone know how to fix this?

Thanks.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Server;
using Microsoft.Office.Server.Search.Administration;

namespace FixManagedMetaData
{
    class Program
    {
        static void Main(string[] args)
        {


        }

        private void EnsureFullTextQueriableManagedProperties(ServerContext serverContext)
        {
            var schema = new Schema(SearchContext.GetContext(serverContext));
            var managedProperties = new[] { "DocumentGUID" };
            foreach (ManagedProperty managedProperty in schema.AllManagedProperties)
            {
                if (!managedProperties.Contains(managedProperty.Name.ToUpper()))
                    continue;

                if (managedProperty.FullTextQueriable)
                    continue;

                try
                {
                    managedProperty.FullTextQueriable = true;
                    managedProperty.Update();
                    Console.WriteLine("Successfully set managed property {0} to be FullTextQueriable: " + managedProperty.Name);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Error updating managed property {0}: " + managedProperty.Name);
                }
            }
        }

        
    }
}


June 30th, 2013 6:36am

After you mapped the new managed property to the "document guid" crawled property did you do a full crawl?
Free Windows Admin Tool Kit Click here and download it now
July 5th, 2013 1:45am

yes I did.
July 5th, 2013 6:06pm

Did you include a reference in your VS solution for Microsoft.office.server.dll?

In solution explorer, right click the references entry, and choose add new reference. In the window that pops up, choose the SharePoint tab and find Microsoft.Office.Server.dll and add it.

Paul.

Free Windows Admin Tool Kit Click here and download it now
July 6th, 2013 4:18pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics