Skip to content

Commit e82b06b

Browse files
committed
Use GraphQL search while we are out of credits
1 parent a5bb19c commit e82b06b

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

packages/skin-museum-client/src/algolia.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export async function graphqlSearch(query, options = {}) {
2727
}
2828

2929
export function algoliaSearch(query, options = {}) {
30+
console.log("algoliaSearch", query, options);
3031
return new Promise((resolve, reject) => {
3132
index.search(
3233
{

packages/skin-museum-client/src/redux/epics.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
takeWhile,
2020
mergeAll,
2121
} from "rxjs/operators";
22-
import { algoliaSearch } from "../algolia";
22+
import { algoliaSearch, graphqlSearch } from "../algolia";
2323
import queryParser from "../queryParser";
2424
import { CHUNK_SIZE } from "../constants";
2525
import * as UploadUtils from "../upload/uploadUtils";
@@ -138,6 +138,8 @@ const selectSkinReadmeEpic = (actions, states) =>
138138
})
139139
);
140140

141+
const USE_ALGOLIA = false;
142+
141143
const searchEpic = (actions) =>
142144
actions.pipe(
143145
filter((action) => action.type === "SEARCH_QUERY_CHANGED"),
@@ -148,7 +150,11 @@ const searchEpic = (actions) =>
148150

149151
const [newQuery, options] = queryParser(query);
150152

151-
return from(algoliaSearch(newQuery, options)).pipe(
153+
return from(
154+
USE_ALGOLIA
155+
? algoliaSearch(newQuery, options)
156+
: graphqlSearch(newQuery, options)
157+
).pipe(
152158
map((content) => {
153159
const matchingSkins = content.hits.map((hit) => ({
154160
hash: hit.objectID,

0 commit comments

Comments
 (0)