Comparing version 1.1.5-4 to 1.1.5-5
@@ -33,2 +33,33 @@ # @pnp/sp/search | ||
## Search Result Caching | ||
_Added in 1.1.5_ | ||
As of version 1.1.5 you can also use the searchWithCaching method to enable cache support for your search results this option works with any of the options for providing a query, just replace "search" with "searchWithCaching" in your method chain and gain all the benefits of caching. The second parameter is optional and allows you to specify the cache options | ||
```TypeScript | ||
import { sp, SearchQuery, SearchResults, SearchQueryBuilder } from "@pnp/sp"; | ||
sp.searchWithCaching(<SearchQuery>{ | ||
Querytext: "test", | ||
RowLimit: 10, | ||
EnableInterleaving: true, | ||
}).then((r: SearchResults) => { | ||
console.log(r.ElapsedTime); | ||
console.log(r.RowCount); | ||
console.log(r.PrimarySearchResults); | ||
}); | ||
const builder = SearchQueryBuilder().text("test").rowLimit(3); | ||
// supply a search query builder and caching options | ||
sp.searchWithCaching(builder, { key: "mykey", expiration: dateAdd(new Date(), "month", 1) }).then(r2 => { | ||
console.log(r2.TotalRows); | ||
}); | ||
``` | ||
## Paging with SearchResults.getPage | ||
@@ -35,0 +66,0 @@ |
{ | ||
"name": "@pnp/sp", | ||
"version": "1.1.5-4", | ||
"version": "1.1.5-5", | ||
"description": "pnp - provides a fluent api for working with SharePoint REST", | ||
@@ -11,5 +11,5 @@ "main": "./dist/sp.es5.umd.js", | ||
"peerDependencies": { | ||
"@pnp/common": "1.1.5-4", | ||
"@pnp/logging": "1.1.5-4", | ||
"@pnp/odata": "1.1.5-4" | ||
"@pnp/common": "1.1.5-5", | ||
"@pnp/logging": "1.1.5-5", | ||
"@pnp/odata": "1.1.5-5" | ||
}, | ||
@@ -16,0 +16,0 @@ "author": { |
@@ -1,2 +0,2 @@ | ||
import { SearchQuery, SearchResults, ISearchQueryBuilder } from "./search"; | ||
import { SearchResults, SearchQueryInit } from "./search"; | ||
import { SearchSuggestQuery, SearchSuggestResult } from "./searchsuggest"; | ||
@@ -12,2 +12,3 @@ import { Site } from "./site"; | ||
import { SPConfiguration } from "./config/splibconfig"; | ||
import { ICachingOptions } from "@pnp/odata"; | ||
/** | ||
@@ -51,4 +52,11 @@ * Root of the SharePoint REST module | ||
*/ | ||
search(query: string | SearchQuery | ISearchQueryBuilder): Promise<SearchResults>; | ||
search(query: SearchQueryInit): Promise<SearchResults>; | ||
/** | ||
* Executes the provided search query, caching the results | ||
* | ||
* @param query The SearchQuery definition | ||
* @param options The set of caching options used to store the results | ||
*/ | ||
searchWithCaching(query: SearchQueryInit, options?: ICachingOptions): Promise<SearchResults>; | ||
/** | ||
* Begins a site collection scoped REST request | ||
@@ -55,0 +63,0 @@ * |
@@ -56,2 +56,3 @@ import { SharePointQueryableInstance } from "./sharepointqueryable"; | ||
export declare function SearchQueryBuilder(queryText?: string, _query?: {}): ISearchQueryBuilder; | ||
export declare type SearchQueryInit = string | SearchQuery | ISearchQueryBuilder; | ||
/** | ||
@@ -65,3 +66,3 @@ * Describes the search API | ||
*/ | ||
execute(query: SearchQuery): Promise<SearchResults>; | ||
execute(queryInit: SearchQueryInit): Promise<SearchResults>; | ||
/** | ||
@@ -73,2 +74,8 @@ * Fixes up properties that expect to consist of a "results" collection when needed | ||
private fixupProp(prop); | ||
/** | ||
* Translates one of the query initializers into a SearchQuery instance | ||
* | ||
* @param query | ||
*/ | ||
private parseQuery(query); | ||
} | ||
@@ -75,0 +82,0 @@ /** |
@@ -12,2 +12,3 @@ import { FetchOptions } from "@pnp/common"; | ||
export declare class SharePointQueryable<GetType = any> extends ODataQueryable<SPBatch, GetType> { | ||
protected _forceCaching: boolean; | ||
/** | ||
@@ -14,0 +15,0 @@ * Creates a new instance of the SharePointQueryable class |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5847669
43717