Skip to content

Commit

Permalink
Implement domains-via-query search
Browse files Browse the repository at this point in the history
- prev. test now passes
  • Loading branch information
poltak committed Mar 9, 2018
1 parent 9d1b194 commit 5ceecb3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/search/search-index-new/search/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@ export async function search({
query,
showOnlyBookmarks,
mapResultsFunc = mapResultsToDisplay,
domains = [],
...restParams
}) {
// Extract query terms via QueryBuilder (may change)
const qb = new QueryBuilder().searchTerm(query).get()
const qb = new QueryBuilder()
.searchTerm(query)
.filterDomains(domains)
.get()

// Short-circuit search if bad term
if (qb.isBadTerm) {
Expand All @@ -44,9 +48,10 @@ export async function search({

// Reshape needed params; prob consolidate interface later when remove old index code
const params = {
queryTerms: [...qb.query],
bookmarks: showOnlyBookmarks,
...restParams,
bookmarks: showOnlyBookmarks,
queryTerms: [...qb.query],
domains: [...qb.domain],
}

const { docs, totalCount } = await db.transaction(
Expand Down

0 comments on commit 5ceecb3

Please sign in to comment.