IndexHash+7 tries to access ^rINDEXCLASS global from CACHESYS database.

As the user does not have R (or possibly W, but probably R) privilege on %DB_CACHESYS  resource the <PROTECT> event is raised.

To solve this you need either:

On Windows execute:

<iris>\bin\irisdb -s <iris>\mgr

where <iris> is a root of an InterSystems IRIS installation.

Great answer, but I'd like to add that there are two distinct cases for working with XDatas:

  1. Where XData itself is an object of work (for example generating a part of WSDL spec and saving it in a class XData).
  2. Where XData is just a container for miscellaneous data (for example a template with placeholders).

The code above works for the first case, but for the second case it might be preferable to create an independent copy of an XData stream so that no locking happens - this prevents XData object access/modification errors, especially in Dev environments. Furthermore objectless way of getting XData contents would be faster.

I usually use this method to get streams if my XData work falls into the second category:

ClassMethod getClassXData(className, xdataName) As %Stream.Object
    set stream = ##class(%Stream.TmpCharacter).%New()
    for i=1:1:$$$comMemberKeyGet(className,$$$cCLASSxdata,xdataName,$$$cXDATAdata) {
        do stream.WriteLine($$$comMemberArrayGet(className,$$$cCLASSxdata,xdataName,$$$cXDATAdata,i))
    quit stream

This code can be further improved for most use cases by replacing a stream with a string.

Went with:

    SUM($LENGTH(%iFind.Highlight(Text, :name), '<b>')-1)
WHERE %ID %FIND search_index("TextIndex",:name)

Assumes plaintext.

If you don't know how to get any part of request/response/session the easiest way is to send your request and execute this code on your server:

set %response.ContentType = "html"
do ##class(%CSP.Utils).DisplayAllObjects()
quit $$$OK

It would output HTML page containing all required information.

I think %request.Get(name) is what you need.

Cubes rely heavily on bitmap indexes for them to run fast.

Primarily each fact in fact table must be accessible via bitmap index.

In the past Bitmap indices worked only with positive integers, but now there seems to be a %BID approach - a surrogate key essentially.

I think InterSystems BI should throw an error or generate a %BID or offer to generate a %BID if the fact class id is not a positive integer