def testFastSearch()

in app/controllers/FileListController.scala [311:341]


  def testFastSearch(vaultId:String, field:String, value:String, quoted:Boolean) = IsAuthenticated { uid=> request=>
    withVault(vaultId) { userInfo =>
      val graph = GraphDSL.create() { implicit builder =>
        import akka.stream.scaladsl.GraphDSL.Implicits._

        val searchString = ContentSearchBuilder(s"$field:$value")
          .withKeywords(GnmMetadata.Fields)
          .withKeywords(PresentableFile.MXFSFields)
          .build

        logger.debug(s"vault is $vaultId, field '$field', value '$value', quoted '$quoted'.  Search term is $searchString")
        val src = builder.add(new OMFastContentSearchSource(userInfo, searchString))
        val outlet = src.out
          .map(entry=>{
            logger.info(s"Got entry ${entry.oid} with attributes ${entry.attributes.map(_.stringValues)}")
            entry
          })
          .map(PresentableFile.fromObjectMatrixEntry)
          .map(_.asJson.noSpaces)
          .map(jsonString => ByteString(jsonString + "\n"))
          .outlet

        SourceShape(outlet)
      }

      Result(
        ResponseHeader(200, Map()),
        HttpEntity.Streamed(Source.fromGraph(graph), None, Some("application/x-ndjson"))
      )
    }
  }