Skip to content

Commit e1166e4

Browse files
committed
feat: implemented delete function for deleting document by id or query
1 parent 752c1cc commit e1166e4

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/index.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,4 +378,9 @@ declare global {
378378
core?: string
379379
apiPrefix: string
380380
}
381+
382+
interface DeleteQuery {
383+
id?: string
384+
query?: any
385+
}
381386
}

src/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,11 @@ const prepareSolrClient = config => {
7171
* @param {SolrDocument | SolrDocument[]} data */
7272
add: data => solrPost(config)("update")(ensureArray(data)),
7373

74-
/**
75-
* @type {(data:FieldProperties) => Promise<SolrResponse>}
76-
* @see https://lucene.apache.org/solr/guide/7_5/schema-api.html#add-a-new-field
77-
*/
74+
/** @param {DeleteQuery} deleteQuery */
75+
delete: deleteQuery =>
76+
solrPost({ ...config, apiPrefix: "solr" })("update")({
77+
delete: deleteQuery
78+
}),
7879
addField: solrSchema(config)("add-field"),
7980

8081
/**

0 commit comments

Comments
 (0)