From 230545f8a9e75e488bb85cc924b88860982ec193 Mon Sep 17 00:00:00 2001 From: ngoura Date: Thu, 15 Jun 2017 17:22:31 +0200 Subject: [PATCH] add reglage for crawl --- .eslintrc.json | 4 +- .meteor/packages | 1 + .meteor/versions | 2 + .~lock.Description.docx# | 1 + Description.docx | Bin 0 -> 13140 bytes imports/api/account/methods.js | 13 ++++- imports/api/config/methods.js | 34 ++++++++++++ imports/api/crawl/crawlWebsite.js | 3 +- imports/api/indexation/elasticSearchConfig.js | 16 +++++- imports/api/indexation/indexGeneric.js | 2 + imports/api/indexation/indexWebsite.js | 51 ++++++++++++++---- imports/api/testSearch/methods.js | 26 +++++++-- imports/collections/configCollection.js | 29 ++++++++++ imports/collections/testSearchCollection.js | 2 +- imports/startup/server/register-api.js | 1 + .../ui/components/testSearch/testSearch.html | 3 ++ .../ui/components/testSearch/testSearch.js | 5 ++ imports/ui/pages/admin/account/add/add.js | 1 + .../ui/pages/admin/indexation/api/api.html | 2 +- .../ui/pages/admin/indexation/main/main.html | 2 +- .../ui/pages/admin/indexation/site/site.html | 21 +++++++- .../ui/pages/admin/indexation/site/site.js | 41 ++++++++++++++ imports/ui/pages/login/login.js | 7 +++ package.json | 2 +- yarn.lock | 15 ++---- 25 files changed, 249 insertions(+), 35 deletions(-) create mode 100644 .~lock.Description.docx# create mode 100644 Description.docx create mode 100644 imports/api/config/methods.js create mode 100644 imports/collections/configCollection.js diff --git a/.eslintrc.json b/.eslintrc.json index 50e65be..ab25d3a 100755 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -32,6 +32,8 @@ "import/extensions": ["off", "never"], "import/no-extraneous-dependencies": "off", "no-underscore-dangle": "off", - "class-methods-use-this": "off" + "class-methods-use-this": "off", + "no-param-reassign": "off", + "meteor/no-session": "off" } } diff --git a/.meteor/packages b/.meteor/packages index 39ab7d0..8ec6f40 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -45,3 +45,4 @@ practicalmeteor:chai deanius:promise dynamic-import aldeed:tabular +ajduke:bootstrap-tagsinput diff --git a/.meteor/versions b/.meteor/versions index e4c551e..30e26b4 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -1,5 +1,6 @@ accounts-base@1.3.0 accounts-password@1.3.6 +ajduke:bootstrap-tagsinput@0.7.1 alanning:roles@1.2.16 aldeed:autoform@6.2.0 aldeed:collection2-core@2.0.1 @@ -99,6 +100,7 @@ templating-tools@1.1.2 tmeasday:check-npm-versions@0.3.1 tmeasday:test-reporter-helpers@0.2.1 tracker@1.1.3 +twbs:bootstrap@3.3.6 ui@1.0.13 underscore@1.0.10 url@1.1.0 diff --git a/.~lock.Description.docx# b/.~lock.Description.docx# new file mode 100644 index 0000000..077daab --- /dev/null +++ b/.~lock.Description.docx# @@ -0,0 +1 @@ +,ngoura,ngoura,15.06.2017 09:13,file:///home/ngoura/.config/libreoffice/4; \ No newline at end of file diff --git a/Description.docx b/Description.docx new file mode 100644 index 0000000000000000000000000000000000000000..002aba3f860b5b937071a49a0ea7fd043f8a557a GIT binary patch literal 13140 zcma)j1ymi$)-LYu?(XgyJh(dq65QQAIKkar1Hs+xAi>?;-67ZyGxz?Jnf2bhx6kTc z)m8QFuCsU7F6ploq(Q;ZfS{nDfS7bgKLY(Guy1L7dm~E+Muzuu`DE8eP-Y~Eb&o8= z6c3krRnadsZ6V`nl3u>iKTjdjWF!l<)>ai@nibT#2v{HX_DJ(r@SfY3@hX zmS$Zy8vk`hbn0QUA2ZUW94*bj0|PGYoSFYQ9d$)V`3r*P{OhG?(NDaC+thrs&84fZ z!Cd~Ru~f0}xU2;)UzDG)hrbITzEWa{h=T2`Y(p6TKDb zVr-&z7W~@0D=<Pag_kAz_o8Lg2hJX43|nxAzOlTT8{;-}*-ugc(~nDx~mF>GOv)4LZd&@gsE* zdfQZRf^pnV$Z1MIf50Cj%=-b0P@bEIFY};u#0lu2i?p6V@eK)12}Gn|G&sWxWR7s3 z0Ig_0Y$a2e2dfO#`PGC1H=AslP1k_tV*R>2ci+wod`QNivS)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3B(G*JFh{JzLLSX zsMla8Dob%;*;p~gaFC}(Mo%%nQcW*a4R-M|)fSj-(wY0A$5pIO$P36(l?kRecN;l*ov{Hy3L;0jOJs zESAN}emn{Ex?Ef5h-b2gFH(5%tzP+ntaoQH_`09Vyg6g)jm)JW4Ge+?^w;+TzZ2)* zzaRL!{Ps1$KY_oKzTbKEe+lv1t^SQ=|4&W76O`Zk_Ft0u76<;&^gCtzpYY#lYVR!O zzl86NkNyYzpPc4@s`&j4!#khtFL8qTZwvmH-S$uL?`w>|H~$&yKj7bAN&FN3`;_c` zA@Y}Sk^cw&w`Ivc@xM05HwFJ08vlv@Jy87JdV6%gp+Em8%>NVq`=kB$)>kq7A7hJxH2B+m3J3`9?FaN0 KoCKKOul@%l)WTN) literal 0 HcmV?d00001 diff --git a/imports/api/account/methods.js b/imports/api/account/methods.js index 1c05cb9..f57e176 100644 --- a/imports/api/account/methods.js +++ b/imports/api/account/methods.js @@ -1,16 +1,27 @@ +import SimpleSchema from 'simpl-schema'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; import { Accounts } from 'meteor/accounts-base'; Meteor.methods({ + // add account addAccount(user) { - check(user, Object); + // validate user data + new SimpleSchema({ + email: { + type: String, + regEx: SimpleSchema.RegEx.Email, + }, + username: String, + password: String, + }).validate(user); const id = Accounts.createUser(user); if (!id) { throw new Meteor.Error('Error', 'Impossible de se connecter'); } }, + // delete account deleteAccount(id) { check(id, String); Meteor.users.remove({ _id: id }); diff --git a/imports/api/config/methods.js b/imports/api/config/methods.js new file mode 100644 index 0000000..7bed494 --- /dev/null +++ b/imports/api/config/methods.js @@ -0,0 +1,34 @@ + +import { check } from 'meteor/check'; +import { Meteor } from 'meteor/meteor'; +import configCollection from '../../collections/configCollection'; + +Meteor.methods({ + // define config + defineConfig(config) { + check(config, Object); + const oldConfig = configCollection.find({ userId: Meteor.userId() }).fetch(); + if (config.forbiddenWord) { + config.forbiddenWord = config.forbiddenWord.split(','); + } + if (config.domain) { + config.domain = config.domain.replace('https', 'http'); + } + // if config already exist, replace old value with new + if (oldConfig && oldConfig.length) { + configCollection.update(oldConfig[0]._id, { + $set: { + domain: config.domain || oldConfig.domain, + forbiddenWord: config.forbiddenWord || oldConfig.forbiddenWord, + }, + }); + } else { + // else insert + config.userId = Meteor.userId(); + configCollection.insert(config); + } + }, + getConfig() { + return configCollection.findOne({ userId: Meteor.userId() }); + }, +}); diff --git a/imports/api/crawl/crawlWebsite.js b/imports/api/crawl/crawlWebsite.js index 8ecc103..71611a5 100644 --- a/imports/api/crawl/crawlWebsite.js +++ b/imports/api/crawl/crawlWebsite.js @@ -10,11 +10,12 @@ export default class crawlWebsite { constructor(url) { this.urls = []; this.crawler = new Crawler(url); + let i = 0; this.crawler.on('fetchcomplete', (queueItem) => { const url = queueItem.url; + console.log(i++); if (checkData.checkURL(url)) { - console.log(url); this.urls.push(url); } }); diff --git a/imports/api/indexation/elasticSearchConfig.js b/imports/api/indexation/elasticSearchConfig.js index e6ee921..e454992 100644 --- a/imports/api/indexation/elasticSearchConfig.js +++ b/imports/api/indexation/elasticSearchConfig.js @@ -29,6 +29,7 @@ exports.analyser = { expand: true, synonyms: [ 'gosse, enfant', + 'pmi, protection maternelle et infantile', ], }, french_stemmer: { @@ -55,6 +56,9 @@ exports.analyser = { 'lowercase', ], }, + url_analyzer: { + tokenizer: 'uax_url_email', + }, }, }, }, @@ -107,7 +111,17 @@ exports.mapping = { }, url: { type: 'text', - analyzer: 'standard', + analyzer: 'url_analyzer', + }, + urlText: { + type: 'text', + analyzer: 'french_light', + fields: { + stemmed: { + type: 'text', + analyzer: 'french_heavy', + }, + }, }, h1: { type: 'text', diff --git a/imports/api/indexation/indexGeneric.js b/imports/api/indexation/indexGeneric.js index bfd69e3..227662e 100755 --- a/imports/api/indexation/indexGeneric.js +++ b/imports/api/indexation/indexGeneric.js @@ -64,6 +64,8 @@ export default class IndexGeneric { 'description.stemmed', 'body', 'body.stemmed', + 'urlText', + 'urlText.stemmed', 'url', ], }, diff --git a/imports/api/indexation/indexWebsite.js b/imports/api/indexation/indexWebsite.js index 036780b..7ff7b2c 100755 --- a/imports/api/indexation/indexWebsite.js +++ b/imports/api/indexation/indexWebsite.js @@ -1,4 +1,5 @@ +import url from 'url'; import { Meteor } from 'meteor/meteor'; import Sitemapper from 'sitemapper'; import Crawler from 'crawler'; @@ -12,23 +13,28 @@ export default class IndexWebsite extends IndexGeneric { /** * realize indexation - * @param url + * @param urlWebsite * @returns Promise */ - async initIndexation(url) { - const crawl = new CrawlWebsite(url); + async initIndexation(urlWebsite) { + this.config = { + domain: url.parse(urlWebsite).hostname, + forbiddenWord: [], + }; + this.config = await Meteor.call('getConfig', {}); - /* let urls = [url]; + console.log(this.config); + let urls = [urlWebsite]; // si c'est un sitemap on récupère ces url - if (checkData.isSitemap(url)) { - const { sites } = await sitemap.fetch(url); + if (checkData.isSitemap(urlWebsite)) { + const { sites } = await sitemap.fetch(urlWebsite); urls = sites; } return this.crawlUrl(_.uniq(urls)) .then(dataToIndex => this.indexByBulk(dataToIndex)) .catch((error) => { throw error; - });*/ + }); } /** @@ -44,18 +50,39 @@ export default class IndexWebsite extends IndexGeneric { this.listDataError = []; this.listDataForIndex = []; + this.listUrlAlreadyVisited = urls; + this.listPdf = []; console.log(`${urls.length} à parser!`); const crawl = new Crawler({ + skipDuplicates: true, callback: (error, res, done) => { if (error || res.statusCode !== 200) { this.listDataError.push({ url: res.options.uri, error: error || res.statusCode, }); - } else { + } else if (res && res.$) { + res.$('a').each((index, a) => { + const urlHref = res.$(a).attr('href'); + if (urlHref) { + const toQueueUrl = url.resolve(res.request.uri.href, res.$(a).attr('href')); + if (toQueueUrl.includes(this.config.domain) && !this.listUrlAlreadyVisited.includes(toQueueUrl)) { + if (!new RegExp(this.config.forbiddenWord.join('|')).test(toQueueUrl)) { + this.listUrlAlreadyVisited.push(toQueueUrl); + console.log(toQueueUrl); + crawl.queue(toQueueUrl); + } + } + } + }); this.parseData(res.$, res.options.uri); + } else { + if (!this.listUrlAlreadyVisited.includes(res.options.uri)) { + this.listUrlAlreadyVisited.push(res.options.uri); + this.listPdf.push(res.options.uri); + } } done(); @@ -65,6 +92,7 @@ export default class IndexWebsite extends IndexGeneric { crawl.queue(urls); crawl.on('drain', () => { console.error(this.listDataError); + console.log(this.listPdf); resolve(this.listDataForIndex); }); }); @@ -75,7 +103,7 @@ export default class IndexWebsite extends IndexGeneric { * @param $ * @param url */ - parseData($, url) { + parseData($, currentUrl) { const body = $('body'); body.html(checkData.cleanHtml(body.html())); const title = checkData.cleanText($('title').text()); @@ -88,7 +116,8 @@ export default class IndexWebsite extends IndexGeneric { description: $('meta[name=description]').attr('content'), body: checkData.slugText(checkData.cleanText(body.text())), html: checkData.cleanText(body.html()), - url: decodeURI(url), + urlText: checkData.slugText(checkData.cleanText(decodeURI(currentUrl))), + url: decodeURI(currentUrl), createdAt: new Date(), }; @@ -108,7 +137,7 @@ export default class IndexWebsite extends IndexGeneric { index: { _index: Meteor.settings.private.elasticsearch.esIndex, _type: Meteor.settings.private.elasticsearch.esType, - _id: url, + _id: currentUrl, }, }); diff --git a/imports/api/testSearch/methods.js b/imports/api/testSearch/methods.js index 5412f10..b54a000 100644 --- a/imports/api/testSearch/methods.js +++ b/imports/api/testSearch/methods.js @@ -1,13 +1,24 @@ -import { check } from 'meteor/check'; +import SimpleSchema from 'simpl-schema'; import { Meteor } from 'meteor/meteor'; import _ from 'lodash'; import testSearchCollection from '../../collections/testSearchCollection'; Meteor.methods({ addTest(test) { - check(test, Object); + // test data + new SimpleSchema({ + urlExpected: { + type: String, + regEx: SimpleSchema.RegEx.Url, + }, + term: String, + }).validate(test); + + // replace https by http test.urlExpected = _.replace(test.urlExpected, 'https', 'http'); + + // call search Meteor.call('searchByTerm', test.term, Meteor.bindEnvironment((err, results) => { if (err) { console.log(err); @@ -18,7 +29,16 @@ Meteor.methods({ test.urlPosition = index + 1; } }); - testSearchCollection.insert(test); + const oldTest = testSearchCollection.find({ term: test.term }).fetch(); + if (oldTest && oldTest.length) { + testSearchCollection.update(oldTest[0]._id, { + $set: { + urlPosition: test.urlPosition, + }, + }); + } else { + testSearchCollection.insert(test); + } } })); }, diff --git a/imports/collections/configCollection.js b/imports/collections/configCollection.js new file mode 100644 index 0000000..f18dd42 --- /dev/null +++ b/imports/collections/configCollection.js @@ -0,0 +1,29 @@ + +import SimpleSchema from 'simpl-schema'; +import { Mongo } from 'meteor/mongo'; + +/** + * this collection is for config (crawl, api, index) + * @type {Mongo.Collection} + */ +const configCollection = new Mongo.Collection('configs'); + +SimpleSchema.configCollection = new SimpleSchema({ + userId: { + type: String, + }, + domain: { + type: String, + regEx: SimpleSchema.RegEx.Url, + }, + forbiddenWord: { + type: Array, + }, + 'forbiddenWord.$': { + type: String, + }, +}); + +configCollection.attachSchema(SimpleSchema.configCollection); + +export default configCollection; diff --git a/imports/collections/testSearchCollection.js b/imports/collections/testSearchCollection.js index 24dcfa5..16fa7c9 100644 --- a/imports/collections/testSearchCollection.js +++ b/imports/collections/testSearchCollection.js @@ -3,7 +3,7 @@ import SimpleSchema from 'simpl-schema'; import { Mongo } from 'meteor/mongo'; /** - * this local collection keep tracks of all tabs of this application + * this collection is temporaire for testsearch * @type {Mongo.Collection} */ const testSearchCollection = new Mongo.Collection('testSearch'); diff --git a/imports/startup/server/register-api.js b/imports/startup/server/register-api.js index 85ff9d1..7de03c3 100755 --- a/imports/startup/server/register-api.js +++ b/imports/startup/server/register-api.js @@ -2,6 +2,7 @@ import '../../api/indexation/methods'; import '../../api/account/methods'; +import '../../api/config/methods'; import '../../api/testSearch/methods'; import '../../tabular/tabularUser'; import '../../tabular/tabularTestSearch'; diff --git a/imports/ui/components/testSearch/testSearch.html b/imports/ui/components/testSearch/testSearch.html index 844fbf9..542eaa4 100644 --- a/imports/ui/components/testSearch/testSearch.html +++ b/imports/ui/components/testSearch/testSearch.html @@ -17,6 +17,9 @@
{{> tabular table=TabularTables.testSearch class="table table-striped table-bordered table-condensed text-center"}}
+ diff --git a/imports/ui/components/testSearch/testSearch.js b/imports/ui/components/testSearch/testSearch.js index 15f5497..5b73345 100644 --- a/imports/ui/components/testSearch/testSearch.js +++ b/imports/ui/components/testSearch/testSearch.js @@ -20,6 +20,11 @@ Template.testSearchTpl.events({ console.log(error); }); }, + 'click .launch-test': (event) => { + event.preventDefault(); + + + }, }); Template.testSearchActionTable.events({ diff --git a/imports/ui/pages/admin/account/add/add.js b/imports/ui/pages/admin/account/add/add.js index 2933fb2..fee6cc2 100644 --- a/imports/ui/pages/admin/account/add/add.js +++ b/imports/ui/pages/admin/account/add/add.js @@ -6,6 +6,7 @@ import displayNotif from '../../../../components/notifs/notifs'; import './add.html'; Template.addAccountTpl.events({ + // add account 'submit form': (event) => { event.preventDefault(); diff --git a/imports/ui/pages/admin/indexation/api/api.html b/imports/ui/pages/admin/indexation/api/api.html index aa00770..bfc7736 100755 --- a/imports/ui/pages/admin/indexation/api/api.html +++ b/imports/ui/pages/admin/indexation/api/api.html @@ -1,7 +1,7 @@ diff --git a/imports/ui/pages/admin/indexation/site/site.js b/imports/ui/pages/admin/indexation/site/site.js index 697b247..4a00514 100755 --- a/imports/ui/pages/admin/indexation/site/site.js +++ b/imports/ui/pages/admin/indexation/site/site.js @@ -7,6 +7,20 @@ import displayNotif from '../../../../components/notifs/notifs.js'; import './site.html'; +Template.siteIndexationTpl.onRendered(() => { + $('.forbiddenWordWebsite').tagsinput(); + Meteor.callPromise('getConfig', {}) + .then((config) => { + $('.hostUrlWebsite').val(config.domain); + if (config.forbiddenWord && config.forbiddenWord.length) { + config.forbiddenWord = config.forbiddenWord.join(','); + $('.forbiddenWordWebsite').tagsinput('add', config.forbiddenWord); + } + $('.bootstrap-tagsinput').addClass('form-control'); + }); + +}); + Template.siteIndexationTpl.events({ 'submit #formUrlSite': (event) => { event.preventDefault(); @@ -42,4 +56,31 @@ Template.siteIndexationTpl.events({ }); event.target.reset(); }, + 'submit #formReglageSite': (event) => { + event.preventDefault(); + + const config = { + domain: event.target.hostUrlWebsite.value, + forbiddenWord: event.target.forbiddenWordWebsite.value, + }; + + Meteor.callPromise('defineConfig', config) + .then(() => { + displayNotif({ + type: 'success', + title: 'Configuration : ', + message: 'Configuration ajouté avec succès!', + save: true, + }); + }).catch((error) => { + displayNotif({ + type: 'error', + title: 'Configuration : ', + message: error.reason ? error.reason : error, + save: true, + }); + }); + event.target.reset(); + $('.forbiddenWordWebsite').tagsinput('removeAll'); + }, }); diff --git a/imports/ui/pages/login/login.js b/imports/ui/pages/login/login.js index bf2ae32..8f10c54 100755 --- a/imports/ui/pages/login/login.js +++ b/imports/ui/pages/login/login.js @@ -1,5 +1,6 @@ import { Meteor } from 'meteor/meteor'; +import { Session } from 'meteor/session'; import { FlowRouter } from 'meteor/kadira:flow-router'; import { Template } from 'meteor/templating'; import displayNotif from '../../components/notifs/notifs'; @@ -29,6 +30,12 @@ Template.loginTpl.events({ title: 'Succès : ', message: `Bienvenue ${user.login}!`, }); + // get global config for user + Meteor.callPromise('getConfig', {}) + .then((config) => { + console.log(config); + Session.set('config', config); + }); } }); }, diff --git a/package.json b/package.json index ee12623..5002cbd 100755 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "cheerio": "^1.0.0-rc.1", "crawler": "^1.0.5", "datatables.net-bs": "^1.10.15", - "elasticsearch": "^13.1.0", + "elasticsearch": "^13.1.1", "izitoast": "^1.1.1", "jquery": "^1.11.2", "lodash": "^4.17.4", diff --git a/yarn.lock b/yarn.lock index e6b4b3d..42c7fab 100644 --- a/yarn.lock +++ b/yarn.lock @@ -896,20 +896,13 @@ domhandler@^2.3.0: dependencies: domelementtype "1" -domutils@1.5.1: +domutils@1.5.1, domutils@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.5.1.tgz#dcd8488a26f563d61079e48c9f7b7e32373682cf" dependencies: dom-serializer "0" domelementtype "1" -domutils@^1.5.1: - version "1.6.2" - resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.6.2.tgz#1958cc0b4c9426e9ed367fb1c8e854891b0fa3ff" - dependencies: - dom-serializer "0" - domelementtype "1" - double-ended-queue@^2.1.0-0: version "2.1.0-0" resolved "https://registry.yarnpkg.com/double-ended-queue/-/double-ended-queue-2.1.0-0.tgz#103d3527fd31528f40188130c841efdd78264e5c" @@ -924,9 +917,9 @@ ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" -elasticsearch@^13.1.0: - version "13.1.0" - resolved "https://registry.yarnpkg.com/elasticsearch/-/elasticsearch-13.1.0.tgz#f22a2afe01f4c3cde660bdd5b77575c6f8b6a397" +elasticsearch@^13.1.1: + version "13.1.1" + resolved "https://registry.yarnpkg.com/elasticsearch/-/elasticsearch-13.1.1.tgz#83dbb5cf76ecc9bdd3ffceb5ce74d5fc7d23e798" dependencies: agentkeepalive "^2.2.0" chalk "^1.0.0" -- 2.22.0