Forum Discussion
Call "standard" search result page (or webpart) from custom query
- 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
I tried a, long, night to get it running. But no luck.
I try to manipulate the search URL. But it look like is is not possible with only the "k=" parameter. As far as I can see I can only pass a search keyword. But I need to pass, a keyword, a document library and a property of the documents.
"Show all documents(from document library X) with keyword "Dog" where label is some lookupvalue"
The search api query I use now is:
https://blabla.sharepoint.com//_api/web/lists/getByTitle('Documents')/items?$select=FileLeafRef,FileRef,File_x0020_Type,Categorie,Label/Title&$expand=Label&$filter=Label/Title eq %27"+ inputLabel +"%27&rowlimit=500All I want is to pass the results to a standaard search webpart or page.
/_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 JansenApr 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.