equal
deleted
inserted
replaced
304 stream(results.map(read_block)) |
304 stream(results.map(read_block)) |
305 }, q = q) |
305 }, q = q) |
306 |
306 |
307 def update_theory(db: Solr.Database, theory_name: String, blocks: List[Block]): Unit = |
307 def update_theory(db: Solr.Database, theory_name: String, blocks: List[Block]): Unit = |
308 db.transaction { |
308 db.transaction { |
309 val delete = |
309 val domain = read_domain(db, Solr.filter(Fields.theory_facet, Solr.phrase(theory_name))) |
310 read_domain(db, Solr.filter(Fields.theory, Solr.phrase(theory_name))) -- blocks.map(_.id) |
310 val delete = domain -- blocks.map(_.id) |
311 |
311 |
312 if (delete.nonEmpty) db.execute_batch_delete(delete.toList) |
312 if (delete.nonEmpty) db.execute_batch_delete(delete.toList) |
313 |
313 |
314 db.execute_batch_insert( |
314 db.execute_batch_insert( |
315 for (block <- blocks) yield { (doc: Solr.Document) => |
315 for (block <- blocks) yield { (doc: Solr.Document) => |
350 blocks.toList |
350 blocks.toList |
351 } |
351 } |
352 |
352 |
353 def delete_session(db: Solr.Database, session_name: String): Unit = |
353 def delete_session(db: Solr.Database, session_name: String): Unit = |
354 db.transaction { |
354 db.transaction { |
355 val delete = read_domain(db, Solr.filter(Fields.session, Solr.phrase(session_name))) |
355 val delete = read_domain(db, Solr.filter(Fields.session_facet, Solr.phrase(session_name))) |
356 if (delete.nonEmpty) db.execute_batch_delete(delete.toList) |
356 if (delete.nonEmpty) db.execute_batch_delete(delete.toList) |
357 } |
357 } |
358 |
358 |
359 def query_stats(db: Solr.Database, q: Solr.Source, fq: List[Solr.Source]): Stats = |
359 def query_stats(db: Solr.Database, q: Solr.Source, fq: List[Solr.Source]): Stats = |
360 db.execute_stats_query( |
360 db.execute_stats_query( |