unioslo/nivlheim

Extend the search API to enable chaining multiple queries

Closed this issue · 0 comments

Proposed changes to the search API method:

  1. Allow multiple query- and filename-parameters, on the format q1, f1, q2, f2 and so on. (File names are optional.) The searches will be performed one after another. Each search internally produces a list of files as the result.
  2. After each additional search, starting from number 2 and upwards, the result will be combined with the previous result using an operation given by a parameter op2, op3 and so on.
    Supported operations will be:
  • and (intersection)
  • or (union)
  • subtract (difference)
  1. Often the user wants a list of hosts, not files. Unless the fields parameter contains file-specific fields such as fileID, filename, or content, it can be assumed that only unique hosts should be returned. No need to return a list of ipAddress or hostname with duplicate values, for example.
  2. Consider adding a count parameter like hostlist has. Let's say someone searches with just fields=os and wants to see unique results.
  3. This could be a separate issue: Consider adding support for a new pseudo-field lines, which for each file in the result list should contain an array of the lines in that matched (full text). Sort of like grep does.