grav-plugin-tntsearch icon indicating copy to clipboard operation
grav-plugin-tntsearch copied to clipboard

With update to Grav 1.7.22, TNTSearch now appears to fail when you type in an entire word/string

Open fseesink opened this issue 3 years ago • 6 comments

So was tinkering with TNTSearch recently, and all was working well. In fact, a bit TOO well. 😀 The default filter for TNTSearch (- [email protected]) has it index ALL the pages on the site, which in my case had it indexing draft pages I wasn't showing in the menu (since they were drafts and not done yet). So someone could search the site and find posts that weren't really done yet.

So I tinkered with the filter so it only indexed my blog posts and root pages. That all worked fantastically. All this while I was using Grav 1.7.18, then 1.7.20, then 1.7.21. (I've been dealing with other issues related to those.)

Then today, with the updates to Grav 1.7.22 and Admin Panel 1.10.22, I noticed the same search pattern I'd used before wasn't finding both blog posts it found before. And I KNOW the pattern exists in both.

Digging further, what I found was that it would show search results as you typed in a search word like "today"... "t"... "to"..."tod"... dynamically updating as you'd expect. But the moment you typed the last letter in the word ("y" in the case of "today"), suddenly no results! This was not the case just the other day. This is why I mention Grav 1.7.22.

I've tried a few other strings I know to exist, and the same thing is happening with them as far as I can tell. It's ok searching a partial string/word, but the moment you enter the whole thing, it's as if things no longer match. Very odd.

fseesink avatar Sep 17 '21 18:09 fseesink

I should mention I have reindexed the pages to see if that would fix it. It did not.

Hmmm. This seems odd. Seems it's giving sporadic results depending on the word chosen.

Ok, examples:

  • If I search using string today, it shows correct results until I type "y". Then it shows nothing.
  • Similarly, if I search for welcome, same thing. It shows results until I type final "e", then nothing.
  • If I search using string 9/11, before it showed correct results. Now it does not. It's finding "11" now in a post, but that is it.
  • If I search using giving, it shows results once I type "giv", but the moment I type the 2nd "i", all results disappear. And they stay gone as I type the rest of the characters.
  • If I search using background, it works just fine.
  • If I search using gantry, the results keep changing. With "gan" and "gant" it finds one entry. With "gantr" it jumps to 3. With "gantry", it also shows 3, but 2 are different from when it was just "gantr". Go figure. But clearly it is NOT showing all the pages with "gantry" in them.

fseesink avatar Sep 17 '21 19:09 fseesink

Oh, and this is up-to-date running TNT Search v3.3.1.

fseesink avatar Sep 17 '21 19:09 fseesink

Unfortunately tntsearch 3.3.1 release still doesn't include latest changes. Check if this solution helps.

ViliusS avatar Oct 26 '21 17:10 ViliusS

Having the same issue here.

It seems to be almost random as to how many results you get but it does suddenly dramatically reduce the results shown. Sometimes if I put in the full word I get one result but usually it is none. With the first few characters it works without any issues.

Is there any update on when a fix for this might be released as we may otherwise have to come up with another solution.

josh-attwood avatar Nov 16 '21 10:11 josh-attwood

Disabled stemmer from grav admin and did a re-index and things seem to be fixed

josh-attwood avatar Nov 16 '21 10:11 josh-attwood

Just now getting caught up on this. Following what @josh-attwood wrote, I went into Grav Admin | Plugins | TNT Search, and changed the setting of Stemmer: from Default (English) to Disabled and saved it. Then cleared cache and re-indexed.

Doing the same tests as before, I am definitely seeing better (though not perfect) results. So this may well be part of the issue.

Interestingly enough, while most searches appear to work properly--starting to show results after typing just 3 characters and narrowing down the more characters you type--the last one gantry does not. If I type gan or gant I get 1 result, gantr or gantry I get 3. Go figure.

The results, though not entirely right, are consistent. That is, if I repeat the tests, I get the same results each time.

I also observed an odd behavior in that while testing the word gantry, as I typed each character, on a few occasions it seemed like the letter I typed was removed. There seems to be an interplay between typing and updating which can get in the way. But this is minor vs. the search not finding what's expected.

But it is a definite improvement over what it was before. So thanks @josh-attwood for that.

fseesink avatar Nov 20 '21 16:11 fseesink