@@ -18,6 +18,7 @@ class Search extends Component {
1818 this.glossarySearch = this.glossarySearch.bind(this);
1919 this.patpSearch = this.patpSearch.bind(this);
2020 this.devSearch = this.devSearch.bind(this);
21+ this.opsSearch = this.opsSearch.bind(this);
2122 }
2223
2324 searchEndpoint(query) {
@@ -32,6 +33,10 @@ class Search extends Component {
3233 return `/api/glossary?q=${encodeURIComponent(query)}`;
3334 }
3435
36+ opsSearch(query) {
37+ return `/api/ops-search?q=${query}`;
38+ }
39+
3540 patpSearch(query) {
3641 return (
3742 (ob.isValidPatp(`~${deSig(query.toLowerCase())}`) &&
@@ -100,11 +105,21 @@ class Search extends Component {
100105 }));
101106 });
102107
108+ const opsResults = await fetch(this.opsSearch(query))
109+ .then((res) => res.json())
110+ .then((res) => {
111+ return res.results.map((item) => ({
112+ type: "OPS_RESULT",
113+ content: item,
114+ }));
115+ });
116+
103117 const list = [
104118 ...glossaryResults,
105119 ...patpResult,
106120 ...results,
107121 ...devResults,
122+ ...opsResults,
108123 ];
109124
110125 this.setState({ results: list });
@@ -311,6 +326,47 @@ class Search extends Component {
311326 </li>
312327 );
313328 }
329+ if (item.type === "OPS_RESULT") {
330+ const opsItem = Object.assign({}, item.content);
331+ opsItem[
332+ "slug"
333+ ] = `https://operators.urbit.org${item.content.slug}`;
334+ return (
335+ <li
336+ className={`cursor-pointer flex text-left w-full ${
337+ selected ? "bg-green-400" : ""
338+ }`}
339+ {...getItemProps({
340+ key: item.content.link + "-" + index,
341+ index,
342+ item: opsItem,
343+ selected,
344+ })}
345+ >
346+ <div className="p-3">
347+ <p
348+ className={`font-medium text-base ${
349+ selected ? "text-white" : "text-wall-600"
350+ }`}
351+ >
352+ <span className="text-wall-400">
353+ {item.content.parent !== "Content"
354+ ? `operators.urbit.org / ${item.content.parent} /`
355+ : "operators.urbit.org /"}{" "}
356+ </span>
357+ {item.content.title}
358+ </p>
359+ <p
360+ className={`text-base font-regular text-small ${
361+ selected ? "text-midWhite" : "text-wall-500"
362+ }`}
363+ >
364+ {item.content.content}
365+ </p>
366+ </div>
367+ </li>
368+ );
369+ }
314370 return null;
315371 })
316372 : null}