I use the Joomla smart search on my site (com_finder). I have an article with the term not connected in it.

When I search for the term not connected I get 0 results.

When I search for the word connected alone the article does show up.

When I search the term "not connected" (enclosed with quotation marks) the article shows up on the search.

As I understand, quotation marks should represent exact match and show fewer results than general match (without quotation marks) and not the other way around.

How come the article does not show up without the quotation mark?

  • Welcome to JSE. Good question -- you did a great job of narrowing and expressing the issue so that volunteers can replicate your issue. Please take the tour while you wait for support. – mickmackusa Jan 20 '20 at 20:33
  • 1
    @mickmackusa Thanks. Just to clarify, the square brackets in the question were used to seperate the term being searched. In reality I am searching the term without the square brackets. – Dor Levi Jan 21 '20 at 6:25
  • Hmmm. I'm not successfully able to duplicate that (when I searched for looking for in my dev site I got articles with the phrase as well as just with looking). Just as a double-check, try turning on the"query explanation" option (on the advanced tab of the search menu item) to be sure the system is seeing the request the way you think it should (it should be, but it never hurts to check). It should say something like "Assuming not is required and connected is required ..." – Arlen Jan 21 '20 at 14:52
  • Forgot to add, the reason I thought of the check is that the word "not" also carries a boolean meaning, to exclude the search term. Which would mean the system is seeing that as a null query that should exclude any items with the word connected, and null queries are the empty set. – Arlen Jan 21 '20 at 14:55
  • @arlen I was not able to see the query explanation for some reason, But now that I double check that issue, considering the fact that "not" carries a boolean meaning, it seems that this is in fact the issue because when I search a different word combination and it does work. So this raise the question of how can this be fixed? – Dor Levi Jan 23 '20 at 14:34

Did a little more looking when I had time and discovered a bug in com_finder that complicates this issue, but here's how it's (IMO) supposed to work as well as a workaround for the bug.

The word "not" carries a boolean meaning, so when you enter the string

not connected

it takes on the meaning I suggested in one of my comments, that of 'every response to an empty query except those containing the word "connected."' Since the result of an empty query is an empty set, you end up with nothing found.

To "unload" the boolean meaning, we surround it with quotes, like this:

"not" connected

While that is the theory behind it and how it's supposed to work, unfortunately, that query triggers the bug I referred to, so instead of interpreting that query as searching for the word "not" and the word "connected" it searches for the word "not" and then resurrects the boolean meaning we were supposed to be eluding and excludes all entries that have "connected" in them from the returned result set. Subtle bug, eh?

So, how do we work around this? So long as there's only one boolean term in your search, put it in quotes and make it the last term:

connected "not"

and that will get you the results you're looking for, all entries with both "not" and "connected" in them.

  • thanks for the input, but this will not solve the issue as the search should serve the user and I cannot control what every user will write as the search query. – Dor Levi Jan 24 '20 at 15:14
  • You can, at least control what you write on the search results page and/or the advanced search page (if you offer one) so you can at least inform the user about how to write a good search query. – Arlen Jan 26 '20 at 23:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.