itemsapi / itemsjs

Extremely fast faceted search engine in JavaScript - lightweight, flexible, and simple to use

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chinese text filtering does not work

isaac-manubag opened this issue · comments

Tried using this

const [testProducts] = useState(
    ItemsJs([
      {
        id: 1,
        name: "安积 ASAKA THE FIRST  单一麦芽威士忌 700 M L",
      },
      {
        id: 2,
        name: "麦卡伦18年双桶单一麦芽威士忌 700 M L",
      }
    ], {
      sortings: {
        nameasc: {
          field: 'name',
          order: 'asc',
        },
      },
      searchableFields: ['name'],
    })
  );

  console.log('test1', testProducts.search({
    per_page: 100,
    sort: 'nameasc',
    query: '麦芽威士忌',
  }));
  console.log('test2', testProducts.search({
    per_page: 100,
    sort: 'nameasc',
    query: 'ASAKA',
  }));
  console.log('test3', testProducts.search({
    per_page: 100,
    sort: 'nameasc',
    query: '700',
  }));

test 1 does not return any results
test 2 shows 1 result as expected
test 3 shows 2 result as expected

commented

Hi @isaac-manubag

ItemsJS uses LunrJS to index your dataset, and LunrJS doesn't support the Chinese language.

Hi @isaac-manubag

ItemsJS uses LunrJS to index your dataset, and LunrJS doesn't support the Chinese language.

Thanks @Ruitjes
I was able to get a workaround with minisearch, it'll have to do for now until we find other solution