Giter Club home page Giter Club logo

Comments (39)

chewy-chewbacca avatar chewy-chewbacca commented on July 2, 2024 2

Ok, last thing. I figured out the issue as I was putting my config back manually.

if search.enableRelevance is set to true, that is what breaks search. False and it works.

So there's your bug.

from phpmyfaq.

thorsten avatar thorsten commented on July 2, 2024 1

Thanks for the hint, I'll check that!

from phpmyfaq.

thorsten avatar thorsten commented on July 2, 2024 1

It's fixed now, thank you @R0binMast3rs and @chewy-chewbacca for the help!

from phpmyfaq.

thorsten avatar thorsten commented on July 2, 2024

I tested it on my development installation and it works with MariaDB and Elasticsearch enabled and disabled. Do you get any error?

from phpmyfaq.

R0binMast3rs avatar R0binMast3rs commented on July 2, 2024

In /var/log/nginx/error.log are no errors and elastic search support is off. When i switch it on following error occurs. (never used it before)

(ts-wiki =phpMyFAQ)

phpMyFAQ Fatal error

Uncaught exception: 'TypeError'

Message: 'phpMyFAQ\Configuration::getElasticsearch(): Return value must be of type Elastic\Elasticsearch\Client, null returned'

Stack trace:

#0 /var/www/html/ts-wiki/src/phpMyFAQ/Search/Elasticsearch.php(50): phpMyFAQ\Configuration->getElasticsearch()
#1 /var/www/html/ts-wiki/src/phpMyFAQ/Search.php(188): phpMyFAQ\Search\Elasticsearch->__construct()
#2 /var/www/html/ts-wiki/src/phpMyFAQ/Search.php(82): phpMyFAQ\Search->searchElasticsearch()
#3 /var/www/html/ts-wiki/search.php(171): phpMyFAQ\Search->search()
#4 /var/www/html/ts-wiki/index.php(796): require('...')
#5 {main}

Thrown in '/var/www/html/ts-wiki/src/phpMyFAQ/Configuration.php' on line 338

from phpmyfaq.

R0binMast3rs avatar R0binMast3rs commented on July 2, 2024

With elasticsearch on following error occurs in nginx errorlog:

2023/11/06 14:08:14 [error] 888#888: *1819 FastCGI sent in stderr: "PHP message: phpMyFAQ TypeError: phpMyFAQ\Configuration::getElasticsearch(): Return value must be of type Elastic\Elasticsearch\Client, null returned in /var/www/html/t>
Stack trace:
#0 /var/www/html/ts-wiki/src/phpMyFAQ/Search/Elasticsearch.php(50): phpMyFAQ\Configuration->getElasticsearch()
#1 /var/www/html/ts-wiki/src/phpMyFAQ/Search.php(188): phpMyFAQ\Search\Elasticsearch->__construct()
#2 /var/www/html/ts-wiki/src/phpMyFAQ/Search.php(82): phpMyFAQ\Search->searchElasticsearch()
#3 /var/www/html/ts-wiki/search.php(171): phpMyFAQ\Search->search()
#4 /var/www/html/ts-wiki/index.php(796): require('...')
#5 {main}" while reading response header from upstream, client: XXXXXX, server: _, request: "POST /ts-wiki/?action=search HTTP/1.1", upstream: "fastcgi://unix:/run/php/php8.1-fpm.sock:", host: "XXXXXX", referrer: "http://.....

from phpmyfaq.

thorsten avatar thorsten commented on July 2, 2024

Do you have a running Elasticsearch server?

from phpmyfaq.

thorsten avatar thorsten commented on July 2, 2024

I tested it on a fresh installation with only MariaDB and the search is working here as well.

Do you get any errors with Elasticsearch deactivated and DEBUG mode on true?

from phpmyfaq.

R0binMast3rs avatar R0binMast3rs commented on July 2, 2024

No i dont run an elasticsearch server, that`s why i switched it off. ;-)
Where can i find the debugging mode of phpmyfaq?

from phpmyfaq.

thorsten avatar thorsten commented on July 2, 2024

Here it is: https://github.com/thorsten/phpMyFAQ/blob/3.2/phpmyfaq/src/Bootstrap.php#L34

from phpmyfaq.

R0binMast3rs avatar R0binMast3rs commented on July 2, 2024

Okay, i set the debug mode on true and after search this is the output:

DATABASE QUERIES /var/www/html/ts-wiki/src/Bootstrap.php: phpMyFAQ\Configuration->getAll() in line 149: SELECT config_name, config_value FROM faqconfig /var/www/html/ts-wiki/src/phpMyFAQ/User/CurrentUser.php: phpMyFAQ\User->getUserById() in line 516: SELECT user_id, login, account_status, is_superadmin, auth_source FROM faquser WHERE user_id = 1 AND account_status != 'blocked' /var/www/html/ts-wiki/src/phpMyFAQ/User.php: phpMyFAQ\User\UserData->load() in line 799: SELECT last_modified, display_name, email, is_visible, twofactor_enabled, secret FROM faquserdata WHERE user_id = 1 /var/www/html/ts-wiki/src/phpMyFAQ/User/CurrentUser.php: phpMyFAQ\User\CurrentUser->getSessionInfo() in line 526: SELECT session_id, session_timestamp, ip, success FROM faquser WHERE user_id = 1 /var/www/html/ts-wiki/src/phpMyFAQ/User/CurrentUser.php: phpMyFAQ\Permission\MediumPermission->getUserGroups() in line 481: SELECT fg.group_id AS group_id FROM faquser fu, faquser_group fug, faqgroup fg WHERE fu.user_id = 1 AND fu.user_id = fug.user_id AND fg.group_id = fug.group_id /var/www/html/ts-wiki/index.php: phpMyFAQ\Session->checkSessionId() in line 242: SELECT sid FROM faqsessions WHERE sid = 13005 AND ip = 'XX.XX.XX.XX' AND time > 1699264523 /var/www/html/ts-wiki/src/phpMyFAQ/Category.php: phpMyFAQ\Category->getOrderedCategories() in line 108: SELECT fc.id AS id, fc.lang AS lang, fc.parent_id AS parent_id, fc.name AS name, fc.description AS description, fc.user_id AS user_id, fc.group_id AS group_id, fc.active AS active, fc.image AS image, fc.show_home AS show_home FROM faqcategories fc LEFT JOIN faqcategory_group fg ON fc.id = fg.category_id LEFT JOIN faqcategory_order fco ON fc.id = fco.category_id LEFT JOIN faqcategory_user fu ON fc.id = fu.category_id WHERE ( fg.group_id IN (-1, 1) OR (fu.user_id = -1 AND fg.group_id IN (-1, 1))) AND fc.active = 1 AND fc.lang = 'de' GROUP BY fc.id, fc.lang, fc.parent_id, fc.name, fc.description, fc.user_id, fc.group_id, fc.active, fc.image, fc.show_home, fco.position ORDER BY fco.position, fc.id ASC /var/www/html/ts-wiki/src/phpMyFAQ/User.php: phpMyFAQ\User\UserData->get() in line 816: SELECT display_name FROM faquserdata WHERE user_id = 1 /var/www/html/ts-wiki/src/phpMyFAQ/User.php: phpMyFAQ\User\UserData->get() in line 816: SELECT display_name FROM faquserdata WHERE user_id = 1 /var/www/html/ts-wiki/src/phpMyFAQ/Tags.php: phpMyFAQ\Tags->getAllTags() in line 343: SELECT MIN(t.tagging_id) AS tagging_id, t.tagging_name AS tagging_name FROM faqtags t LEFT JOIN faqdata_tags dt ON dt.tagging_id = t.tagging_id LEFT JOIN faqdata d ON d.id = dt.record_id WHERE 1=1 AND d.active = 'yes' GROUP BY tagging_name ORDER BY tagging_name ASC /var/www/html/ts-wiki/src/phpMyFAQ/Tags.php: phpMyFAQ\Tags->getFaqsByTagName() in line 346: SELECT dt.record_id AS record_id FROM faqtags t, faqdata_tags dt LEFT JOIN faqdata d ON d.id = dt.record_id WHERE t.tagging_id = dt.tagging_id AND t.tagging_name = '3080' /var/www/html/ts-wiki/src/phpMyFAQ/Permission/MediumPermission.php: phpMyFAQ\User->getUserById() in line 96: SELECT user_id, login, account_status, is_superadmin, auth_source FROM faquser WHERE user_id = 1 AND account_status != 'blocked' /var/www/html/ts-wiki/src/phpMyFAQ/User.php: phpMyFAQ\User\UserData->load() in line 799: SELECT last_modified, display_name, email, is_visible, twofactor_enabled, secret FROM faquserdata WHERE user_id = 1 /var/www/html/ts-wiki/src/phpMyFAQ/User.php: phpMyFAQ\User\UserData->get() in line 816: SELECT display_name FROM faquserdata WHERE user_id = 1 /var/www/html/ts-wiki/index.php: phpMyFAQ\Faq->getRecordsWithoutPagingByCategoryId() in line 756: SELECT fd.id AS id, fd.lang AS lang, fd.thema AS thema, fcr.category_id AS category_id, fv.visits AS visits FROM faqdata fd LEFT JOIN faqcategoryrelations fcr ON fd.id = fcr.record_id AND fd.lang = fcr.record_lang LEFT JOIN faqvisits fv ON fd.id = fv.id AND fv.lang = fd.lang LEFT JOIN faqdata_group fdg ON fd.id = fdg.record_id LEFT JOIN faqdata_user fdu ON fd.id = fdu.record_id WHERE fd.date_start <= '20231107105523' AND fd.date_end >= '20231107105523' AND fd.active = 'yes' AND fcr.category_id = 0 AND fd.lang = 'de' AND ( fdu.user_id = 1 OR fdg.group_id IN (-1, 1) ) GROUP BY fd.id,fd.lang,fd.thema,fcr.category_id,fv.visits ORDER BY id DESC

from phpmyfaq.

thorsten avatar thorsten commented on July 2, 2024

Could you please run this query on your database:

ALTER TABLE faqdata ENGINE=INNODB

from phpmyfaq.

R0binMast3rs avatar R0binMast3rs commented on July 2, 2024

result: MySQL lieferte ein leeres Resultat zurück (d.h. null Datensätze). (Die Abfrage dauerte 14.4981 Sekunden.)

My old database was mysql and now i switch to MariaDB eventually is this a problem?

from phpmyfaq.

thorsten avatar thorsten commented on July 2, 2024

no, MySQL and MariaDB are compatible. Is the search now working?

from phpmyfaq.

R0binMast3rs avatar R0binMast3rs commented on July 2, 2024

No, unfortunately not. Fresh clean install with empty database works. Eventually its also a rightsmanagement problem, because some faq`s are assigned to groups. I have to test it...

from phpmyfaq.

R0binMast3rs avatar R0binMast3rs commented on July 2, 2024

Eventually a hint - in the developer console of the browser following error shows if you typing any word.
In clean install no message occurs.

Edge search with old database

autocomplete.js:33 Uncaught (in promise) TypeError: fetchedData.filter is not a function
at Object.fetch (autocomplete.js:33:1)
fetch @ autocomplete.js:33
await in fetch (asynchron)
(anonym) @ autocomplete.js:354
setTimeout (asynchron)
startFetch @ autocomplete.js:353
keyupEventHandler @ autocomplete.js:242

Firefox search with old database

Uncaught TypeError: event.target.closest is not a function
highlightStars voting.js:115
voting.js:115
Uncaught (in promise) TypeError: fetchedData.filter is not a function
fetch autocomplete.js:33
debounceTimer autocomplete.js:354
setTimeout handler*startFetch autocomplete.js:353
keyupEventHandler autocomplete.js:242
autocomplete.js:33
fetch autocomplete.js:35
InterpretGeneratorResume self-hosted:1455
AsyncFunctionNext self-hosted:852
(Async: async)
debounceTimer autocomplete.js:354
(Async: setTimeout handler)
startFetch autocomplete.js:353
keyupEventHandler autocomplete.js:242

from phpmyfaq.

thorsten avatar thorsten commented on July 2, 2024

@R0binMast3rs which browser do you use?

from phpmyfaq.

R0binMast3rs avatar R0binMast3rs commented on July 2, 2024

Desktop (please complete the following information):

OS: [e.g. iOS] Windows 10
Browser [e.g. chrome, safari]: Edge Version 116.0.1938.98 and Firefox 115.4.0esr
Version [e.g. 22]

I actually try to copy faqdata table to new database and hope the search will work then.

from phpmyfaq.

chewy-chewbacca avatar chewy-chewbacca commented on July 2, 2024

I have the same issue. Upgraded from 3.1.17 to 3.2.2 and search is broken in the same way. I don't use elasticsearch. Hosted on a Cloudpanel instance (NGINX).

Also - I ran this command to no avail against the faqdata table: ALTER TABLE faqdata ENGINE=INNODB

from phpmyfaq.

thorsten avatar thorsten commented on July 2, 2024

@chewy-chewbacca do you get any errors? Do you have access via phpMyAdmin to your database?

from phpmyfaq.

chewy-chewbacca avatar chewy-chewbacca commented on July 2, 2024

No errors so far as I can find. And yes I have phpMyAdmin. Thanks for the reply, if there's anything you'd like me to do let me know.

from phpmyfaq.

thorsten avatar thorsten commented on July 2, 2024

@chewy-chewbacca @R0binMast3rs

Could you please try to perform these queries on phpMyAdmin:

SELECT fd.id AS id, fd.lang AS lang, fd.solution_id AS solution_id, faqcategoryrelations.category_id AS category_id, fd.thema AS question, fd.content AS answer FROM faqdata AS fd LEFT JOIN faqcategoryrelations ON fd.id = faqcategoryrelations.record_id AND fd.lang = faqcategoryrelations.record_lang WHERE MATCH (fd.thema, fd.content, fd.keywords) AGAINST ('test' IN BOOLEAN MODE) AND fd.lang = 'de' AND fd.active = 'yes'

Please replace "test" with a word that you have in the FAQ, also if the language "de" doesn't fit for you.

If the query doesn't work, please try the fallback:

SELECT fd.id AS id, fd.lang AS lang, fd.solution_id AS solution_id, faqcategoryrelations.category_id AS category_id, fd.thema AS question, fd.content AS answer FROM faqdata AS fd LEFT JOIN faqcategoryrelations ON fd.id = faqcategoryrelations.record_id AND fd.lang = faqcategoryrelations.record_lang WHERE (fd.thema LIKE '%test%' OR fd.content LIKE '%test%' OR fd.keywords LIKE '%test%') AND fd.lang = 'de' AND fd.active = 'yes'

Please replace "test" with a word that you have in the FAQ, also if the language "de" doesn't fit for you.

Thank you!

from phpmyfaq.

chewy-chewbacca avatar chewy-chewbacca commented on July 2, 2024

I get good identical results from phpMyAdmin with both queries. One thing I'll mention... I use a prefix for my tables (phpmyfaq99[tablename]). Could that pose an issue?

from phpmyfaq.

R0binMast3rs avatar R0binMast3rs commented on July 2, 2024

Sry for late response, have to do a lot at the moment.

First query... 0 results.

Second query 24 results and works.

I have tried to copy faqdata (and dependent tables) to new database and seems to work, but realy hard way to update an installation.

from phpmyfaq.

thorsten avatar thorsten commented on July 2, 2024

Does the first query also work on the "new" installation?

from phpmyfaq.

R0binMast3rs avatar R0binMast3rs commented on July 2, 2024

Sry, i have to correct myself both queries work on updated installation and new installation.

I have following error message in the development eviroment from the Edge Browser appears if i select the search box and try to search in the updated version:

autocomplete.js:33 Uncaught (in promise) TypeError: fetchedData.filter is not a function at Object.fetch (autocomplete.js:33:1)

In new installation no error occurs.

from phpmyfaq.

R0binMast3rs avatar R0binMast3rs commented on July 2, 2024

In the updated version the "logs" folder in the phpmyfaq root directory doesnt exist and throw an error in development enviroment:
`phpMyFAQ Fatal error
Uncaught exception: 'UnexpectedValueException'

Message: 'There is no existing directory at "/var/www/html/ts-wiki/logs" and it could not be created: Permission denied'`
ts-wiki=phpmyfaq

Created this folder and now is there an log file with content:
[2023-11-22T14:27:43.809327+01:00] phpmyfaq.ERROR: Search exception: Can't find FULLTEXT index matching the column list [] []

from phpmyfaq.

chewy-chewbacca avatar chewy-chewbacca commented on July 2, 2024

I'll add I have the same log entries

[2023-11-16T22:48:17.004873+01:00] phpmyfaq.ERROR: Search exception: Can't find FULLTEXT index matching the column list [] []
[2023-11-16T22:53:35.651814+01:00] phpmyfaq.ERROR: Search exception: Can't find FULLTEXT index matching the column list [] []
[2023-11-16T23:30:02.522398+01:00] phpmyfaq.ERROR: Search exception: Can't find FULLTEXT index matching the column list [] []
[2023-11-16T23:30:02.974030+01:00] phpmyfaq.ERROR: Search exception: Can't find FULLTEXT index matching the column list [] []
[2023-11-16T23:30:03.659015+01:00] phpmyfaq.ERROR: Search exception: Can't find FULLTEXT index matching the column list [] []
[2023-11-16T23:35:00.504350+01:00] phpmyfaq.ERROR: Search exception: Can't find FULLTEXT index matching the column list [] []
[2023-11-16T23:35:00.720295+01:00] phpmyfaq.ERROR: Search exception: Can't find FULLTEXT index matching the column list [] []
[2023-11-17T16:43:02.493584+01:00] phpmyfaq.ERROR: Search exception: Can't find FULLTEXT index matching the column list [] []
[2023-11-18T05:10:19.541460+01:00] phpmyfaq.ERROR: Search exception: Can't find FULLTEXT index matching the column list [] []
[2023-11-18T05:10:24.091812+01:00] phpmyfaq.ERROR: Search exception: Can't find FULLTEXT index matching the column list [] []

from phpmyfaq.

thorsten avatar thorsten commented on July 2, 2024

Please try this query:

ALTER TABLE faqdata ADD FULLTEXT (keywords, thema, content);

from phpmyfaq.

chewy-chewbacca avatar chewy-chewbacca commented on July 2, 2024

Tried that, but the index already existed, so it added another. Then I dropped all indexes and re-ran the command. No change unfortunately.

I get the same error as previously in the log.

from phpmyfaq.

thorsten avatar thorsten commented on July 2, 2024

That's weird.

from phpmyfaq.

chewy-chewbacca avatar chewy-chewbacca commented on July 2, 2024

Here's a show create table if that's of any help below.

CREATE TABLE `phpmyfaq99faqdata` (
  `id` int NOT NULL,
  `lang` varchar(5) NOT NULL,
  `solution_id` int NOT NULL,
  `revision_id` int NOT NULL DEFAULT '0',
  `active` char(3) NOT NULL,
  `sticky` int NOT NULL,
  `keywords` text,
  `thema` text NOT NULL,
  `content` longtext,
  `author` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `comment` char(1) DEFAULT 'y',
  `updated` varchar(15) NOT NULL,
  `date_start` varchar(14) NOT NULL DEFAULT '00000000000000',
  `date_end` varchar(14) NOT NULL DEFAULT '99991231235959',
  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `notes` text,
  PRIMARY KEY (`id`,`lang`),
  FULLTEXT KEY `keywords` (`keywords`,`thema`,`content`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3

from phpmyfaq.

thorsten avatar thorsten commented on July 2, 2024

@chewy-chewbacca that's the standard CREATE query, it looks the same on my test containers

from phpmyfaq.

chewy-chewbacca avatar chewy-chewbacca commented on July 2, 2024

I deleted all my tables, got rid of the prefix, reimported, modified database config in phpMyFAQ. No change, just letting you know.

Tried searching in the admin and got this.

phpMyFAQ Fatal error
Uncaught exception: 'mysqli_sql_exception'

Message: 'Can't find FULLTEXT index matching the column list'

Stack trace:

#0 /src/phpMyFAQ/Database/Mysqli.php(308): mysqli->query()
#1 /src/phpMyFAQ/Search/Database/Mysqli.php(95): phpMyFAQ\Database\Mysqli->query()
#2 /admin/record.show.php(173): phpMyFAQ\Search\Database\Mysqli->search()
#3 /admin/index.php(343): require('...')
#4 {main}
Thrown in '/src/phpMyFAQ/Database/Mysqli.php' on line 308

from phpmyfaq.

R0binMast3rs avatar R0binMast3rs commented on July 2, 2024

Please try this query:

ALTER TABLE faqdata ADD FULLTEXT (keywords, thema, content);

No change like @chewy-chewbacca said. Same errors.

Like i said.. clean install and copy tables with drop table in phpmyadmin and it works.
Before update i have mysql and then mariaDB and new phpversion (7->8) also from apache to nginx... eventually this is an Problem?

from phpmyfaq.

chewy-chewbacca avatar chewy-chewbacca commented on July 2, 2024

I ended up starting over like @R0binMast3rs. I kept the setup-based faqconfig table and reimported all the others. Search is working now.

from phpmyfaq.

chewy-chewbacca avatar chewy-chewbacca commented on July 2, 2024

I will note that I can't seem to save any configuration entries with the admin interface, so I have to go to SQL to change stuff.

from phpmyfaq.

chewy-chewbacca avatar chewy-chewbacca commented on July 2, 2024

And also, clearing my cookies made the configuration page work again. I'm happy and everything's working great!

Thank you both, @thorsten @R0binMast3rs

from phpmyfaq.

R0binMast3rs avatar R0binMast3rs commented on July 2, 2024

Thanks to you @chewy-chewbacca that`s it.... Disabling search.enableRelevance and search works on my updated installation too.

from phpmyfaq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.