0

I'm developing an app in Angular.

I have some text books, which I store in a JSON format. Each section of the book is composed of an object inside the JSON array, like this:

{
"Chapter": "Intro",
"Id": "1",
"Section_Body":"blah blah"
"Section_Title": "Something"
},

Each book is stored in a different JSON file.

I am trying to implement a full text search on these books, where a user could search for a word or a few words and find the results in the books (not just find if the exact text is included there).

What is the best and easiest way to do this?

amitairos
  • 2,907
  • 11
  • 50
  • 84
  • Use a full-text search engine for that. – Dekel Dec 27 '18 at 12:55
  • @Dekel Example? – amitairos Dec 27 '18 at 12:56
  • Google? you can use this for a start: https://stackoverflow.com/questions/737275/comparison-of-full-text-search-engine-lucene-sphinx-postgresql-mysql – Dekel Dec 27 '18 at 12:58
  • function searchText(array, 'keyword') { transform(array: any[], keyword): any { if (array == null) { return null; } return array.filter(function(obj) { if (args[1]) { return obj.Section_Body === keyword; } return array; }); } } Use above function to search text. – Prashant M Bhavsar Dec 27 '18 at 12:59
  • 1
    @PrashantMBhavsar this is not even close to full-text search. – Dekel Dec 27 '18 at 13:06

0 Answers0