Switching the data file file path dynamically to create the index
See original GitHub issueHi,
I have configured the library in an app created with NestJS and the library is working fine in a simple setup. My setup is as follows:
import si = require('search-index');
@Injectable()
export class SearchService {
private searchIndex: any;
constructor() {
}
private async initSearch(): Promise<void> {
if (!this.searchIndex) {
this.searchIndex = await si({
// db: 'memdown',
name: 'test',
});
}
}
}
In Angular FE I have several PDF files to view using the PDFjs library. These PDF files have indexed using the Apache Solr server and I have the indexed JSON files in the file system for each PDF file in an organized folder structure as shown below. These files are having lots of content and the JSON index also having lots of indexed content.
The folder structure of the PDF and index files are as follows:
DIR-A
| --- DATA [contains PDF files]
| --- INDEX [contains PDF related index in JSON]
DIR-B
| --- DATA [contains PDF files]
| --- INDEX [contains PDF related index in JSON]
Now when I init the search-index first time for the DIR-A folder content it gives me the expected result. But when I open a document from the DIR-B and start to search, the search-index is still pointing to the DIR-A folder.
What I need is to switch the folder accordingly when the document switches from the FE and search the document-related index or any given dynamic path-related index.
Could someone please help me to configure the library with this flexibility?
Thank you very much.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
@eklem @fergiemcdowall , Thank you very much for the guidance. I will go through the example and see what I can find further.
Thank you very much
@ishanuda Ther is a gitter.im channel, but very little happening there, and the search-index library has been updated recently. So you won’t find much useful there. Look at the tests or the demo to get a better understanding of how things work.