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
Mike Jansen
Apr 06, 2017Iron Contributor
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.
Mikael Svenson
Apr 07, 2017Steel 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