wiki icon indicating copy to clipboard operation
wiki copied to clipboard

Wiki Search not working as expected

Open upccjesse opened this issue 2 years ago • 5 comments

erpnext 14.44.1
frappe 14.52.1
wiki 2.0.0

Wiki pages are published, but not guest accessible.

  • All Wiki page routes are in the form of wiki/page1
  • All Wiki pages are added to a Wiki Space with route wiki
  • In Wiki Settings, the default space is the wiki space

When navigating to a Wiki page, i.e. example.com/wiki/page1, I have the Search Bar present. I can click it and execute a search, but generally I get no results.

  • If I search for Troubleshooting, which I know that there are several pages with with Troubleshooting both in the title and the content of the page, I get no results. (see example 1)
  • If I search for wiki, I get a random assortment of Wiki Page results that I can click on and navigate to, but the results are literally just the route of the page - the title and content are not present in the search results. (see example 2)

Expected Behavior

I expect the search function to show relevant search results for terms that I know are present in the Wiki.

Example 1:

image image image

Example 2:

image image image

Other info

I noticed that Wiki Page was not in the Global Search Settings list, so I added it, but nothing changed.

As far as I can tell, the search path once submitted to the server goes as such:

  1. The HTTP Query contains parameter cmd of wiki.wiki.doctype.wiki_page.search.search which translates to the search function located in wiki/wiki/doctype/wiki_page/search.py
  2. Since I don't have redis enabled in Wiki Settings, it defaults to the Frappe web search. This function calls web_search which is from frappe.search import web_search
  3. This function is defined in the frappe/frappe Git Repository here
  4. This instantiates a new WebsiteSearch object with index_name="web_routes" as its sole parameter, then calls its search function. WebsiteSearch is a wrapper on top of FullTextSearch class, which is where the search function is defined.
  5. This calls a Whoosh searcher to do the actual search. I haven't traced any further than this.

upccjesse avatar Oct 22 '23 00:10 upccjesse

Can you try enabling redis from Wiki Settings and try again? Or try running bench --site <sitename> rebuild-search-index and see if the pages are shown.

BreadGenie avatar Nov 04 '23 15:11 BreadGenie

  1. Does the search index need to be built/rebuilt after every new wiki page is added?

No, the the index for a new wiki page is built whenever it is created. Not sure what exactly is impeding from rebuilding the index.

I tried redis already, no change.

What did you face when redisearch was enabled?

BreadGenie avatar Nov 06 '23 10:11 BreadGenie

Hi, in my case any of this command works for mi. I have a wiki in docker with the last changes.

federicocalvo avatar Jan 11 '24 12:01 federicocalvo