nextapps-de / flexsearch

Next-Generation full text search library for Browser and Node.js
Apache License 2.0
12.54k stars 492 forks source link

Search per named field (Github issue search style) #177

Closed jwillp closed 3 years ago

jwillp commented 4 years ago

Hi, I was wondering if it was possible to make searches using named fields in a similar fashion to the GIthub Issue Search:

Given:

doc: {
    id: "id",
    field: [
      "title",
      "content",
      "assignee"
    ]
}

With an indexed document like:

{
    id: "1",
    title: "An Issue"
    content: "Content of an Issue",
    assignee: "John"
}

To be able to do a query like so:

title:"An Issue" assignee:"John"

Is there a way out of the box something like this?

Thank you!

wbelk commented 3 years ago

I think for this you would use multiple query and bool: 'and'

jonrkarr commented 3 years ago

This would be great to have.

For comparison, Lunr supports this query syntax: https://lunrjs.com/guides/searching.html

ts-thomas commented 3 years ago

Please change over to the version >= 0.7.x which has support for this, thanks a lot.

jonrkarr commented 3 years ago

This sounds great! This will enable us to switch to flexsearch. Is there documentation about the supported search syntax?