Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Parameters:
  • tenant – User tenant.
  • project_id – Project identifier.
  • item_id – Item identifier.
Headers:See Common Headers.
Status Codes:
  • 204 – Item deleted.

See also Common Status Codes.

Recommend similar items

GET/POST https://squirro-endpoint/api/topic/v0/(string: tenant)/projects/(id: project_id)/items/recommend

Returns a recommendation of similar items from the project given an item id or text.


Parameters:
  • tenant – User tenant.
  • project_id – Project identifier.
JSON Data:

Data is passed in as a JSON object.

Valid object keys:

  • item_id – ID of item used for recommendation (optional).
  • external_id – External ID of item used for recommendation if item_id is not provided (optional)
  • text – Text content used for recommendation if neither item_id nor external_id are not provided (optional)
  • method – Recommendation method (optional).
    • These values are supported:
      • smartfilter: Use squirro Smart Filter method (default)
      • mlt: Use "More like this" of elasticsearch
      • tfidf: Use first 100 words of document to find similar documents based on tfidf score.
    method_params – Dictionary of method parameters used for recommendations (optional)
      • .
  • related_fields – Fields used to find relationship for between items for recommendation. If this parameter is not set we use the text in title, body and abstract  of item
  • count – Maximum number of items to return.
  • fields – Fields to return.
  • options

    Dictionary of options that influence the result-set. Valid options are:

    • fold_near_duplicates to fold near-duplicates together and filter them out of the result-stream. Defaults to False.
  • created_before – Restrict result set to items created before created_before.
  • created_after – Restrict result set to items created after created_after.
  • query – Search query to restrict the recommendation set.
  • aggregations – Aggregation of faceted fields
Headers:See Common Headers.
Status Codes:
  • 200 – Results returned.

See also Common Status Codes.

Returns:

Results.

Response fields:

  • items – List of items.
  • now – Timestamp for the event of response generation.
  • count – The number of items returned with this result set.
  • total – Total number of items in recommendation result
  • method Method used for recommendation
  • master_itemOriginal item used to get recommendation
  • time_ms – Time of execution main component of recommendation in millisecond.


{
  "count": 2,
  "total": 5,
  "items": [
    {
      "title": "How Do I Get a Mortgage?",
      "read": false,
      "created_at": "2017-04-26T19:02:17",
      "related_items": [
         
      ],
      "score": 37.719635,
      "external_id": "5900eebc95d0e024b586d7d8",
      "id": "CPIalbwkobYkwjwzzkWcGw"
    },
    {
      "title": "How Do I Get a Good Interest Rate?",
      "read": false,
      "created_at": "2017-04-26T19:04:01",
      "related_items": [
         
      ],
      "score": 26.451519,
      "external_id": "5900ef2a95d0e024b586d7dc",
      "id": "YiBhdq04vzu9nSkDK05GAw"
    },
 
  ],
  "master_item": {
    "title": "What Kind of Mortgage Should I Get?",
    "read": true,
    "created_at": "2017-04-26T19:03:03",
    "related_items": [
       
    ],
    "score": null,
    "external_id": "5900eeea95d0e024b586d7d9",
    "id": "nul6nurQKGOJIdphYRYAjg"
  },
  "time_ms": {
    "query": 31,
    "master_item": 268
  },
  "now": "2017-11-07T09:04:49.699453",
  "method": "mlt"
}



Recommendation methods

GET https://squirro-endpoint/api/topic/v0/(string: tenant)/projects/(id: project_id)/items/recommend/methods

Returns the supported recommendation methods for items from the project.


Parameters:
  • tenant – User tenant.
  • project_id – Project identifier.
Headers:See Common Headers.
Status Codes:
  • 200 – Methods returned.

See also Common Status Codes.

Returns:

Method names.

Response fields:

  • methods – List of method names.
  • default – The default that would be chosen for this project.


{
    "methods": ["smartfilter", "mlt", "tfidf"],
    "default": "smartfilter"



...