Skip to content
This repository has been archived by the owner on Oct 11, 2022. It is now read-only.

Commit

Permalink
Fix missing algolia package in old migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
brianlovin committed Aug 24, 2021
1 parent 4361b02 commit 3dc1a3c
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 42 deletions.
43 changes: 22 additions & 21 deletions api/migrations/20171208175038-index-users-for-search.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
require('now-env');
const initIndex = require('../../shared/algolia');
const searchIndex = initIndex('users');
// const initIndex = require('../../shared/algolia');
// const searchIndex = initIndex('users');

exports.up = function(r, conn) {
return r
.table('users')
.filter(user => user.hasFields('username'))
.run(conn)
.then(cursor => cursor.toArray())
.then(users =>
users.map(user => ({
name: user.name,
username: user.username,
description: user.description,
website: user.website,
objectID: user.id,
}))
)
.then(searchableUsers => {
return;
// return searchIndex.addObjects(searchableUsers)
})
.catch(err => console.log(err));
return Promise.resolve();
// return r
// .table('users')
// .filter(user => user.hasFields('username'))
// .run(conn)
// .then(cursor => cursor.toArray())
// .then(users =>
// users.map(user => ({
// name: user.name,
// username: user.username,
// description: user.description,
// website: user.website,
// objectID: user.id,
// }))
// )
// .then(searchableUsers => {
// return;
// // return searchIndex.addObjects(searchableUsers)
// })
// .catch(err => console.log(err));
};

exports.down = function(r, conn) {
Expand Down
43 changes: 22 additions & 21 deletions api/migrations/20171208180800-index-communities-for-search.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
require('now-env');
const initIndex = require('../../shared/algolia');
const searchIndex = initIndex('communities');
// const initIndex = require('../../shared/algolia');
// const searchIndex = initIndex('communities');

exports.up = function(r, conn) {
return r
.table('communities')
.filter(community => community.hasFields('deletedAt').not())
.run(conn)
.then(cursor => cursor.toArray())
.then(communities =>
communities.map(community => ({
description: community.description,
name: community.name,
slug: community.slug,
website: community.website ? community.website : null,
objectID: community.id,
}))
)
.then(searchableCommunities => {
return;
// searchIndex.addObjects(searchableCommunities)
})
.catch(err => console.log(err));
return Promise.resolve();
// return r
// .table('communities')
// .filter(community => community.hasFields('deletedAt').not())
// .run(conn)
// .then(cursor => cursor.toArray())
// .then(communities =>
// communities.map(community => ({
// description: community.description,
// name: community.name,
// slug: community.slug,
// website: community.website ? community.website : null,
// objectID: community.id,
// }))
// )
// .then(searchableCommunities => {
// return;
// // searchIndex.addObjects(searchableCommunities)
// })
// .catch(err => console.log(err));
};

exports.down = function(r, conn) {
Expand Down

0 comments on commit 3dc1a3c

Please sign in to comment.