Closed jonasbetareader closed 2 years ago
I'm trying to retrieve enriched documents from the Document index, but only getting the non-enriched id back.
Example code:
import { Document } from 'flexsearch'; type TestDocument = { foo: number; bar: string; } const docIndex = new Document< TestDocument, true >({ document: { id: 'foo', store: true, }, }); docIndex.add({ foo: 1, bar: 'test-document' }); console.log(docIndex.search<true>(1));
The above results in the following result:
Array [ Object { "field": "foo", "result": Array [ "1", ], }, ]
I would have expected something like the following: Array [ Object { "field": "foo", "result": Array [ { foo: 1, bar: 'test-document' }, ], }, ]
Array [ Object { "field": "foo", "result": Array [ { foo: 1, bar: 'test-document' }, ], }, ]
Am I missing or misunderstanding something? Using "flexsearch: "^0.7.21", and "@types/flexsearch": "^0.7.3",
When search you'll need to pass the enrich field.
enrich
https://github.com/nextapps-de/flexsearch#document-search-options
I'm trying to retrieve enriched documents from the Document index, but only getting the non-enriched id back.
Example code:
The above results in the following result:
I would have expected something like the following:
Array [ Object { "field": "foo", "result": Array [ { foo: 1, bar: 'test-document' }, ], }, ]
Am I missing or misunderstanding something? Using "flexsearch: "^0.7.21", and "@types/flexsearch": "^0.7.3",