Skip to content

Commit

Permalink
Added a guide entry for the new api call/renamed the call itself #3437
Browse files Browse the repository at this point in the history
  • Loading branch information
landreev committed Jan 9, 2024
1 parent 7c92067 commit 37b9a8c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
14 changes: 12 additions & 2 deletions doc/sphinx-guides/source/admin/solr-search-index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ Remove all Solr documents that are orphaned (i.e. not associated with objects in

``curl http://localhost:8080/api/admin/index/clear-orphans``

Clearing Data from Solr
~~~~~~~~~~~~~~~~~~~~~~~
Clearing ALL Data from Solr
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Please note that the moment you issue this command, it will appear to end users looking at the root Dataverse installation page that all data is gone! This is because the root Dataverse installation page is powered by the search index.

Expand Down Expand Up @@ -86,6 +86,16 @@ To re-index a dataset by its database ID:

``curl http://localhost:8080/api/admin/index/datasets/7504557``

Clearing a Dataset from Solr
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This API will clear the Solr entry for the dataset specified. It can be useful if you have reasons to stop showing a published dataset in search results and/or on Collection pages, but don't want to destroy and purge it from the database just yet.

``curl -X DELETE http://localhost:8080/api/admin/index/datasets/<DATABASE_ID>``

This can be reversed of course by re-indexing the dataset with the API above.


Manually Querying Solr
----------------------

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/edu/harvard/iq/dataverse/api/Index.java
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ public Response indexDatasetByPersistentId(@QueryParam("persistentId") String pe
* clear the entry from Solr regardless.
*/
@DELETE
@Path("datasets/{id}/clear")
@Path("datasets/{id}")
public Response clearDatasetFromIndex(@PathParam("id") Long id) {
Dataset dataset = datasetService.find(id);
// We'll attempt to delete the Solr document regardless of whether the
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/edu/harvard/iq/dataverse/api/UtilIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -1496,7 +1496,7 @@ static Response reindexDataset(String persistentId) {

static Response indexClearDataset(Integer datasetId) {
return given()
.delete("/api/admin/index/datasets/"+datasetId+"/clear");
.delete("/api/admin/index/datasets/"+datasetId);
}

static Response reindexDataverse(String dvId) {
Expand Down

0 comments on commit 37b9a8c

Please sign in to comment.