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

Commit

Permalink
Remove vulcan and all search implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
brianlovin committed Aug 23, 2021
1 parent bd23e45 commit 950a1a5
Show file tree
Hide file tree
Showing 117 changed files with 121 additions and 6,624 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ debug
now-secrets.json
build-iris
build-api
build-vulcan
build-hyperion
package-lock.json
.vscode
Expand Down
1 change: 0 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
- api
- hyperion (frontend)
- desktop
- vulcan

**Run database migrations (delete if no migration was added)**
YES
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ debug
now-secrets.json
build-iris
build-api
build-vulcan
build-hyperion
build-electron
package-lock.json
Expand Down
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ debug
now-secrets.json
build-iris
build-api
build-vulcan
build-hyperion
build-electron
package-lock.json
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ spectrum/
├── public # Public files used on the frontend
├── shared # Shared JavaScript code
├── src # Frontend SPA
└── vulcan # Worker server (search indexing; syncing with Algolia)
```

<details>
Expand Down
20 changes: 0 additions & 20 deletions api/models/community.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import intersection from 'lodash.intersection';
import { parseRange } from './utils';
import { uploadImage } from '../utils/file-storage';
import getRandomDefaultPhoto from '../utils/get-random-default-photo';
import { searchQueue } from 'shared/bull/queues';
import { createChangefeed } from 'shared/changefeed-utils';
import type { DBCommunity, DBUser } from 'shared/types';
import type { Timeframe } from './utils';
Expand Down Expand Up @@ -247,12 +246,6 @@ export const createCommunity = ({ input }: CreateCommunityInput, user: DBUser):
.run()
.then(result => result.changes[0].new_val)
.then(community => {
searchQueue.add({
id: community.id,
type: 'community',
event: 'created'
})

// if no file was uploaded, update the community with new string values
if (!file && !coverFile) {
const { coverPhoto, profilePhoto } = getRandomDefaultPhoto();
Expand Down Expand Up @@ -447,12 +440,6 @@ export const editCommunity = async ({ input }: EditCommunityInput, userId: strin
community = result.changes[0].old_val;
}

searchQueue.add({
id: communityId,
type: 'community',
event: 'edited'
})

return community
})
};
Expand Down Expand Up @@ -541,13 +528,6 @@ export const deleteCommunity = (communityId: string, userId: string): Promise<DB
}
)
.run()
.then(() => {
searchQueue.add({
id: communityId,
type: 'community',
event: 'deleted'
})
});
};

// prettier-ignore
Expand Down
35 changes: 0 additions & 35 deletions api/models/message.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
//@flow
const { db } = require('shared/db');
import {
_adminProcessToxicMessageQueue,
searchQueue,
} from 'shared/bull/queues';
import { NEW_DOCUMENTS } from './utils';
import { createChangefeed } from 'shared/changefeed-utils';
import {
Expand Down Expand Up @@ -141,12 +137,6 @@ export const storeMessage = (message: Object, userId: string): Promise<DBMessage

if (message.threadType === 'story') {
await Promise.all([
searchQueue.add({
id: message.id,
type: 'message',
event: 'created'
}),
_adminProcessToxicMessageQueue.add({ message }),

setThreadLastActive(message.threadId, message.timestamp),
incrementMessageCount(message.threadId)
Expand Down Expand Up @@ -208,13 +198,6 @@ export const deleteMessage = (userId: string, messageId: string) => {
message.threadType === 'story'
? decrementMessageCount(message.threadId)
: Promise.resolve(),
message.threadType === 'story'
? searchQueue.add({
id: message.id,
type: 'message',
event: 'deleted',
})
: Promise.resolve(),
]);

return message;
Expand All @@ -230,15 +213,6 @@ export const deleteMessagesInThread = async (threadId: string, userId: string) =

if (!messages || messages.length === 0) return;

const searchPromises = messages.map(message => {
if (message.threadType !== 'story') return null
return searchQueue.add({
id: message.id,
type: 'message',
event: 'deleted'
})
})

const deletePromise = db
.table('messages')
.getAll(threadId, { index: 'threadId' })
Expand All @@ -250,7 +224,6 @@ export const deleteMessagesInThread = async (threadId: string, userId: string) =

return await Promise.all([
deletePromise,
...searchPromises
]).then(() => {
return Promise.all(Array.from({ length: messages.length }).map(() => decrementMessageCount(threadId)))
});
Expand Down Expand Up @@ -299,14 +272,6 @@ export const editMessage = (message: EditInput): Promise<DBMessage> => {
.run()
.then(result => result.changes[0].new_val || result.changes[0].old_val)
.then(message => {
if (message.threadType === 'story') {
searchQueue.add({
id: message.id,
type: 'message',
event: 'edited'
})
}

return message;
});
};
30 changes: 0 additions & 30 deletions api/models/thread.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// @flow
const { db } = require('shared/db');
import intersection from 'lodash.intersection';
import { searchQueue } from 'shared/bull/queues';
const { parseRange, NEW_DOCUMENTS } = require('./utils');
import { createChangefeed } from 'shared/changefeed-utils';
import { deleteMessagesInThread } from '../models/message';
Expand Down Expand Up @@ -455,13 +454,6 @@ export const publishThread = (
.run()
.then(result => {
const thread = result.changes[0].new_val;

searchQueue.add({
id: thread.id,
type: 'thread',
event: 'created',
});

return thread;
});
};
Expand Down Expand Up @@ -522,14 +514,6 @@ export const deleteThread = (threadId: string, userId: string): Promise<Boolean>
])
)
.then(([result]) => {
const thread = result.changes[0].new_val;

searchQueue.add({
id: thread.id,
type: 'thread',
event: 'deleted'
})

return result.replaced >= 1 ? true : false;
});
};
Expand Down Expand Up @@ -569,13 +553,6 @@ export const editThread = (input: EditThreadInput, userId: string, shouldUpdate:
// if an update happened
if (result.replaced === 1) {
const thread = result.changes[0].new_val;

searchQueue.add({
id: thread.id,
type: 'thread',
event: 'edited'
})

return thread;
}

Expand Down Expand Up @@ -626,13 +603,6 @@ export const moveThread = (id: string, channelId: string) => {
.then(result => {
if (result.replaced === 1) {
const thread = result.changes[0].new_val;

searchQueue.add({
id: thread.id,
type: 'thread',
event: 'moved',
});

return thread;
}

Expand Down
1 change: 0 additions & 1 deletion api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"dependencies": {
"algoliasearch": "^3.33.0",
"apollo-local-query": "^0.3.1",
"apollo-server-cache-redis": "^0.3.1",
"apollo-server-express": "2.5.0-alpha.0",
Expand Down
5 changes: 0 additions & 5 deletions api/queries/community/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import community from './rootCommunity';
import communities from './rootCommunities';
import topCommunities from './rootTopCommunities';
import recentCommunities from './rootRecentCommunities';
import searchCommunities from './rootSearchCommunities';
import searchCommunityThreads from './rootSearchCommunityThreads';

import communityPermissions from './communityPermissions';
import channelConnection from './channelConnection';
import memberConnection from './memberConnection';
Expand Down Expand Up @@ -48,8 +45,6 @@ module.exports = {
communities,
topCommunities,
recentCommunities,
searchCommunities,
searchCommunityThreads,
},
Community: {
communityPermissions,
Expand Down
27 changes: 0 additions & 27 deletions api/queries/community/rootSearchCommunities.js

This file was deleted.

87 changes: 0 additions & 87 deletions api/queries/community/rootSearchCommunityThreads.js

This file was deleted.

28 changes: 0 additions & 28 deletions api/queries/search/index.js

This file was deleted.

Loading

0 comments on commit 950a1a5

Please sign in to comment.