Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
daneryl committed Jul 14, 2017
2 parents 957cfdb + 6d72829 commit 91397e0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@
- **Elasticsearch** (5.4)
- https://www.elastic.co/guide/en/elasticsearch/reference/current/install-elasticsearch.html

- **Docsplit**
- OSX
- `brew install ruby`
- `brew install ghostscript`
- `gem install docsplit`
- install non optional dependencies for docsplit -> [https://documentcloud.github.io/docsplit/](https://documentcloud.github.io/docsplit/)
- UBUNTU
- install ruby `sudo apt-get install ruby-full`
- `gem install docsplit`
- install non optional dependencies for docsplit -> [https://documentcloud.github.io/docsplit/](https://documentcloud.github.io/docsplit/)

- **MongoDB**
- Ubuntu
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
Expand Down
11 changes: 11 additions & 0 deletions app/api/migrations/reprocess_documents.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import P from 'bluebird';
import PDF from '../upload/PDF.js';
import entities from '../entities/entitiesModel';
import fs from 'fs';
import mongoose from 'mongoose';

entities.get({type: 'document'}, {_id: 1})
.then(documents => {
return P.resolve(documents).map(({_id}) => {
return entities.get({_id})
.then(([doc]) => {
if (!doc.file) {
return;
}
const file = __dirname + '/../../../uploaded_documents/' + doc.file.filename;
if (!fs.existsSync(file)) {
return;
}
return new PDF(file).convert()
.then((conversion) => {
doc.fullText = conversion.fullText;
Expand All @@ -23,4 +30,8 @@ entities.get({type: 'document'}, {_id: 1})
})
.then(() => {
mongoose.disconnect();
})
.catch((e) => {
console.log(e);
mongoose.disconnect();
});

0 comments on commit 91397e0

Please sign in to comment.