Link to home
Create AccountLog in
Avatar of Simbios
SimbiosFlag for Afghanistan

asked on

Your search cannot be completed because this site is not assigned to an indexer

Hello, I am trying to do a search, on Sharepoint 2010, Enterprise and I have this error

 

Your search cannot be completed because this site is not assigned to an indexer. Contact your administrator for more information.

 

I searched on internet, and find links about sp 2007, and it seems it works different, I havent been able to set this up in sharepoint 2010.

 

Thanks

 

 protected void Page_Load(object sender, EventArgs e)

        {

            List<SPListItem> lst = GetListItemsFromFTSQuery();

            GrvSearch.DataSource = lst;

            GrvSearch.DataBind();

        }

 

        public static List<SPListItem> GetListItemsFromFTSQuery()

        {

            string qry = HttpContext.Current.Request.QueryString["q"];

            List<SPListItem> items = new List<SPListItem>();

            DataTable retResults = new DataTable();

 

            using (SPSite site = SPContext.Current.Site)

            {

                FullTextSqlQuery fts = new FullTextSqlQuery(site);

                fts.QueryText = "SELECT owsItemURL,Title,FileExtension,ContentType,Created,LastModifiedTime,Path FROM SCOPE() " +

                  "WHERE (CONTAINS(Path,'\"/Lists/ \"')) " +

                  "AND (CONTAINS(Title," + qry + "))  ";

                fts.ResultTypes = ResultType.RelevantResults;

                fts.RowLimit = 300;

 

                ResultTableCollection rtc = fts.Execute();

                if (rtc.Count > 0)

                {

 

                    using (ResultTable relevantResults = rtc[ResultType.RelevantResults])

                        retResults.Load(relevantResults, LoadOption.OverwriteChanges);

 

                    foreach (DataRow row in retResults.Rows)

                    {

                        if (row["ContentType"].ToString() == "Item")

                        {

                            using (SPSite lookupSite = new SPSite(row["owsItemUrl"].ToString()))

                            {

                                using (SPWeb web = lookupSite.OpenWeb())

                                {

                                    SPFile file = web.GetFile(row["owsItemUrl"].ToString());

                                    items.Add(file.Item);

                                }

                            }

                        }

                    }

                }

                return items;

            }

        }
Avatar of Justin Smith
Justin Smith
Flag of United States of America image

Do you have a search service app deployed?  
Avatar of Simbios

ASKER

the standard search so I suppose yet, but please tell me how can I verify that.

Thanks
App management - manage service applications. Do you are search in the list?
ASKER CERTIFIED SOLUTION
Avatar of Simbios
Simbios
Flag of Afghanistan image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Why are you using Foundation search if you have a full version of SharePoint??
Avatar of Simbios

ASKER

I dont know, in the manage content database, the only option for search says, Select a Search Foundation Server! there are no more options
Avatar of Simbios

ASKER

found the solution