1

I am trying to create a custom refiner based on the path managed property. After selecting it should show items in a directory so I have to use a prefix search with the property path.

var refiner = { "Path": ["ǂǂ" + asc2hex(directoryPath + '*')] };
ctx.ClientControl.updateRefiners(refiner, 'or', false, null);

Apparently this leads to zero results. When I leave out the * it only shows the directory.

Any pointers?

Update 1 (8/6/2014 11:22):

It partially works with

refiner = { "Path": ['starts-with("' + directoryPath + '")'] };

But that does only return 1 result - not not the elements in that directory. Anyone knows why?

2
  • 1
    So it is only showing items in sub-directories right now? If so, you could substring directoryPath to remove the last char (that probably is a /?) Aug 6, 2014 at 9:25
  • It does show only the directory. But removing the trailing slash and adding a wildcard works! Aug 6, 2014 at 9:36

1 Answer 1

1

How about:

directoryPath = directoryPath.substring(0, directoryPath.length -1) + '*'
refiner = { "Path": ['starts-with("' + directoryPath + '")'] };

It could be a trailing / that stops it from including the current site

2
  • Thats a workaround for now - thanks for that. Its not 100% tho, imagine two folders with the name folder1 and folder11 ;) Aug 6, 2014 at 9:52
  • Yeah there is still culprits with this approach. I don't think the Path attribute was meant to filter on a lower level than site, in which case removing the trailing / would not be necessary Aug 6, 2014 at 9:59

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.