Updating document quality

Blog

Updating document quality

  • 28 June, 2023
  • By admin
  • No Comments
blog-image

A little-used MarkLogic feature (from what I’ve seen) is the ability to change a document’s quality. Lowering this value will make it drop in search results, while increasing it will make it more prominent. For one client, we’re allowing subject matter experts to lower the quality of documents that aren’t very helpful. They get a button that is hidden from regular users. Clicking the button sends a request to the middle tier, which in turn uses MarkLogic’s REST API to change the quality of the target document. This can be accomplished with a PUT request to /v1/documents. There was only one thing that threw us off for a moment: we thought we could handle this through the URL parameters, but with no message body, we got a 400 error. Here’s what to do instead, presented as a curl command:

curl --location 
  --request PUT \
  'http://localhost:8010/v1/documents?uri=/content/1234.json&category=quality' \
  --header 'Content-Type: application/json' \
  --data-raw '{ "quality": 10 }'
I’m leaving authentication as an exercise for the reader, but this shows specifying the needed information in the body. Hope that helps someone!

quote
A little-used MarkLogic feature (from what I’ve seen) is the ability to change a document’s quality. Lowering this value will...

Admin

Chief Executive Officer

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
cta-bg

Looking Forward to Expanding Our Horizon!

Let us know how we can help your organization