Forum Discussion
Mike Jansen
Apr 05, 2017Iron Contributor
Call "standard" search result page (or webpart) from custom query
I have a document library with a lot of documents (+1000). The documents have a "Label" column. I created a script which reads all those different Labels and populates a dropdown: When I s...
- Apr 07, 2017You need to construct the KQL to pass to limit for what you need:
/_layouts/15/osssearchresults.aspx?u=https://..path-to-document-library&k=myterm prop1:propvalue
If you column with a property is a site column it will have generated an automatic managed property for you which you can query for. Say you have a text site column named "Foo", then the managed property would be named FooOWSTEXT, and you query would be:
/_layouts/15/osssearchresults.aspx?u=https://..path-to-document-library&k=myterm FooOWSTEXT:label
Mikael Svenson
Apr 07, 2017Iron Contributor
You need to construct the KQL to pass to limit for what you need:
/_layouts/15/osssearchresults.aspx?u=https://..path-to-document-library&k=myterm prop1:propvalue
If you column with a property is a site column it will have generated an automatic managed property for you which you can query for. Say you have a text site column named "Foo", then the managed property would be named FooOWSTEXT, and you query would be:
/_layouts/15/osssearchresults.aspx?u=https://..path-to-document-library&k=myterm FooOWSTEXT:label
/_layouts/15/osssearchresults.aspx?u=https://..path-to-document-library&k=myterm prop1:propvalue
If you column with a property is a site column it will have generated an automatic managed property for you which you can query for. Say you have a text site column named "Foo", then the managed property would be named FooOWSTEXT, and you query would be:
/_layouts/15/osssearchresults.aspx?u=https://..path-to-document-library&k=myterm FooOWSTEXT:label
Mike Jansen
Apr 07, 2017Iron Contributor
Thanks, I think I'm getting close. Let me strip down some things:
Custom search page: https://blabla.sharepoint.com/sites/ilss/sitePages/results_dossier.aspx
Document library: https://blabla.sharepoint.com/sites/bla/500-3954858/3608134/Gedeelde%20%20documenten
Argument to search on: "mail"
Filter field: "Label" (when I go to library settings and edit this column, it says "Label" in the url)
Value to filter on: "some name" (notice the space).
So I created:
https://blabla.sharepoint.com/sites/bla/sitePages/results_dossier.aspx?u=https://blabla.sharepoint.com/sites/bla/500-3954858/3608134/Gedeelde%20%20documenten&k=mail Label:some%20name
There's no error but no results either.
Do you see something wrong?
- Mikael SvensonApr 07, 2017Iron ContributorLabel has to be a managed property. Look at docs for how columns are translated to crawled and managed properties. And put quotes around the label. label:"some label".
It's not hard once you understand how columns translate into searchable managed properties :) - Mike JansenApr 07, 2017Iron ContributorGot it!!!
https://blabla.sharepoint.com/sites/bla/sitePages/results_dossier.aspx?u=https://blabla.sharepoint.c... Refinablesting25:"some%20name"
So I created a refinablestring (put Label in it) and had to use double quotes.