Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is:issue is:open how can we trigger incremental crawl when new docs are added and they need to be searched immediately-"startFullCrawl": true powerautomate http post #10

Open
swiftinitdotcom opened this issue Jan 31, 2023 · 4 comments

Comments

@swiftinitdotcom
Copy link

is:issue is:open how can we trigger incremental crawl when new docs are added and they need to be searched immediately-"startFullCrawl": true powerautomate http post

I tried below-
Create a new Power Automate flow and choose "HTTP" as the trigger.
Add an "HTTP" action to make a POST request to the SharePoint Search REST API endpoint. The URL for the endpoint is typically in the format: https:///_api/search/admin/fullcrawl.
In the "Headers" section of the HTTP action, add the following key-value pairs:
"Accept": "application/json;odata=verbose"
"Content-Type": "application/json;odata=verbose"
"X-RequestDigest": "" (you will need to obtain the RequestDigest value from the SharePoint site)
In the "Body" section of the HTTP action, add the following JSON payload:
json
Copy code
{
"startFullCrawl": true
}
Save the flow and test it by running it. This should trigger a full search crawl on the SharePoint site.
Note: The above steps assume that you have the necessary permissions to trigger search crawls on the SharePoint site.

Ami Loh
how to use graph api to search document libraries
You can use Microsoft Graph API to search for documents in a SharePoint document library by making a GET request to the /search endpoint. Here's an example of how you can search for all documents in a document library named "Documents" in a site named "MySite":

Construct the URL for the search request: https://graph.microsoft.com/v1.0/sites/MySite:/drive/root/search(q='fileExtension:docx')
Add an "Authorization" header to the request with a valid access token.
Send the GET request to the URL.
The response will contain an array of search results, each of which represents a document in the document library. You can use the properties of each search result, such as webUrl, to access the document or to display information about it.

Note: You'll need to have the necessary permissions to access the SharePoint site and document library, as well as to make requests to the Microsoft Graph API.

{
"startFullCrawl": true
}

@wobba
Copy link
Owner

wobba commented Jan 31, 2023

There is no incremental crawl, only continous. Any queuing of full crawl/re-crawl will only have an adverse affect on indexing.

A change on an item will be picked up automatically depending on overall farm load (shared by all tenants on a farm).

Re-crawl should only be clicked or scheduled when there is a schema change impacting existing items.

@swiftinitdotcom
Copy link
Author

swiftinitdotcom commented Jan 31, 2023 via email

@swiftinitdotcom
Copy link
Author

How do we instantly search recently uploaded documents without waiting for 30 minutes or 1 hr call, can we write some workaround where there is second mehtod that will also check for last 1 hr uploaded files(in file upload event we will store those doc id's in one list saying last 1 hr files uploaded or modfied with their content or metadata) and then use graph api or rest api to parse through those id's(for example 5 documents uploaded or modified in last 45 minutes) and then we also take those in account.
https://powerusers.microsoft.com/t5/Using-Flows/flow-example-using-rest-api-to-search-sharepoint-documents/td-p/865547
Because when new 50 documents are uploaded if other users searching they are invisible for 1 hr or so depending on crawl schedule

@wobba
Copy link
Owner

wobba commented Feb 1, 2023

There is no way to control the latency as I said. If you want to surface docs instantly somewhere you cannot use the search API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants