Skip to content

Commit

Permalink
Avoid the query object -> string -> hydrating -> string -> query obje…
Browse files Browse the repository at this point in the history
…ct roundtrip and directly hydrate on the query object (#136)
  • Loading branch information
mkr authored Nov 15, 2023
1 parent f160eec commit 5bd6be9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 20 deletions.
8 changes: 1 addition & 7 deletions services/esSearcherPreprocessorSvc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,7 @@ angular.module('o19s.splainer-search')
queryText = queryText.replace(/\\/g, '\\\\');
queryText = queryText.replace(/"/g, '\\\"');
}

var replaced = angular.toJson(args, true);

replaced = queryTemplateSvc.hydrate(replaced, queryText, {qOption: qOption, encodeURI: false, defaultKw: '\\"\\"'});
replaced = angular.fromJson(replaced);

return replaced;
return queryTemplateSvc.hydrate(args, queryText, {qOption: qOption, encodeURI: false, defaultKw: '\\"\\"'});
}
};

Expand Down
8 changes: 1 addition & 7 deletions services/searchApiSearcherPreprocessorSvc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@ angular.module('o19s.splainer-search')
queryText = queryText.replace(/\\/g, '\\\\');
queryText = queryText.replace(/"/g, '\\\"');
}

var replaced = angular.toJson(args, true);

replaced = queryTemplateSvc.hydrate(replaced, queryText, {qOption: qOption, encodeURI: false, defaultKw: '\\"\\"'});
replaced = angular.fromJson(replaced);

return replaced;
return queryTemplateSvc.hydrate(args, queryText, {qOption: qOption, encodeURI: false, defaultKw: '\\"\\"'});
}
};

Expand Down
7 changes: 1 addition & 6 deletions services/vectaraSearcherPreprocessorSvc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@ angular.module('o19s.splainer-search')
self.prepare = prepare;

const replaceQuery = function(qOption, args, queryText) {
var replaced = angular.toJson(args, true);

replaced = queryTemplateSvc.hydrate(replaced, queryText, {qOption: qOption, encodeURI: false, defaultKw: '\\"\\"'});
replaced = angular.fromJson(replaced);

return replaced;
return queryTemplateSvc.hydrate(args, queryText, {qOption: qOption, encodeURI: false, defaultKw: '\\"\\"'});
};

var preparePostRequest = function (searcher) {
Expand Down

0 comments on commit 5bd6be9

Please sign in to comment.