Posted by Dan Saadati, Software Engineer, and Hanaa ElAzizi, Technical Program Manager

Introducing AppSearch in Jetpack, now out there in Alpha. AppSearch is an on-device search library which supplies excessive efficiency and feature-rich full-text search performance.

With AppSearch, your utility can:

  • Offer offline search capabilities as AppSearch information lives utterly on-device.
  • Have decrease latency for indexing and querying over giant information units in comparison with SQLite, resulting from decrease I/O use.
  • Provide related search outcomes with built-in scoring methods, corresponding to BM25F.
  • Provide multi-language help for textual content search.
  • Issue a single question to retrieve information of a number of information varieties in comparison with issuing one question per information kind in SQLite.

In AppSearch, it is advisable to create a database to handle structured information, known as “documents”. You then outline what the construction appears to be like like utilizing “schema types”. For occasion, you’ll be able to mannequin a message as a schema kind with properties corresponding to topic, physique, and sender.

Documents which might be added to your database could be queried over. Querying for “body:fruit” will retrieve all paperwork with the time period “fruit” within the “body” of the Message.

Diagram illustrating the indexing of grocery list items in AppSearch, and searching for those items later

Diagram illustrating indexing and looking out inside AppSearch

To showcase how an utility may combine AppSearch, take this instance of a grocery record utility. Users can add grocery gadgets to their record to check with after they’re out buying. Since AppSearch presents multi-language help by default, customers also can embody specialty components for his or her international recipes. Users add an merchandise by typing within the identify and deciding on the shop and class it belongs to. The person can search by merchandise identify and choose filters for retailer or class. AppSearch will return matching outcomes for the appliance to show.

Ready to dive into utilizing AppSearch to complement your app’s search performance? Check out the AppSearch information and begin utilizing it in your app.

Help us make the library higher: give us suggestions on belongings you like, and points or options you want to see. If you discover a bug or situation, be at liberty to file a problem.