10

Currently I am using the property bag with values that are comma separated something like:

web.AllProperties["fruits"] = "bananas, apples, oranges, tomatoes";

Currently search is treating them as one search word and I am wondering which delimiter I am using for search to use them as individual searchable words when indexed or if it is even possible this way ?

1
  • 3
    I don't think exist a solution with delimeters. You have to create a property for each value. Ex: myproperty1, myproperty2, mypropertyN Commented Mar 28, 2014 at 12:28

2 Answers 2

1

If you have a complete list of the different types of fruit (or whatever object) you want to search then you could use managed metadata and set up a custom termset.

1

The property bag is simply a hash table. You could start with an array and iterate it in order to add a property for each item. Then add a property for Fruit:

SPWeb web = SPContext.Current.Web;
web.AllowUnsafeUpdates = true;
$fruitsArray = @("fruit","bannana","apple","orange");
foreach ($i in $fruitsArray)
{
    web.AllProperties["MyFruitTerm" + [array]::IndexOf($fruitsArray,$i)] = $i;
    web.IndexedPropertyKey.Add($i);
}
web.Update();
web.AllowUnsafeUpdates = false;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.