November Happy Hour will be moved to Thursday December 5th.

EPiServer Full Text Search

Vote:
 

Hi Guys

I have introduced FTS search on one of my projects it seems to be indexing files just fine and I can see timestamp of the segments being updated when i run the re-index

Although the data which is being returned is still out of date eg.

I had a Page called Test, and it was returned when doing a Field Query by Field.Title using "Test" as the queryExpression.

I than changed the PageName to JoeBloggs although this time when using "JoeBloggs" as the queryExpression nothing returned. Although page still being returned when using the original query !

Any idea on what is going wrong is my index files being updated or am i being decieved

 

Cheers


Minesh

#58079
Apr 12, 2012 16:19
Vote:
 

Just an update I can see the data going into the bigtable with the updated values just fine. Not sure if this helps

#58083
Apr 12, 2012 16:46
Vote:
 

The issue was that the index files were not being updated with the new data for the page in question. The error logs showed that an error was occuring when the index was trying to index a parent 'Referenced' page which did not actually exist.

protected virtual void SetStandardPagePropertiesInIndexItem(PageData page, IndexRequestItem item)
{
   item.Uri = new Url(page.LinkURL).Uri;
   item.Title = page.PageName;
   item.Created = page.Created;
   item.Modified = page.Changed;
   item.Culture = page.LanguageID;
   item.ItemType = item.ItemType = Enum.GetName(typeof(CmsItemType), CmsItemType.Page);
   item.Authors.Add(page.CreatedBy); 
            
   item.ReferenceId = page.PageTypeName;
}

    

The reason for this was that the CmsSearchHandler was altered to try and index the PageTypeName which was being pushed into the ReferenceID property. Once this was found to be the issue moving the PageTypename data to be stored in the MetaData solved the issues and the results were now being returned correctly.

protected virtual void SetStandardPagePropertiesInIndexItem(PageData page, IndexRequestItem item)
{
   item.Uri = new Url(page.LinkURL).Uri;
   item.Title = page.PageName;
   item.Created = page.Created;
   item.Modified = page.Changed;
   item.Culture = page.LanguageID;
   item.ItemType = item.ItemType = Enum.GetName(typeof(CmsItemType), CmsItemType.Page);
   item.Authors.Add(page.CreatedBy); 
            
   item.Metadata = Internal.MetaDataQuery.GetExpression("PageTypeName", pageData.PageTypeName); 
}

The 'GetExpression' property can be seen below in my followup reply.

#58575
Edited, May 01, 2012 13:21
Vote:
 

Returning results by searching MetaData

We found that although the data was now being indexed correctly you cannot search just the MetaData using the key 'EPISERVER_SEARCH_METADATA' as this returned no results so in order to search the data stored in the MetaData we had to use a default search 'EPISERVER_SEARCH_DEFAULT'. which obviously searches other content not resticted to the MetaData. In order to make the values in the MetaData unique for search purposes the MetaData was tagged in the index and this tagged data was searched.

[[MetaDataKey=MetaDataValue]]

protected string GetExpression
{
   get
   {
       StringBuilder builder = new StringBuilder();
       builder.Append("[[");
       builder.Append(Property);
       builder.Append("=");
       builder.Append(Value);
       builder.Append("]]");
       return builder.ToString();
   }
}

public virtual string GetQueryExpression()
{
   StringBuilder builder = new StringBuilder();
   builder.Append("EPISERVER_SEARCH_DEFAULT");
   builder.Append(":(");
   builder.Append(GetSafeQuotedPhrase(this.QueryExpression));
   builder.Append(")");
   return builder.ToString();
}

This allowed us to uniquely searchfor particular metadata properties.

If anyone can shed any light on using 'EPISERVER_SEARCH_METADATA' that would be very useful as it would provide a more directed search than that of the default which covers other properties and hence also provide some performance improvements.

#58576
Edited, May 01, 2012 13:36
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.