ElkArte Community

Project Support => Support => Topic started by: b4pjoe on December 03, 2014, 06:18:29 pm

Title: Search not working
Post by: b4pjoe on December 03, 2014, 06:18:29 pm
If I try to do a search at my forum and tell it to "Search in topic subjects only" as shown in the attached image I never get any results returned. It always just says "No results found" even if I know what I am searching for is in the topic subject. Is this a known issue or only happening on my forum?
Title: Re: Search not working
Post by: Spuds on December 03, 2014, 08:07:54 pm
Not a known problem to me.  

What search method are you using? (admin->forum->search->search method) and what options have you enabled there?
Title: Re: Search not working
Post by: b4pjoe on December 03, 2014, 11:24:25 pm
Here is a screenshot of my settings.

I did try the search here at this forum and it seems to work OK. But not in mine.
Title: Re: Search not working
Post by: TE on December 04, 2014, 12:38:03 am
@b4pjoe : can you test this sql query via phpMyAdmin please?

Code: [Select]
CREATE TEMPORARY TABLE tmp (test INT(4));
IIRC many search issues are related to the mysql permission "create temporary tables".
Title: Re: Search not working
Post by: Jorin on December 04, 2014, 01:44:18 am
I remember that. Lightyears before ElkArte. ;D
Title: Re: Search not working
Post by: b4pjoe on December 04, 2014, 02:53:23 pm
Quote from: TE – @b4pjoe : can you test this sql query via phpMyAdmin please?

Code: [Select]
CREATE TEMPORARY TABLE tmp (test INT(4));
IIRC many search issues are related to the mysql permission "create temporary tables".

I ran the query. Attached image is the result in phpMyAdmin. Tried the search again and still get the "No results found" message.
Title: Re: Search not working
Post by: emanuele on December 04, 2014, 03:42:14 pm
Can you give an example of a word you are trying to search?
Title: Re: Search not working
Post by: b4pjoe on December 04, 2014, 04:42:08 pm
weather

And yes there is a topic with "weather" in the title.

Just testing a little further...

I have boards that are visible to guests, boards that are only visible to registered users, and other boards that are only available to users that are in a group called "Social Members". It appears the search is only failing if the topic is in one of the boards that are only available to the members of the "Social Members" group. So I assume this may have to do with board permissions. Haven't had a chance to investigate any further. I know in SMF it was working across all groups.
Title: Re: Search not working
Post by: b4pjoe on December 04, 2014, 06:34:26 pm
After some more testing...if I search for a term that is the title of a topic that is accessible to guests the search works but if it is a topic that guests can't see the search fails.
Title: Re: Search not working
Post by: b4pjoe on December 05, 2014, 11:08:30 am
Looking through permissions I'm not finding anything that will fix this. Can someone tell me if the search here at this forum will search topic subjects that are not visible to guests and actually find them. I can search on the exact name of a topic and if it isn't visible to guests it will not find it.
Title: Re: Search not working
Post by: radu81 on December 05, 2014, 11:22:58 am
Quote from: b4pjoe – After some more testing...if I search for a term that is the title of a topic that is accessible to guests the search works but if it is a topic that guests can't see the search fails.
Same for me
Title: Re: Search not working
Post by: Spuds on December 05, 2014, 11:29:55 am
I did some quick testing for a word that I know is only on a board that guests can't see but I can.

Searched under my id, word was found
Searched under a standard id, word was not found
Searched as a guest and it was not found

So that seems correct, one note is that the word was also in the body of the text, but I only searched on subject.  Is the word you are searching for solely in the subject?  Is it just that word or are there multiple examples of the behavior (just want to rule out that some special character did not get stuck in the word)

ETA: while typing I see a "me too" response, so not sure maybe @emanuele has some ideas of how to debug this
Title: Re: Search not working
Post by: Jorin on December 05, 2014, 11:34:32 am
Sorry, works at my 1.0.1.

I made two boards visible only for members, not guests. In one of this boards exists a topic named "Zukunftsgestaltung".

1. If I search as a guest, I can't find this topic. As it should be.

2. If I search as a member who has access to this board (and the topic within) the search finds this topic.

See the attachments.
Title: Re: Search not working
Post by: radu81 on December 05, 2014, 12:17:45 pm
I tried on my smf forum  and it was not working... my mistake, there was a typo error in my search  O:-)

here is a screenshot. sorry again
Title: Re: Search not working
Post by: emanuele on December 05, 2014, 02:29:23 pm
I think I can confirm it on my forum as well with at least 1 word: "Regolamento".

Sorry, something happened, I have to repeat the tests.

It's an import from 1.1.
The word appears in the body of about 58 messages and in the subject of at least three, two in open boards, one in a moderators-only board. Additionally, one of these three topics has the word in the body too, while the other two not.

In a "normal" search (i.e. "subject only" option NOT set) the search returns 58 messages: all those that have the word in the body, the two where the word appears only in the subject are not found.
If I search only in the subject the topics are not returned.
Even restricting the search only to the board, no results are returned.

I tried with no index, fulltext index, custom index and with enabled or disabled "match whole words only".
In order to exclude some placement effect I posted three additional topics with subjects: "regolamento test", "test regolamento", "test regolamento test".
Not a single result.


Spuds, if you have any suggestion on how to debug it, let me know. In the meantime I'll try to log the queries run.
Title: Re: Search not working
Post by: emanuele on December 05, 2014, 02:43:18 pm
@b4pjoe can you try admin > maintenance > routine > "find and repair any error"?
It may simply be that the log_search_subjects table has not been populated during the conversion...
Title: Re: Search not working
Post by: b4pjoe on December 05, 2014, 03:06:38 pm
Quote from: emanuele – @b4pjoe can you try admin > maintenance > routine > "find and repair any error"?
It may simply be that the log_search_subjects table has not been populated during the conversion...

Emanuele...that seems to have fixed it. It showed a lot of errors and I clicked it to fix them and the search now finds those topics when I search as an admin or as a member of that group. Thank you!
Title: Re: Search not working
Post by: emanuele on December 05, 2014, 03:26:08 pm
You are welcome! :D
It may be worth adding the check to a scheduled task...
Title: Re: Search not working
Post by: TE on December 06, 2014, 01:13:21 am
Was it an imported board? Maybe we should add that task to the importer..
Title: Re: Search not working
Post by: emanuele on December 06, 2014, 04:25:16 am
That was another option I thought, the nuisance with adding it to the importer is code duplication, unless we start to rely on the destination forum for some functions (if it is possible).
Title: Re: Search not working
Post by: b4pjoe on December 07, 2014, 02:32:54 pm
Quote from: TE – Was it an imported board? Maybe we should add that task to the importer..

Yes, all of my boards were imported over from SMF and I haven't created any new ones since then.
Title: Re: Search not working
Post by: nwsw on January 24, 2015, 07:11:08 am
Quote from: emanuele – try admin > maintenance > routine > "find and repair any error"?

Thanks for this. I was just starting to debug my imported test forum's completely broken search function. This is now part of my SOP when upgrading.
Title: Re: Search not working
Post by: emanuele on January 24, 2015, 07:55:01 am
Yup.
I wonder if the importer/upgrader should try itself to do a "find and repair errors" just before starting the process.
Title: Re: Search not working
Post by: nwsw on January 24, 2015, 08:42:51 am
A message/link in the final confirmation would be a simple step. In the generic sense, each target platform might require different "post import" steps that could be referenced in the confirmation.
Title: Re: Search not working
Post by: Joshua Dickerson on January 26, 2015, 08:28:36 pm
Quote from: emanuele – Yup.
I wonder if the importer/upgrader should try itself to do a "find and repair errors" just before starting the process.
I think a link recommending that it be done and ask if you would like to do it now. Then, at the end, do another check and list out any issues that come up.