E1337Kat / slate_server

Standalone Docs app for API documentation. Uses Slate design.
Apache License 2.0
2 stars 2 forks source link

Question about multipage search #22

Open nateKlaux opened 11 months ago

nateKlaux commented 11 months ago

Hi, I know this is kind of old, but am trying to tackle a similar issue in my current role. We don't have much engineering support, so I'm shooting in the dark a bit. Could you explain how you got multipage search to work? I've already implemented multipage, albeit differently than you did.

Essentially, my .erb file checks an attribute in index.html.md file and, if set to True, loads that index.html.md file. So, I have a few pages like index.html.md, guides.html.md, etc.

Search, however, only searches the current page.

E1337Kat commented 11 months ago

I think that search was one thing I didn't get around to fixing, but I believe that it can be made to work in much the same way as the toc changes (preserve original search, but also use data.yml for new search), the problem I ran into is having the js search know what was in data.yml. This is where I left off since this was a side project at my old job and I was pulled off it as it were.

The problem though is that the search uses the entire body of an entry, and the data.yml doesn't have that. It might could be modified to have keywords for each data.yml entry, tho... At which point you would only need pass in the data.yml conditionally to the js and make some modifications in the search index population: https://github.com/E1337Kat/slate_server/blob/e1aa4bff702960689e8924ed713a51176f56efbf/app/assets/javascripts/app/_search.js#L22-L34

I might try and work that out actually. It'd be nice to have a full product.

nateKlaux commented 11 months ago

Thanks for the note! I ended up solving it by editing the populate function to index the other pages, then another function that page data. This works now because we don't have too many pages, and they're not too long. Multi-page was mostly about content organization for us.

E1337Kat commented 11 months ago

Smart idea.

Multi-page was mostly about content organization for us.

That is how I felt about multi-page as well.