# How to rebuild the search index in the desktop application?

**URL:** <https://discourse.joplinapp.org/t/how-to-rebuild-the-search-index-in-the-desktop-application/29477>\
**Category:** Support\
**Created:** [7 February 2023 17:19 UTC](https://discourse.joplinapp.org/t/how-to-rebuild-the-search-index-in-the-desktop-application/29477 "2023-02-07T17:19:19Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![sergei\_mipt](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@sergei\_mipt](https://discourse.joplinapp.org/u/sergei_mipt)\
**Post date:** [7 February 2023 17:19 UTC](https://discourse.joplinapp.org/t/how-to-rebuild-the-search-index-in-the-desktop-application/29477/1 "2023-02-07T17:19:19Z")

</div>

my database has got broken somehow.

on the picture 1 below it is seen that I have the note titled '[mail.ru](http://mail.ru) webdav'. on the picture 2 below it is seen that as a result of the search query "webdav" the existing note has not been found, that is, search doesn't work as it should.

the note is text-only, small, opens normally in joplin gui, opens normally as a file in the sync target.

i need to rebuild the search index. how can this be done? if not possible using GUI, any command is ok.

i waited for about 6 hours to let the application rebuild the search index in background but the problem remains.

pic1  
 ![image](https://canada1.discourse-cdn.com/flex028/uploads/cozic/original/3X/d/1/d1068a900d40e83ac1822dac7d9f5a289516d819.png)

pic2  
 ![image](https://canada1.discourse-cdn.com/flex028/uploads/cozic/original/3X/d/f/dfa3af8ab595030d9e06e90f968c8cbba91a8f56.png)

LOG  
[log.txt](https://discourse.joplinapp.org/uploads/short-url/eiMwsRlb1irptDCFj4LV2c5L4cI.txt) (27.8 KB)  
(i removed manually the notes body content from the log)

joplin version 2.9.17  
os arch linux

UPDATE  
i successfully rebuilt the index by using the option in gui "delete local data and redownload from sync target". however, it took a very long time since I have 11k notes + 7k resources. so, a method how to rebuild the search index on request without deleting local data would be appreciated.

this is what I had after the fix:  
 ![image](https://canada1.discourse-cdn.com/flex028/uploads/cozic/original/3X/4/a/4ad4aed31415af2854514c81fec454b21d1762d1.png)  
thus, two more notes have appeared: the one called '[mail.ru](http://mail.ru) webdav' and another one called 'joplin webdav'

---

<div class="post-metadata">

**Author:** ![roman\_r\_m](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/roman_r_m/32/3297_2.png) [@roman\_r\_m](https://discourse.joplinapp.org/u/roman_r_m)\
**Post date:** [7 February 2023 20:29 UTC](https://discourse.joplinapp.org/t/how-to-rebuild-the-search-index-in-the-desktop-application/29477/2 "2023-02-07T20:29:57Z")

</div>

You could try to export all your data, delete the profile, and import back again. Not 100% sure if this will rebuild the index though.

---

<div class="post-metadata">

**Author:** ![sergei\_mipt](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@sergei\_mipt](https://discourse.joplinapp.org/u/sergei_mipt)\
**Post date:** [8 February 2023 06:50 UTC](https://discourse.joplinapp.org/t/how-to-rebuild-the-search-index-in-the-desktop-application/29477/3 "2023-02-08T06:50:11Z")

</div>

@roman_r_m hi, Roman. thanks for the advice.  
this is what I did and it fixed the problem.  
however, this is a very costly fix in terms of time i spent (i have 11k notes).

during my evernote times, i had a similar problem: some notes that were in my database could not be retrieved via correct search query. i contacted evernote support and they conducted a rebuild of my search index. the problem had been solved with this.

the conclusion is

1. database sometimes gets corrupted
2. there should be a command the user may execute that rebuilds the index.

by the way, such a command exists, i guess, in the mobile version of joplin. it is called 'fix the search index'.

so, a command a user may run that rebuilds the index would be very helpful, imho

---

<div class="post-metadata">

**Author:** ![kai452](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/kai452/32/22334_2.png) [@kai452](https://discourse.joplinapp.org/u/kai452)\
**Post date:** [11 February 2023 22:03 UTC](https://discourse.joplinapp.org/t/how-to-rebuild-the-search-index-in-the-desktop-application/29477/4 "2023-02-11T22:03:57Z")

</div>

Hi,  
what's about "[DB Browser for SQlite](https://sqlitebrowser.org)"?  
Menu - Tools: There are different points to try

---

<div class="post-metadata">

**Author:** ![sergei\_mipt](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@sergei\_mipt](https://discourse.joplinapp.org/u/sergei_mipt)\
**Post date:** [12 February 2023 09:59 UTC](https://discourse.joplinapp.org/t/how-to-rebuild-the-search-index-in-the-desktop-application/29477/5 "2023-02-12T09:59:45Z")

</div>

@kai452  
hi Kai, thanks for your effort

this is an interesting direction!

i installed both sqlite and sqlitebrowser

i opened the corrupted database (i saved it)

if i query the 'notes' table it finds the missing note:

 ![image](https://canada1.discourse-cdn.com/flex028/uploads/cozic/original/3X/5/2/52e16172d8a192038671c0a2d199e27852b27ab4.png)

if i query the 'notes\_normalized' table it doesn't find the missing note:

 ![image](https://canada1.discourse-cdn.com/flex028/uploads/cozic/original/3X/7/a/7ab24dd506d33f8e39380570d19e509de4572315.png)

so, the problem is possibly with this table 'notes\_normalized', it needs to be rebuilt

another question: i didn't find the index of title vs note\_id (see the pic below). where is it? and how can these be rebuilt from scratch (sqlite command)?

 ![image](https://canada1.discourse-cdn.com/flex028/uploads/cozic/original/3X/9/c/9c32dfd6cd2a5422d094e3ce82f11f7a4cf5899b.png)

UPDATE  
i found out that the missing note with the id 'f3b902b4ff744679a3fa4be65f4b92af' is present in 'notes' table, and is NOT present in 'notes\_normalized' table

---

<div class="post-metadata">

**Author:** ![kai452](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/kai452/32/22334_2.png) [@kai452](https://discourse.joplinapp.org/u/kai452)\
**Post date:** [12 February 2023 11:46 UTC](https://discourse.joplinapp.org/t/how-to-rebuild-the-search-index-in-the-desktop-application/29477/6 "2023-02-12T11:46:27Z")

</div>

Hi Sergei,

You'r welcome.

Most such problems with database are results of broken indexes.  
So the tool will fix the entire database for You.

You asked, how to find the ID for a title:  
The ID is what shown on first picture, table notes, same as the note-ID shown in Joplin self.

To find an ID for a certain title, just insert the search-phrase, also part of it, into the field above header of title:

 ![ktza2TkZn16i3JJo.png](https://canada1.discourse-cdn.com/flex028/uploads/cozic/original/3X/2/4/24cd559b8cbe534d60edcd80478f6e477a98f887.png)

---

<div class="post-metadata">

**Author:** ![sergei\_mipt](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@sergei\_mipt](https://discourse.joplinapp.org/u/sergei_mipt)\
**Post date:** [12 February 2023 13:02 UTC](https://discourse.joplinapp.org/t/how-to-rebuild-the-search-index-in-the-desktop-application/29477/7 "2023-02-12T13:02:34Z")

</div>

@kai452  
Kai, thanks

i am not a database engineer, so, let me explain my problem in plain language:

1. the note with the id 'f3b902b4ff744679a3fa4be65f4b92af' is MISSING in the table 'notes\_normalized' of database.sqlite but is PRESENT in the table 'notes' of database.sqlite.  
this is a bug. how can it be fixed?

2. what should i do to be able to find the note using Joplin GUI (without use of sqlitebrowser)?  
at present, Joplin doesn't work as expected: it doesn't find the note which does exist in the database (in the table 'notes' in database.sqlite as shown in the pic in the previous comment)

---

<div class="post-metadata">

**Author:** ![kai452](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/kai452/32/22334_2.png) [@kai452](https://discourse.joplinapp.org/u/kai452)\
**Post date:** [13 February 2023 06:15 UTC](https://discourse.joplinapp.org/t/how-to-rebuild-the-search-index-in-the-desktop-application/29477/8 "2023-02-13T06:15:16Z")

</div>

Hi Sergei,

if You have already tested the tools insite Sqlite Browser then take this as a new chance:  
[https://joplin-utils.rxliuli.com/web/joplin-batch-web/#/notFoundResource](https://joplin-utils.rxliuli.com/web/joplin-batch-web/#/notFoundResource)

![Mail_Signatur.jpg](https://canada1.discourse-cdn.com/flex028/uploads/cozic/original/3X/d/0/d0fc4bb1b90bf96698a215117a0b475345ecdb62.jpeg)

---

<div class="post-metadata">

**Author:** ![sergei\_mipt](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@sergei\_mipt](https://discourse.joplinapp.org/u/sergei_mipt)\
**Post date:** [13 February 2023 08:57 UTC](https://discourse.joplinapp.org/t/how-to-rebuild-the-search-index-in-the-desktop-application/29477/9 "2023-02-13T08:57:46Z")

</div>

@kai452 Kai, thanks. I'll have a look.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex028/uploads/cozic/original/3X/1/c/1c948e33314e232a0927789508474d8624f4270b.png) [@system](https://discourse.joplinapp.org/u/system)\
**Post date:** [15 March 2023 08:58 UTC](https://discourse.joplinapp.org/t/how-to-rebuild-the-search-index-in-the-desktop-application/29477/10 "2023-03-15T08:58:39Z")

</div>

Closed on 15 March 2023 08:58 UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
