Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

searchField as an array #1

Closed
lindsaykwardell opened this issue Nov 24, 2019 · 2 comments
Closed

searchField as an array #1

lindsaykwardell opened this issue Nov 24, 2019 · 2 comments
Assignees

Comments

@lindsaykwardell
Copy link

lindsaykwardell commented Nov 24, 2019

Hello, I'm having some trouble with setting up search fields. Here is my markdown file frontmatter:

---
path: "/new-website"
date: 2019-08-04
title: "New Website"
author: "Lindsay Wardell"
tags:
  - Web Development
  - Personal

---

I set up my configuration as follows:

{
      use: 'gridsome-plugin-flexsearch',
      options: {
        collections: [
          {
            typeName: 'Post',
            indexName: 'Post',
            fields: ['title', 'content', 'tags', 'author', 'date']
          }
        ],
        searchFields: ['title', 'tags']
      }
    }

The field 'tags' is an array in the Markdown files. When I search for a tag, it does not appear to filter by that tag, only by the title. Does this plugin support arrays as a searchField?

@travis-r6s travis-r6s self-assigned this Nov 25, 2019
@travis-r6s
Copy link
Owner

@lindsaykwardell I have released an update that allows searchFields to be an object, so you should be able to do something like nextapps-de/flexsearch#36 (comment)

searchFields: {
  tags: {
    encode: "extra",
    tokenize: "full"
  }
}

Not sure if that will work for you - hopefully the new FlexSearch v0.7.0 release will handle searching arrays better.

@travis-r6s
Copy link
Owner

Have also fixed an issue where the client-side FlexSearch instance wasn't using the configured search preset, so you should now be able to to search arrays correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants