
Security News
Security Community Slams MIT-linked Report Claiming AI Powers 80% of Ransomware
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.
@pinelab/vendure-plugin-better-search
Advanced tools
Vendure plugin for better storefront search, without the need of external systems
This plugin offers more intuitive storefront search than Vendure's DefaultSearchPlugin before the need of an external platform like TypeSense or ElasticSearch.
Important! The scope of this plugin:
DefaultSearchPlugin, but rather offers an additional endpoint in the shop-api for searching. The admin will still use the DefaultSearchPlugin for searching.Features:
vendure-config.ts:import { BetterSearchPlugin } from '@pinelab/vendure-plugin-better-search';
...
plugins: [
  BetterSearchPlugin,
],
betterSearch query. The very first time, this will throw an error, and it will start building the index in the background.query Search {
  betterSearch(input: { term: "dumbbells" }) {
    totalItems
    items {
      productId
      slug
      productName
      productAsset {
        id
        preview
      }
      lowestPrice
      lowestPriceWithTax
      highestPrice
      highestPriceWithTax
      facetValueIds
      collectionIds
      collectionNames
    }
  }
}
⚠️ Set the env variable BETTER_SEARCH_INDEX_COLUMN_TYPE for your specific database! Without this, text is used as default, but this will be too small for most projects. Run a database migration after setting this env variable!
# For MySQL
BETTER_SEARCH_INDEX_COLUMN_TYPE=mediumblob
# For PostgreSQL
BETTER_SEARCH_INDEX_COLUMN_TYPE=bytea
Checkout this page on more information on the different column types: https://orkhan.gitbook.io/typeorm/docs/entities#column-types-for-mysql-mariadb
You can index custom fields of your products by defining a custom mapToSearchDocument function.
For example, we have a custom field keywords on our products, and we want to index it:
import { BetterSearchPlugin, defaultSearchConfig } from '@pinelab/vendure-plugin-better-search';
      BetterSearchPlugin.init({
        mapToSearchDocument: (product, collections) => {
            // Import the default mapping function to get a default search document
          const defaultDocument = defaultSearchConfig.mapToSearchDocument(
            product,
            collections
          );
          const keywords = product.customFields.keywords;
          return {
            ...defaultDocument,
            keywords,
          };
        },
        // Make sure to add `keywords` to the indexable fields, and give it a weight
        indexableFields: {
          ...defaultSearchConfig.indexableFields,
          facetValueNames: 2,
        },
      }),
By default, these fields are indexed with the following weights. Checkout the defaultSearchConfig.ts for more details.
  indexableFields: {
    name: 3,
    slug: 2,
    variantNames: 3,
    collectionNames: 1,
    skus: 2,
  },
FAQs
Vendure plugin for better storefront search, without the need of external systems
The npm package @pinelab/vendure-plugin-better-search receives a total of 19 weekly downloads. As such, @pinelab/vendure-plugin-better-search popularity was classified as not popular.
We found that @pinelab/vendure-plugin-better-search demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.

Research
/Security News
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.