Various search bugs, mostly related to "search titles only"

MaximilianKohler

Active member
Affected version
2.2.13
I'm using:

I tested after disabling both of them and it still occurs.

First bug:​

200-character search limit? I get "Please enter a value using 200 characters or fewer" on my forum but not on Xenforo (here).

It's a problem if it says "no results found" since someone would give up on the search in that case. Whereas, if it's accurately informing us that we simply need to reduce the character count, then we can do that and find our results.

Second bug:​

I submitted a thread on my forum with this title: "Microbiota from young mice counteracts selective age-associated behavioral deficits (Aug 2021, FMT)"

Addons disabled, search title only:
addons disabled - title only.webp

Addons enabled, search title only:
search titles.webp


Addons disabled/enabled, search whole forum:
addons disabled - forum search.webp

I also disapprove of that "from, age, associated" being not included.
 
A search for "probiotic" doesn't include results for "probiotics".

"fda probiotics" titles only:
fda probiotics.jpg

"fda probiotic" titles only:
fda probiotic.jpg

I thought the "FDA wasn't included because it was too short" was a bug since it was bolded in the results, but when I only type in "FDA" I get:
Forum could not perform a search!
The search could not be completed because the search keywords were too short, too long, or too common.

I also read somewhere that you can change the minimum characters in search, but I can't find that option anywhere in the ACP when typing in "search" to the search bar, even though all options under "Quick search content types" are checked, and it has a whole section in /admin.php?options/groups/searchOptions/.

I changed "Search minimum word length" from 4 to 3 and I get:
Search results for query: fda
No results found.
Same for "search titles".

And when I search "fda probiotic" I still get the same results and notice:
The following words were not included in your search because they are too short, too long, or too common: fda

I see under "Search minimum word length" it says:
This is the minimum length of a word that can be searched by the index. With the default search system, this should correspond with the MySQL full text minimum word length (normally 4).
But there's no option or info on changing that.

When I search "mysql" in the ACP I only get the results on that same page:
mysql search.jpg

Presumably it requires us to change the "MySQL full text minimum word length" somehow, but IMO changing the "Search minimum word length" option should automatically do it, especially since there's not another option there for it.
 
You need to change it in mysql on ther server after changing the option value in XF.
That's not something you can do from within XF.

Once the min length has been changed you need to rebuild the search index.
 
Are you saying that it's not possible currently, or not possible ever? If it's simply an option/capability that is currently not in the ACP then I think it needs to be added there.

I can't find it in the db:

SQL:
mysql

SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| myforum            |
| information_schema |
| mysql              |
| performance_schema |
| pgo_train          |
+--------------------+

use myforum;
SHOW TABLES;

| xf_search                             |
| xf_search_forum                       |
| xf_search_forum_cache                 |
| xf_search_forum_cache_user            |
| xf_search_index                       |

SHOW COLUMNS FROM xf_search;
+--------------------+----------------------+------+-----+---------+----------------+
| Field              | Type                 | Null | Key | Default | Extra          |
+--------------------+----------------------+------+-----+---------+----------------+
| search_id          | int(10) unsigned     | NO   | PRI | NULL    | auto_increment |
| search_results     | mediumblob           | NO   |     | NULL    |                |
| result_count       | smallint(5) unsigned | NO   |     | NULL    |                |
| search_type        | varchar(25)          | NO   |     | NULL    |                |
| search_query       | varchar(200)         | NO   |     | NULL    |                |
| search_constraints | mediumblob           | NO   |     | NULL    |                |
| search_order       | varchar(50)          | NO   |     | NULL    |                |
| search_grouping    | tinyint(3) unsigned  | NO   |     | 0       |                |
| user_results       | mediumblob           | NO   |     | NULL    |                |
| warnings           | mediumblob           | NO   |     | NULL    |                |
| user_id            | int(10) unsigned     | NO   |     | NULL    |                |
| search_date        | int(10) unsigned     | NO   | MUL | NULL    |                |
| query_hash         | varchar(32)          | NO   | MUL |         |                |
| sv_debug_info      | longtext             | YES  |     | NULL    |                |
+--------------------+----------------------+------+-----+---------+----------------+

SHOW COLUMNS FROM xf_search_forum;
+-----------------------+----------------------+------+-----+----------------+-------+
| Field                 | Type                 | Null | Key | Default        | Extra |
+-----------------------+----------------------+------+-----+----------------+-------+
| node_id               | int(10) unsigned     | NO   | PRI | NULL           |       |
| search_criteria       | mediumblob           | NO   |     | NULL           |       |
| sort_order            | varchar(25)          | NO   |     | last_post_date |       |
| sort_direction        | varchar(5)           | NO   |     | desc           |       |
| max_results           | smallint(5) unsigned | NO   |     | 200            |       |
| cache_ttl             | int(10) unsigned     | NO   |     | 10             |       |
| discussion_count      | int(10) unsigned     | NO   |     | 0              |       |
| message_count         | int(10) unsigned     | NO   |     | 0              |       |
| last_post_id          | int(10) unsigned     | NO   |     | 0              |       |
| last_post_date        | int(10) unsigned     | NO   |     | 0              |       |
| last_post_user_id     | int(10) unsigned     | NO   |     | 0              |       |
| last_post_username    | varchar(50)          | NO   |     |                |       |
| last_thread_id        | int(10) unsigned     | NO   |     | 0              |       |
| last_thread_title     | varchar(150)         | NO   |     |                |       |
| last_thread_prefix_id | int(10) unsigned     | NO   |     | 0              |       |
+-----------------------+----------------------+------+-----+----------------+-------+

SHOW COLUMNS FROM xf_search_index;
+---------------+------------------+------+-----+---------+-------+
| Field         | Type             | Null | Key | Default | Extra |
+---------------+------------------+------+-----+---------+-------+
| content_type  | varchar(25)      | NO   | PRI | NULL    |       |
| content_id    | int(10) unsigned | NO   | PRI | NULL    |       |
| title         | varchar(250)     | NO   | MUL |         |       |
| message       | mediumtext       | NO   |     | NULL    |       |
| metadata      | mediumtext       | NO   |     | NULL    |       |
| user_id       | int(10) unsigned | NO   | MUL | 0       |       |
| item_date     | int(10) unsigned | NO   |     | NULL    |       |
| discussion_id | int(10) unsigned | NO   |     | 0       |       |
+---------------+------------------+------+-----+---------+-------+


use mysql;
SHOW TABLES;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| column_stats              |
| columns_priv              |
| db                        |
| event                     |
| func                      |
| general_log               |
| global_priv               |
| gtid_slave_pos            |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| index_stats               |
| innodb_index_stats        |
| innodb_table_stats        |
| plugin                    |
| proc                      |
| procs_priv                |
| proxies_priv              |
| roles_mapping             |
| servers                   |
| slow_log                  |
| table_stats               |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| transaction_registry      |
| user                      |
+---------------------------+

EDIT - directions for changing the MySQL full-text minimum word length: https://xenforo.com/community/threads/change-minimum-search-keyword.153405/post-1655953
 
Last edited:
XF has no abiltity to modify the mysql.cnf file.

You should contact your host if you don't know how to tune mysql.
 
Top Bottom