MARC Search Query API

As of Orchid, searching for instance records by searching on MARC values must be done through an API query, using a tool like Postman (Getting started with Postman) or writing your own search scripts.


To use the MARC Search Query API, POST your request to the source-storage/stream/marc-record-identifiers endpoint.

For example: https://folio-testing-okapi.dev.folio.org/source-storage/stream/marc-record-identifiers You must include the usual Okapi headers including your tenant and token.

Queries submitted to this endpoint will return the UUIDs for the instances related to the SRS MARC records that matched your search criteria.

Developer documentation: https://s3.amazonaws.com/foliodocs/api/mod-source-record-storage/p/source-record-storage-stream.html#source_storage_stream_marc_record_identifiers_post

Boolean limitation - while you can use and/or within the fields search or with the leader search, you cannot combine leader and field search.*

*as of Orchid-SP-6++ release, you CAN combine the search keys e.g.  

{
	"leaderSearchExpression": "p_06 = 'a'",
	"fieldsSearchExpression": "245.a ^= 'My Book'"
}

give me records with leader position 06 = a AND 245$a starts with My Book

Search data fields

To search data fields with a left anchored search, identify the tag, follow it with a dot, followed by the subfield. For instance to search the 260$a for 'Paris', use the expression:

{
"fieldsSearchExpression": "260.a ^= 'Paris'"
}

To search the 600$2 for 'fast' use:

{
"fieldsSearchExpression": "600.2 ^= 'fast'"
}

To search a field without subfield e.g. 001

{
"fieldsSearchExpression": "001.value = 'in01234567890'"

}

It IS case SenSiTIve!

The only 2 options are only exact match and left anchor search. There's no keyword searching. i.e. only use this for something you cannot search using normal mapped index

Search indicators

{
  "fieldsSearchExpression": "856.ind2 =  '0'"
}

You would probably want to search indicators along with a field like:
{
  "fieldsSearchExpression": "856.ind2 =  '0' and 856.u ^= 'https://www.ebsco'"
}

Search control fields by position

To search by position, identify the tag then follow a dot with the position number, then an underscore, followed by the number of positions you are searching.

To search the 005 for '2021' at beginning at position 0 use this expression:

{
"fieldsSearchExpression": "005.00_04 = '2021'"
}

To search the 008 field at position 06 for 's' use this expression:

{
"fieldsSearchExpression": "008.06_01 = 's'"
}


Search the leader

To search the leader, specify the position you wish to search. For example to search for 'a' in position 06 and 'm' in position 07, use the expression:

{
"leaderSearchExpression": "p_06 = 'a' and p_07 = 'm'"
}

marc record with 05 - Record status = 'd' Deleted

{
"leaderSearchExpression": "p_05 = 'd'
}


Check for the presence of a MARC tag

{

"fieldsSearchExpression": "346.value is 'present'"

}

{

"fieldsSearchExpression": "245.value is 'absent'"    

}

Search dates

* 005.date = '20141107' - only single date equality
* 005.date not= '20141107' - not equals
* 005.date from '20141106' - from the given date to now
* 005.date to '20141108' - to the beginning of time to the given date
* 005.date in '20141106-20141108' - the given date is in the date range

this probably only works with a "date field" (yyyymmddhhmmss.f) in MARC e.g. https://www.loc.gov/marc/bibliographic/bd005.html. Doesn't work with tag that happens to have yyyymmdd in a subfield e.g. https://www.loc.gov/marc/bibliographic/bd033.html

Operators

BOOLEAN_OPERATOR_AND("and"),

BOOLEAN_OPERATOR_OR("or"),

BINARY_OPERATOR_EQUALS("="),

BINARY_OPERATOR_NOT_EQUALS("not="),

BINARY_OPERATOR_LEFT_ANCHORED_EQUALS("^="),

BINARY_OPERATOR_FROM("from"),

BINARY_OPERATOR_TO("to"),

BINARY_OPERATOR_IN("in"),

BINARY_OPERATOR_IS("is");


Additional Examples

QueryDescription

{"fieldsSearchExpression": "856.u = 'http://proxy.library.cornell.edu/login?url='"}

We use this search to look for records where someone added the proxy but not the rest of the url

{"fieldsSearchExpression": "008.35_03 = 'bur' and 880.value is 'absent'"}

Burmese materials that do not have 880s
{
    "leaderSearchExpression": "(p_05 = 'a' and p_06 = 'b') or (p_07 = '1' and p_08 = '2')",
    "fieldsSearchExpression": "(035.a = '(OCoLC)63611770' and 036.ind1 = '1') or (245.a ^= 'Semantic web' and 005.value ^= '20141107')",
    "suppressFromDiscovery": false,
    "deleted": false,
    "offset": 0,
    "limit": 10
}
a little more complex example, notice we can paginate and etc.

Additional Notes

fieldsSearchExpression

  • there's NO whole tag search (must search for a specific tag/indicator) e.g. you CANNOT do
    • "fieldsSearchExpression": "245 = 'Gulp'"
    • "fieldsSearchExpression": "245.value ^= 'Gulp'" will returns you something but the count is different (a little bit higher) from "fieldsSearchExpression": "245.a ^= 'Gulp'"

      • not sure what it's actually doing
  • the = operator
    • means exact match e.g.
    • "245.a ^= 'Gulp'"
      • match
    • "245.a = 'Gulp'"
      • not match
    • "245.a = 'Gulp :'"
      •  match

technical stuff