function saveQueryResults(queryString, matchCount, titleArray, pageInfo, data, originalResult) {
  const books = keyInfo.getBooks();
  let keyLength = keyInfo.getKeyInfo().keyLength;

  //don't save if there were no matches
  if (matchCount === 0) {
    return;
  }

  //flatten the query result to simplify access by query navigator on transcript pages
  let flatMatches = [];
  for (const bid of books) {
    if (originalResult[bid]) {
      for (const match of originalResult[bid]) {
        let pageKey = match.key.substr(0, keyLength);
        let m = { key: pageKey, url: `/${match.book}/${match.unit}/`, location: match.location};
        flatMatches.push(m);
      }
    }
  }

  storeSet("srchResults", {
    query: queryString, 
    count: matchCount, 
    titleArray: titleArray, 
    pageInfo: pageInfo, 
    data: data,
    flat: flatMatches
  });
}
//save the query result so it can be available until replaced by another query
save the query result so it can be available until replaced by another query
save the query result so it can be available until replaced by another query
function saveQueryResults(queryString, matchCount, titleArray, pageInfo, data, originalResult) {
  const books = keyInfo.getBooks();
  let keyLength = keyInfo.getKeyInfo().keyLength;
  if (matchCount === 0) {
    return;
  }
  let flatMatches = [];
  for (const bid of books) {
    if (originalResult[bid]) {
      for (const match of originalResult[bid]) {
        let pageKey = match.key.substr(0, keyLength);
        let m = { key: pageKey, url: `/${match.book}/${match.unit}/`, location: match.location};
        flatMatches.push(m);
      }
    }
  }
  storeSet("srchResults", {
    query: queryString, 
    count: matchCount, 
    titleArray: titleArray, 
    pageInfo: pageInfo, 
    data: data,
    flat: flatMatches
  });
}
function saveQueryResults ( queryString , matchCount , titleArray , pageInfo , data , originalResult ) { const books = keyInfo . getBooks ( ) ; let keyLength = keyInfo . getKeyInfo ( ) . keyLength ; if ( matchCount === 0 ) { return ; } let flatMatches = [ ] ; for ( const bid of books ) { if ( originalResult [ bid ] ) { for ( const match of originalResult [ bid ] ) { let pageKey = match . key . substr ( 0 , keyLength ) ; let m = { key : pageKey , url : ` ${ match . book } ${ match . unit } ` , location : match . location } ; flatMatches . push ( m ) ; } } } storeSet ( "srchResults" , { query : queryString , count : matchCount , titleArray : titleArray , pageInfo : pageInfo , data : data , flat : flatMatches } ) ; }
save the query result so it can be available until replaced by another query
save the query result so it can be available until replaced by another query
//don't save if there were no matches //flatten the query result to simplify access by query navigator on transcript pages