- Timestamp:
- 2020-01-30T22:54:39+13:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/maori-lang-detection/src/org/greenstone/atea/MongoDBAccess.java
r33881 r33882 96 96 public static final int CONTAINS_MRI = 1; 97 97 98 /** Some reused fieldnames in the Websites collection */ 99 private static final String FILTER_NUMPAGES_IN_MRI = "numPagesInMRI"; 100 private static final String FILTER_NUMPAGES_CONTAINING_MRI = "numPagesContainingMRI"; 101 98 102 // configuration details, some with fallback values 99 103 private String HOST = "localhost"; … … 402 406 ]); 403 407 */ 404 public void aggregateContainsMRIForNZ(Writer writer ) throws IOException {408 public void aggregateContainsMRIForNZ(Writer writer, int filterType) throws IOException { 405 409 // working with the WebSites collection, not WebPages collection! 406 410 MongoCollection<Document> collection = this.database.getCollection(WEBSITES_COLLECTION); 407 411 408 409 //String isMRI_filter = 412 String mriFilterString = (filterType == CONTAINS_MRI) ? "{numPagesContainingMRI: {$gt: 0}}" : "{numPagesInMRI: {$gt: 0}}"; 410 413 411 414 Bson orQuery = or( … … 414 417 ); 415 418 Bson andQuery = and( 416 BasicDBObject.parse( "{numPagesContainingMRI: {$gt: 0}}"),419 BasicDBObject.parse(mriFilterString), 417 420 orQuery); 418 421 … … 456 459 ]); 457 460 */ 458 public void aggregateContainsMRIForOverseas(Writer writer) throws UncheckedIOException { 461 public void aggregateContainsMRIForOverseas(Writer writer, int filterType, 462 boolean isMiInURLPath) throws UncheckedIOException 463 { 459 464 // working with the WebSites collection, not WebPages collection! 460 465 MongoCollection<Document> collection = this.database.getCollection(WEBSITES_COLLECTION); 461 466 467 String mriFilterString = (filterType == CONTAINS_MRI) ? "{numPagesContainingMRI: {$gt: 0}}" : "{numPagesInMRI: {$gt: 0}}"; 462 468 463 469 Bson orQuery = or( 464 470 BasicDBObject.parse("{geoLocationCountryCode: \"AU\"}"), 465 BasicDBObject.parse("{urlContainsLangCodeInPath: false}") 471 BasicDBObject.parse("{urlContainsLangCodeInPath: "+ isMiInURLPath +"}") 472 // e.g. "{urlContainsLangCodeInPath: false}" 466 473 ); 467 474 Bson andQuery = and( 468 475 BasicDBObject.parse("{geoLocationCountryCode: {$ne: \"NZ\"}}"), 469 476 BasicDBObject.parse("{domain: {$not: /\\.nz/}}"), 470 BasicDBObject.parse( "{numPagesContainingMRI: {$gt: 0}}"),477 BasicDBObject.parse(mriFilterString), 471 478 orQuery); 472 479
Note:
See TracChangeset
for help on using the changeset viewer.