1

I want to create one page or document library where can I perform search. Suppose user hit the Url like http://mysite/doclibname/filestartnamethat time on my page show only filestartname files. How can I do?

4
  • hi, Please correct me If my understanding is wrong ? You are asking that you want to create a page where the search results has to show, when a user type the text on search text box and hit the search button or press enter. it has to redirected to your page and you want to display the results in your own page ? Feb 22, 2017 at 11:44
  • No I want to give user link like mysite/doclibname/filestartname when user click on this i want to show only this document on my page.
    – Admin
    Feb 22, 2017 at 11:47
  • it is not clear still can you please eloberate with little more explanation Feb 22, 2017 at 11:51
  • <a href="mysite/doclibname/filestartname"> Click Here to open File</a> This is my code when user click on this link open my document library and show only this "filestartname" document.
    – Admin
    Feb 22, 2017 at 12:00

1 Answer 1

3

Please check this it might helpful to you.

  1. You create a result source in Site search settings for this go to Site Settings -> Search -> result source -> create new result source

go to result source create new result

  1. type the name of the source and click on "Launch Query builder"

Query builder

  1. Paste the Query which is given here

    {QueryString.MyParameter1} {?owstaxIdMetadataAllTagsInfo:{Tag}} (FileExtension:doc OR FileExtension:docx OR FileExtension:xls OR FileExtension:xlsx OR FileExtension:ppt OR FileExtension:pptx OR FileExtension:pdf) (IsDocument:"True" OR contentclass:"STS_ListItem")

  2. click on Ok and Save button to create result source

  3. you create a web part page like "Result.aspx" in page library
  4. insert search result webpart and go to Webpart Properties and select the result source and click on apply and ok to save the changes

Webpart properties Switch mode select the result source

  1. after that you can specify url for anchor tag "/Pages/Search.aspx?MyParameter1=Title:filestartname*" with query string. in your case <a href="mysite/Pages/Search.aspx?MyParameter1=Title:filestartname*">; Click Here to open File</a>

  2. it automatically filter the result and show based on "filestartname".

Please check and let me know if you need any additional information.

13
  • Search Preview test screen I get result but when hit he url that time not work.
    – Admin
    Feb 22, 2017 at 14:31
  • If you keep this {QueryString.MyParameter1} and in test result preview you cannot see the results as the query text comes from query string. You just save and pass manually in the url and you can the results on the page directly. Feb 23, 2017 at 5:11
  • Yes bro I pass the value in URL but result not display. href="mysite/Pages/Search.aspx?MyParameter1=filestartname* When i pass this URL result display but when i pass url href="mysite/Pages/Search.aspx?MyParameter1=Title:filestartname* that time not display. why?
    – Admin
    Feb 23, 2017 at 5:23
  • May be Title(Title:filestartn‌​ame*) field is blank for all documents in library. you try with other fields present in library which has data like author. author:admin* Feb 23, 2017 at 5:30
  • I try other fields but not work this "MyParameter1=Title:filestartn‌​ame" But when I try this MyParameter1=filestartn‌​ame* that time filter
    – Admin
    Feb 23, 2017 at 5:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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