
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
nestjs-solr
Advanced tools
Solr module for Nestjs.
npm install nestjs-solr
Register SolrModule
:
import { SolrModule } from 'nest-solr';
@Module({
imports: [
SolrModule.register({
host: 'localhost',
port: '8983',
secure: false,
core: 'mycore',
}),
],
})
export class AppModule {}
Inject SolrService
:
import { SolrService } from 'nest-solr';
@Injectable()
export class SearchService {
constructor(private readonly solrService: SolrService) {}
}
import { SolrModule } from 'nest-solr';
@Module({
imports: [
SolrModule.register({
host: 'localhost',
port: '8983',
secure: true,
tls: {
ca: [fs.readFileSync('solr-ssl.pem')],
},
auth: {
basic: {
username: 'solr',
password: 'SolrRocks',
},
},
core: 'mycore',
}),
],
})
export class AppModule {}
***(See more Securing Solr)
@Module({
imports: [
SolrModule.registerAsync({
imports: [ConfigModule],
useFactory: async (configService: ConfigService) => ({
host: configService.get('SOLR_HOST'),
port: configService.get('SOLR_PORT'),
secure: configService.get('SOLR_SECURE'),
core: 'mycore',
}),
inject: [ConfigService],
}),
],
})
// Add a new document
const obj = await this.solrService.add({ id : 12, title_t : 'Hello', status: '1' });
console.log('Solr response:', obj);
// Search
const solrQuery = this.solrService
.query()
.q({ title_t: 'Hello' })
.matchFilter('status', '1') //the fq (Filter Query)
.fl(['title_t']) //the fl (field List)
.start(0) //the offset where the set of returned documents should begin
.rows(10) //the maximum number of documents returned
;
const ret: SearchResponse<any> = await this.solrService.search(solrQuery);
console.log('Solr response:', obj);
// Delete all documents
await this.solrService.deleteAll();
The SolrService
wraps the Solr client from the lbdremy/solr-node-client library. The SolrModule.register()
takes options object as an argument to create the client, read more here.
Solr Homepage: https://solr.apache.org/
Nestjs-Solr is MIT licensed.
FAQs
Solr client for Nestjs
The npm package nestjs-solr receives a total of 29 weekly downloads. As such, nestjs-solr popularity was classified as not popular.
We found that nestjs-solr demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.