FA Search KitJavaScript

Persian search.
As people type it.

A different letter, a missing half-space, a Persian digit. Small differences shouldn’t hide the content people are looking for.

كتابکتاب هاکتابهایمان
کتاب

Different forms. A shared search term.

Persian text analysisWorks with your search engineOpen source · MIT

A LITTLE SEARCH LAB

Type it your way.

Runs in your browser

Literal text match

0

No matches in this sample collection.

With Persian analysis

1
یادگیری

کتاب‌های برنامه‌نویسی

کتاب‌های برنامه‌نویسی برای یادگیری جاوااسکریپت.

Query terms
کتاب
Original content stays unchanged
What does this example actually compare?

Both sides search the same six sample documents. The left checks for the exact phrase. The right uses the full analyzer with verb lemmas, then requires every query term to match. This is a small teaching example, not a speed test or a comparison with another search engine. Correction suggestions use this collection’s vocabulary and can be wrong.

  • کتاب‌های برنامه‌نویسی
  • شماره کارت بانکی
  • سفر به شیراز
  • راهنمای نویسنده
  • تاریخ شمسی در وردپرس
  • پیگیری سفارش

Try “كتاب”, “16” or “مي روم”. Queries stay in your browser; this demo does not send them to a server.

Same letters. Same search.

Normalize Arabic and Persian letter variants, digit styles and spacing before matching text.

Look past word endings.

Choose stemming, then add the full lexicon for forms such as irregular plurals and verb lemmas.

Keep the text people wrote.

Search with analyzed terms. Show the original spelling, with token offsets available for highlighting.

USED RIGHT HERE

The search behind our Persian docs.

Our Persian documentation uses FA Search Kit with Pagefind: full analysis, a shared setup for indexing and queries, and excerpts from the original text.

Try our Persian docs search

ANALYSIS, THEN SEARCH

Bring your search engine.

FA Search Kit handles Persian text. Your engine still handles indexing, ranking and retrieval. Use an adapter or connect the analyzer to your own search.

Which analysis profile should I use?
light
Normalize and split text into tokens.
standard
Add Persian stemming. The default profile.
full
Add the lexicon for richer word forms. Used in this demo and our docs.
analyzer.jsSame setup on both sides
import { createAnalyzer } from 'fa-search-kit';
import { lexicon } from 'fa-search-kit/lexicon';

const fa = createAnalyzer({
  profile: 'full', lexicon, verbs: 'lemma'
});

// Index and query with the same analyzer.
fa.analyze('کتاب‌های برنامه‌نویسی', { mode: 'index' });
fa.analyze('كتاب', { mode: 'query' }); // ['کتاب']

Use the same profile and options when building the index and analyzing queries.

Try it with your own words.

Currently available from source; not yet published to npm. Follow the installation guide to build the released source.

Read the setup guide