ePub search result (tab able)

hay,

what i have:
SearchEngine: to index epub -> get result.json, search in json
json file (example):

{
  "results": [
    {
      "baseCfi": "/6/10[xintroduction_001]!", 
      "cfi": "/6/10[xintroduction_001]!/4/2/6/2", 
      "highlight": "others, and to teach them by what name a <b class='match'>whale</b>-fish is to be called in our tongue leaving out, ...", 
      "href": "introduction_001.xhtml", 
      "path": "moby-dick//OPS/introduction_001.xhtml", 
      "title": "ETYMOLOGY."
    },
    ...
  ]
}

Currently i can search in epub and get the information like “baseCfi” or “cfi”.
My Question is, how can i do a Textfield tab able, to link that with result-cfi or baseCfi?

Does somebody has any idea?

The current search result looks:

What does that mean?
How it should it look like?

opening the page by pressing the search-result area
e.g. my search text is “name a whale” and search-result is “to school others, and … name a wahle-…” and when I tab on “search-result” i want to open the epub page “/6/10[xintroduction_001]!/4/2/6/2”

Ok, so you are asking how to navigate the book view to the location that the search returned?

If so, look at how the table of contents does it:



I think you can reuse that function.

Can I use “navParams” to navigate to a page? Whats about this (epubjs) function “Book.displayChapter(’/6/4[chap01ref]!/4[body01]/10’);”

I reuse the function for “searchPage” but get an error

  _subscribeToEvents() {
    console.log('subscribe to events');

    //goto searchPage
    this.events.subscribe('select:baseCfi', (content) => {
      this.book.goto(content.baseCfi);
    });

You don’t want to load a new page with this page - you already have the book open. That is why the TOC sends an event that the book page listens to and then goes to the correct page.

You will have to see if this goto function here is the correct one for the data type you get in the search results. You will want to read about and understand these Cfi thingies. (I think I linked them in the docs of the repo)