gitbook-plugin-search-plus icon indicating copy to clipboard operation
gitbook-plugin-search-plus copied to clipboard

Question: does it search metadata?

Open nagim opened this issue 8 years ago • 12 comments

Hi,

Does the plugin takes metadata into account? I would like to add some relevance to the chapters via YAML frontmatter (that will go to the metadata), but I'm not sure if it will affect the search ranking. Could you please confirm?

Thanks, Imre

nagim avatar Jan 25 '17 14:01 nagim

search plugin only search the text write in md files. All the data can be searched was indexed in search_plus_index.json .

lwdgit avatar Feb 05 '17 11:02 lwdgit

Thank you for the answer!

Is it possible to add this functionality? It would be great if could make pages rank higher in the search results by adding metadata.

Thanks!

nagim avatar Feb 05 '17 11:02 nagim

This is interesting to me as well, if this plugin somehow inspired by original lunr, then it would be nice to adopt search keywords in front-matter section, like this:

Adding keywords to a page You can specify explicit keywords for any page.

---
search:
    keywords: ['keyword1', 'keyword2', 'etc.']

---

My Page

This page will rank better if we search for 'keyword1'.

hellt avatar Apr 12 '17 10:04 hellt

@hellt The purpose of this plugin is to search the contents of the page, and metadata will not be presented in the page, which may make users feel troubled. If you really need, I will try to add this feature.

lwdgit avatar Apr 20 '17 15:04 lwdgit

It would be really useful, if you can add it, that would be awesome! Thanks a lot!

nagim avatar Apr 20 '17 15:04 nagim

@nagim @hellt , here is test link: https://lwdgit.github.io/gitbook-plugin-search-plus/book/?q=keyword1 , If there are other problems, please give me feedback😄!

lwdgit avatar Apr 21 '17 13:04 lwdgit

That is close! What I would like to see is the following: Suppose I have a big book where some pages are about Star Wars and other are about Star Treck
Pages type also differs, I can have Bio and Article pages.

So I will add keywords like these:

search:
     keywords: ['Star Trek', 'Bio']

for one page and

search:
     keywords: ['Star Wars', 'Bio']

for another.

Now in the search field if I add keywords:Star Wars I expect to see all the pages that were tagged with Star Wars If I add keywords:Star Wars, Bio I should filter only pages tagged with both keywords Star Wars and Bio

And in the most advanced case if I add Darth Vader keywords:Star Wars, Bio I shoud receive only pages tagged with Star Wars and Bio and having Darth Vader string somewhere inside

hellt avatar Apr 21 '17 14:04 hellt

@hellt Is this ok? https://lwdgit.github.io/gitbook-plugin-search-plus/book/?q=react%3Ameta , Or try it by yourself :

npm install [email protected]

lwdgit avatar Apr 21 '17 15:04 lwdgit

@lwdgit when you do react:meta you are displaying the pages, that have react placed in keywords? If yes, then I do not see why you need to highlight this word in the search results.

What I see is missing is that if you want to search for pages, that have react in keywords and a particular text For example Native react:meta search input should filter/highlight which react-tagged pages have Native word in its body.

hellt avatar Apr 21 '17 16:04 hellt

@lwdgit Thanks a lot, I will also test it soon!

nagim avatar Apr 25 '17 09:04 nagim

How to change the search result prompt to Chinese prompt?

codePanda0916 avatar Nov 07 '17 09:11 codePanda0916

How to change the search result prompt to Chinese prompt?

ysl-ccc avatar Nov 27 '23 09:11 ysl-ccc