Git Product home page Git Product logo

Comments (7)

travis-r6s avatar travis-r6s commented on June 13, 2024 1

@schoell It is, yes - you will just need to update your search function. I.e:

// https://github.com/nextapps-de/flexsearch#combine-fuzzy-search-with-a-where-clause
this.$search.search(searchTerm,  {
    where: {
        "index": "some-index"
    },
    limit: 10
})

To add any specific filters as required.

from gridsome-plugin-flexsearch.

travis-r6s avatar travis-r6s commented on June 13, 2024

So just to ensure I understand you correctly - in your data, there could potentially be two items with the id 3, but have different types...?

You should be able to specify a stricter search if needed, using https://github.com/nextapps-de/flexsearch#where, so you could specify that index = Topics.

from gridsome-plugin-flexsearch.

 avatar commented on June 13, 2024

So just to ensure I understand you correctly - in your data, there could potentially be two items with the id 3, but have different types...?

yes, we use Directus CMS as data source The IDs of the nodes are assigned individually per collection. Therefore there are always nodes with the same ID of a certain collection.

You should be able to specify a stricter search if needed, using https://github.com/nextapps-de/flexsearch#where, so you could specify that index = Topics.

Is this possible, using you plugin?

from gridsome-plugin-flexsearch.

 avatar commented on June 13, 2024

The problem is the same ID in the search index. That means there is a FAQ with ID 1 and a TOPIC with ID 1. To solve the problem, the IDs must be extended by the collection type.

I.e. FAQ with ID FAQ1 and TOPIC with ID TOPIC1.

In the gridsome.server.js in line 56 I have extended the IDs. With this it works.

  const doc = {
    index: index.indexName,
    id: node.id+index.indexName,
    path: node.path,
    ...docFields
  }

from gridsome-plugin-flexsearch.

travis-r6s avatar travis-r6s commented on June 13, 2024

Ah, I get your problem now. Could you use onCreateNode to edit your id's as above?

from gridsome-plugin-flexsearch.

PeterSchoell avatar PeterSchoell commented on June 13, 2024

Ah, I get your problem now. Could you use onCreateNode to edit your id's as above?

No, because we create the nodes using the Directus Plugin. But with the modification above it works fine.

from gridsome-plugin-flexsearch.

travis-r6s avatar travis-r6s commented on June 13, 2024

Even when using a source plugin, you can use the onCreateNode api to edit nodes - but if your solution works, then that's fine.

from gridsome-plugin-flexsearch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.