What could be causing MySQL to return a negative result when matching against columns?

Recently, I discovered the amazing benefits of using MySQL's match against, but encountered some unexpected issues.

I noticed that when the joined table2 has no paired rows, MySQL's match against function returns a negative value for the join column with a NULL value. However, if I remove this NULL column from the match group, it returns a positive relevance value instead. Why does having one NULL column cause the entire match to return -2?

select *, match(t1.column1, t1.column2, t1.column3, t1.column4, t2.column5) against ('search string' in boolean mode) as relevance
from table1 t1
left join table2 t2 on (t2.id = t2.column_id)
/*having relevance > 0*/
order by relevance desc;

Answer №1

It seems likely.

How do search texts with the operator '-' or '+' affect results?

Relevance may become negative only when using the '-' operator in your search text

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The fatal error encountered was completely unexpected: an Uncaught UnexpectedValueException was thrown due to the server returning an unprecedented value. The anticipated response was "HTTP/1.1 101", but instead, an

I am completely new to using socketIO and elephantIO. Currently, I'm attempting to emit data from a PHP file called "emit_test.php" to a node server. Here's the code snippet I've been working with: ini_set("display_errors",5); include ("v ...

Turn off the custom CSS section in the WordPress Customizer for WordPress themes

Looking for assistance in locking or disabling the Appearance -> Customizer -> Additional CSS area on Wp-admin. I have referred to this codex: https://codex.wordpress.org/Theme_Customization_API. However, I couldn't find any hook or function to disab ...

What is the best way to verify a value is present in a MySQL column?

How can I go about selecting all rows from a database where the display column is 'Y' and the announcement column is not null? What method can I use to verify that a column has a value? $qry = "select * from school where dis ...

What is the best way to redirect the /register endpoint in Laravel to my single page application (SPA) application

I am seeking assistance with my SPA development in Vue. Currently, the login page serves as the root page. Route::get('/', function () { return view('auth.login'); }); Auth::routes(); Route::get('/home', 'HomeContro ...

AJAX exclusively retrieves values for the final form in the list

I've been using AJAX to automatically update text inputs and textareas while saving them to the database. Everything was working perfectly until I encountered an issue when there were duplicate forms on the page. After checking with console.log(data), ...

Include a hyperlink in an email using PHP

I am currently using an HTML form textarea along with PHP to send emails through my website. My question is, how can I successfully insert a link into the email message body? I attempted to do it like this: <a href="http://www.xxxxx.com/">Visit the ...

"What is the method for generating a composite message and delivering it as an XML response in SoapServer

I am currently in the process of setting up a SOAP web service that is supposed to return a composite message. An example of a valid instance of this message looks like the following: <dl190Response xmlns="http://pse/"> <cdhead cisprik="556 ...

Having difficulty enabling mod_rewrite for URLs in XAMPP on Windows 8

Despite numerous attempts to configure URL rewriting, I have been unsuccessful. After extensive Google searches and trying various codes found on Stack Overflow, none of them seem to work for me. At this point, I am compelled to seek assistance. I aspire ...

Redirecting pages using an Ajax script in JavaScript

Unfortunately, I am unable to use a *.php extension for my page due to unforeseen circumstances. This has led me to consider using *.html instead and implementing conditional redirection using javascript/Ajax to call a PHP script that can evaluate the cond ...

Double Checkbox

My current project involves creating an update page, and I have successfully completed most of it except for the checkbox section. Strangely, the checkboxes are being duplicated, and I haven't been able to identify the reason behind this issue yet. Th ...

Update the final element in every row of a two-dimensional array with the result of multiplying all other elements in the row except for the last one

Array ( [0] => Array ( [0] => 4 [1] => 3 [2] => 5 [3] => 7 [4] => 210 ) [1] => Array ( [0] => 4 [1] => 9 [2] => 5 [3] => 7 [4] => 210 ) [2] => Array ( [0] => 4 [1] => 9 [2] => 25 [3] => 7 [4] => 210 ...

Exploring data retrieval with pivot table in Laravel 4 by implementing a where condition on pivot relationships

How do I retrieve data using belongsToMany relationship models? Table tags - id - name ... Table photo_entries - id ... Table photo_entry_tag - id - tag_id - photo_entry_id Tag.php public function photo_entry() { return $this->b ...

Guide on automatically attaching a file to an input file type field from a database

Currently, I am implementing a PHP file attachment feature to upload files. Upon successful upload, the system stores the filename with its respective extension in the database. The issue arises when trying to retrieve and display all entries from the ...

What is the process for utilizing jQuery and ajax to retrieve data from a MySQL database?

I am currently working on a form that includes a "select" box. The goal is to display the relevant records from the database on the same page once an option is selected. This process involves two files: an HTML page containing the form: <form id="theF ...

Is there a method to integrate a forum's user management system with the rest of the website?

Recently, I set up a MyBB forum and now I want to enhance my website by adding features like text saving. However, in order to implement this, I need user credentials. I am curious if I can utilize the forum's user management system to check if a user ...

Transforming Abbreviations Within a String into Title Case Using Regular Expressions

For a simple URL cleaning function I'm enhancing, I need to make specific conversions: Original Converted --------------------------------------------- USAMarch UsaMarch FETExaminations FetExaminations * Anothe ...

Updating database with Ajax when the button is clicked

Seeking guidance with a project as I am still grasping the concepts of javascript and jquery. The goal is to update a database entry upon clicking a button, where the content of the button is fetched from the database. Initial step involves querying the d ...

JavaScript - Removing Content from an Element

I have a coding script that adds an image preview of uploaded images. The issue I am facing is that the previous image does not clear when the form is filled out again. The id of the div where thumbnail images are being displayed is "thumbnail". Can someo ...

What is the best way to convert special fonts into JSON using php?

I have an array that looks like this: Array ( [0] => Array ( [image] => http://domain/photogal/tues/image/2012octo30big11.jpg [news] => 'ssN ^mj³ ho¡n dm¼nse¯nb tamUÂ<br> ' ) ...

To format or not to format: should PHP strings include special characters during translation?

Currently, I am using po files to translate my application with the help of the gettext function. A large number of strings in my code contain formatting characters such as spaces, colons, question marks, and more. I am curious - what is considered best p ...