0

I need to create SPFx with search that scope of search will be full website and it will be searching by using pnp/sp.

I find code that only searched by list name, but I need search by full website.

 pnp.sp.web.lists.getById(list).items;

How can I implement it?

1
  • Sorry, that code "pnp.sp.web.lists.getById(list).items" is not for searching, it's to get items under a SharePoint List. There's a big difference which method you're going to use, because both are different. So can you please describe what's the requirement? If you want to search by full website, what's the search criteria, or any detailed requirement around it? Dec 28, 2022 at 3:24

1 Answer 1

0

I'm not sure to what level the SPFx search that you're trying to work out. My opinion, you can use the PnP Modern Search (link below) so you can save time building it, extend the functionality (as necessary), then focus the energy on building a good SharePoint Search.

If you're on SharePoint Online, there's a new concept of Microsoft Search that's completely different with SharePoint Search, which is basically indexing the entire Office 365 artifacts. PnP Modern Search was built for this too leveraging pnp/sp library.

PnP Modern Search looks like below.

enter image description here

If you go with the SharePoint Search method, the 3 basic key concept is to build Result Sources, Search Schema, and Query Rules.

  1. Configure Result Sources - the entry point from where you'll configure your data source for PnP Modern Search.
  2. Configure the Search Schema - this is where you play with managed properties globally in the SharePoint Search world and create global alias for properties you want to promote in the search function.
  3. Query Rules - where you want to improve the search result coming out from it.

The exercise no 2 & 3 will usually take days if you have a lot of content (based on my experience), not like snap finger then quickly done. Because managed properties can only be configured if the properties have been indexed.

As for Microsoft Search, I have not personally done research for it, but it seems pretty simple as compared to SharePoint Search. Read: Microsoft Search.

1
  • Thank you, but I need made development by myself.
    – Ann
    Dec 27, 2022 at 9:32

Your Answer

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

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