5

In pre-launch preparation phases; am attempting to convert CSWP "page rollup" queries from absolute paths on our staging site to relative paths, so that when we cutover we don't have to update all the CSWPs. It's working fine when I provide a single relative path, but when I provide multiple relative paths, well... it's not working as (I, at least,) expect.

Test 01 --- path:http://www-staging.example.com/path1/patha --- returns correct single target

Test 02 --- path:http://www-staging.example.com/path2/pathb --- returns correct single target

Test 03 --- path:http://www-staging.example.com/path1/patha OR path:http://www-staging.example.com/path2/pathb --- returns both correct targets

Test 04 --- path:{SiteCollection.URL}path1/patha/ --- returns correct single target

Test 05 --- path:{SiteCollection.URL}path2/pathb/ --- returns correct single target

Test 06 --- path:{Site.URL}path1/patha/ --- returns correct single target

Test 07 --- path:{Site.URL}path2/pathb/ --- returns correct single target

The following all return the second correct target and two seemingly random views from the Pages Library?

Test 08 --- path:{SiteCollection.URL}path1/patha OR path:{SiteCollection.URL}path2/pathb

Test 09 --- path:{SiteCollection.URL}path1/patha/ OR path:{SiteCollection.URL}path2/pathb/

Test 10 --- path:{SiteCollection.URL}/path1/patha/ OR path:{SiteCollection.URL}/path2/pathb/

Test 11 --- path:{SiteCollection.URL}/path1/patha OR path:{SiteCollection.URL}/path2/pathb

Test 12 --- path:{SiteCollection}path1/patha OR path:{SiteCollection}path2/pathb

Test 13 --- path:{SiteCollection}path1/patha/ OR path:{SiteCollection}path2/pathb/

Test 14 --- path:{SiteCollection}/path1/patha/ OR path:{SiteCollection}/path2/pathb/

Test 15 --- path:{SiteCollection}/path1/patha OR path:{SiteCollection}/path2/pathb

Test 16 --- path:{Site.URL}path1/patha OR path:{Site.URL}path2/pathb

Test 17 --- path:{Site.URL}path1/patha/ OR path:{Site.URL}path2/pathb/

Test 18 --- path:{Site.URL}/path1/patha/ OR path:{Site.URL}/path2/pathb/

Test 19 --- path:{Site.URL}/path1/patha OR path:{Site.URL}/path2/pathb

Test 20 --- path:{Site}path1/patha OR path:{Site}path2/pathb

Test 21 --- path:{Site}path1/patha/ OR path:{Site}path2/pathb/

Test 22 --- path:{Site}/path1/patha/ OR path:{Site}/path2/pathb/

Test 23 --- path:{Site}/path1/patha OR path:{Site}/path2/pathb

Putting quotes around the path, i.e. --- path:{Site}"/path1/patha" OR path:{Site}"/path2/pathb" --- results in zero results returned for any of those tests.

Putting parens around the entire query, i.e. --- (path:{Site}/path1/patha OR path:{Site}/path2/pathb) --- results in no difference in results returned for any of those tests (still get the second result and two random views from the Pages Library)

What am I doing wrong here? I feel like I'm missing something fairly obvious in the KQL syntax but neither http://technet.microsoft.com/en-us/library/jj683123(v=office.15).aspx nor http://msdn.microsoft.com/en-us/library/office/ee558911(v=office.15).aspx, nor the power of Google and Bing Search, is helping me understand what it is.

Any insights?

  • I'll see if I can reproduce on my environment, but as an aside, you don't need an OR technically; if you query the same property, it is considered an implied OR. :-) Also, can you provide the path to the random views from the Pages Library that you are getting? – Robin Jul 30 '14 at 15:33
  • Forgot to mention that oddity! I know that the OR is implied if it (or AND) isn't stated, but if I leave it out, I get zero results on tests 8-23... works fine without the OR on test1. I imagine your wondering if the "random views" are being returned legitimately by the path query... assume you know the path1/patha path2/pathb stuff is obfuscated for forum posting purposes, but please know I've looked up and down at those two views for what makes them so special. The two views URLs are: /Pages/Forms/By%20Content%20Type%20and%20Layout.aspx /Pages/Forms/Check%20Out%20View.aspx – Precursive Jul 30 '14 at 15:56
  • None of the words in those paths (Pages, Forms, By, Content, Type, and, Layout, Check, Out, or View) are in any way in the queries I'm trying, for what that's worth? Hope all is well, thanks for taking a peak. – Precursive Jul 30 '14 at 15:57
  • I would use the search query tool to debug the query - with it you can see how your query was interpreted / translated to. – Max Melcher Aug 2 '14 at 17:55
4

This is a slightly different way to solve your problem: if you are getting random list views, maybe you could specify to return only Pages? Add to your query:

ContentTypeId:0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF39*

Okay, I can duplicate your issue (I think). This is what I used that got me the Pages for two subsites:

ContentTypeId:0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF39*
Path:{\SiteCollection.URL}/subsite/subsitea/ 
Path:{\SiteCollection.URL}/subsite/subsiteb/ 
Site<>{\SiteCollection.URL}
  • :P Clever! Would probably be an acceptable work around, except that my query isn't returning all of the correct targets and the incorrect targets... but rather only the "last specified" correct target and the incorrect targets... filtering the incorrect ones still doesn't get me what I need. Note, if I add a third target into my query, I get the third target back but not the first two, plus the random views... a fourth target, I get the fourth target back but not the first three, plus the random views, etc. – Precursive Jul 30 '14 at 17:32
  • Alright, think I just got the "first trick" figured out here: Syntax I used was --- path:{Site.URL}(terma OR termb) --- still not able to use the full path, i.e., this does not work correctly --- path:{Site.URL}(path1/patha OR path2/pathb) --- and I am having to filter out the random view results --- but closer, at least am getting all the correct targets back :) Wonder if it has anything to do with using managed navigation... hmm... – Precursive Jul 30 '14 at 17:52
0

Not sure if it should be, but the syntax you offered isn't working for me. Whenever I have more than one {RelativityAnchor} in the query, nothing works right.

I've found the syntax...

path:{RelativityAnchor}(patha OR pathb OR pathc) 

... to work best, though it still has the quirk where I can't reliably use full relative paths such as 'site1/subsite2/patha' but only 'patha'. For some paths it works, for others, it doesn't. As long as the friendly target names remain unique enough, this solution should work, though it begs a future case where it won't, so I'm going to keep digging a bit on that. I'm wondering if its related to pages whose paths have moved around during their lifetime and some sort of caching or misindexing, but haven't nailed down a pattern yet.

On the bright side, for whatever reason, the system in no longer returning the wrong results (the random views). I hate when stuff stops not working for no apparent reason! I'm going to keep an eye on this, but for now the problem just seems to no longer exist.

With the syntax I just mentioned and the wrong results gone, I think the spirit of this thread is fulfilled. Thanks for working things through with me, appreciate the collegiality of this forum and folks such as yourself a lot.

Peace and Joy, Nick

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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