question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Switching the data file file path dynamically to create the index

See original GitHub issue

Hi,

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:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ishanudacommented, Feb 21, 2021

@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

0reactions
eklemcommented, Feb 20, 2021

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create Dynamic File Path in Power Query - Goodly
In this post I'll share, how can you create a dynamic folder or a file path, both in Excel Power Query and in...
Read more >
Power Query dynamic file path - Excel Quick Help
Learn how to create dynamic file paths for Power Query data sources, using cell references from another worksheet.
Read more >
INDEX with dynamic File Path String - microsoft excel
I am creating a sheet and I want to ...
Read more >
Solved: Dynamic File path - QlikView App Dev - Qlik Community
My resolve will be to drop a copy of the QV file into each report folder. I will later work on an index...
Read more >
To get the File path dynamically - SAP Community
Hai Girish. Check the following Code. DATA: I_FILETABLE TYPE FILETABLE,. V_RC TYPE I. PARAMETERS: P_FILE LIKE RLGRAP-FILENAME. "local file with contracts.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found