views:

86

answers:

2

Is there a search API for getting a short text containing the search terms so that I can use to display to users?

A: 

Not sure exactly what you mean, but you could traverse through all managed and / or crawled properties? for more information look here MSDN

Examples from the referenced page:

Managed Properties:

Schema schema = new Schema(this.searchContext);
foreach (ManagedProperty prop in schema.AllManagedProperties)
{
  TreeNode node = treeViewManagedProperties.Nodes.Add(prop.Name);
  node.Tag = prop;
  foreach (Mapping mapping in prop.GetMappings())
  {
   node.Nodes.Add(mapping.CrawledPropertyName);
  }
}

Crawled Properties

Schema schema = new Schema(this.searchContext);
foreach (CrawledProperty cprop in schema.QueryCrawledProperties(string.Empty, 1000, Guid.NewGuid(), string.Empty, true))
{
  listBoxCrawledProperties.Items.Add(cprop);
}

EDIT: This is for MOSS BTW

Colin
+1  A: 

There's properties that can be returned from a search - HitHighlightedSummary & HitHighlightedFields.

If you're building a search in code you can request these in the same way as other fields - they should contain what you're after.

If you take a look at the configuration for the standard results web part, you can see there's an XML property which is the fields requested which includes these by default.

marcus.greasly