xAPI-Spec icon indicating copy to clipboard operation
xAPI-Spec copied to clipboard

Searching statements for keywords

Open Archieversace opened this issue 12 years ago • 7 comments

Case:

The user wants to search their statements for some key words and view the results. For example say they wanted to view all their statements on a particular subject such as "Cars".

How this would be done currently:

At the moment the API does not support this kind of request directly.

To do this would require some middle-ware that would need to pull back all of the users statements, parse them and then search through them for the supplied terms, returning only those that met the condition. This could get very inefficient if the user has lots of statements.

Possible solution:

What would be really useful is a 'search_text' or keyword property on the statement object that can be populated with the text that should be searchable for the statement. For example if it is an 'Activity' then the search text could include the activity description. The GET statement API would also provide a 'search_text' property to enable searching.

Archieversace avatar Apr 04 '13 11:04 Archieversace

Thanks for the input! Right now the preferred way to indicate and filter on topics statements are related to is to use contextActivities (in context), probably with the (new in 1.0) category key, which would support your described use case (using topical URIs; if you really mean keywords, data URIs might be appropriate). I don't think we're likely to support any sort of full-text or substring search as part of the standard, at least for now, though I expect some experimentation in that direction among LRS providers (I'm CTO of Saltbox, one of those providers).

fugu13 avatar Apr 04 '13 16:04 fugu13

What about using a "keyWords" extension in the context to be an array of strings each containing a key word?

fugu13 [email protected] wrote:

Thanks for the input! Right now the preferred way to indicate and filter on topics statements are related to is to use contextActivities (in context), probably with the (new in 1.0) category key, which would support your described use case (using topical URIs; if you really mean keywords, data URIs might be appropriate). I don't think we're likely to support any sort of full-text or substring search as part of the standard, at least for now, though I expect some experimentation in that direction among LRS providers (I'm CTO of Saltbox, one of those providers).

— Reply to this email directly or view it on GitHub.

garemoko avatar Apr 04 '13 17:04 garemoko

You can already get that effect with the data URI approach

Example context:

{
  "contextActivities": {
    "category": [
      {"id": "data:itmightbebunnies"},
      {"id": "data:hoppylegs"},
      {"id": "data:twitchylittlenoses"},
      {"id": "data:whatswithallthecarrots"}
    ]
  }
}

fugu13 avatar Apr 04 '13 17:04 fugu13

Can we close this issue?

Do we agree that no change to the spec is required.

garemoko avatar Apr 11 '13 07:04 garemoko

@garemoko I'd say so. I was going to say we should leave this open but mark it as "discuss further after 1.0 has been out for a while" -- What @fugu13 came up with is a rather nice workaround, but it is a workaround.

But we're really going to want to discuss the more general issue for which this is just one example: what is it that people want to do with the ability to GET statements that they currently can't, and is it appropriate to extend the xAPI spec to support those cases?

We should probably leave one issue open, labeled "post 1.0" to address that general question, and note this particular use case in that issue.

bscSCORM avatar Apr 11 '13 14:04 bscSCORM

Searching context would only work if the statement had a context. Context is optional so there could be many statements without a context that would not show up in the search results.

I need to be able to do this on our LRS now, so I have implemented a custom 'search_text' property on the statement API for GET requests. I have not got very far with it yet but here is my current thinking on how to use the search_text:

  • On verbs it will search the display property
  • On objects it depends on the type.
    • For an object of type Activity object it will perform a text search on the activity definition description & name.

A bit more thinking needed on if/or how the other object types and properties of the statement are searched.

I will report back on how it goes.

Archieversace avatar Apr 11 '13 19:04 Archieversace

@Archieversace just poking you because you said you'd report back :-)

How have you got on?

garemoko avatar May 17 '13 21:05 garemoko