Skip to content

Conversation

@Oaphi
Copy link
Member

@Oaphi Oaphi commented Jan 28, 2026

closes #938

The ship stays where it is and the engines move the universe around it.

If we cannot use only negative terms, well... let's search for those terms and exclude them from results. I believe this is what end users expect from a search with all words set to "exclude".

@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

❌ Patch coverage is 60.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.87%. Comparing base (f86de01) to head (7f925cd).

Files with missing lines Patch % Lines
app/models/application_record.rb 50.00% 3 Missing ⚠️
app/models/post.rb 66.66% 1 Missing ⚠️
Additional details and impacted files
Components Coverage Δ
controllers 75.18% <ø> (ø)
helpers 85.01% <100.00%> (ø)
jobs 80.59% <ø> (ø)
models 89.90% <55.55%> (-0.19%) ⬇️
tasks 61.11% <ø> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Oaphi Oaphi changed the title enabled simple exclusion search for posts Return proper results for posts searches consisting only of word exclusions Jan 28, 2026
@cellio
Copy link
Member

cellio commented Jan 28, 2026

When we get there, let's make sure there's a test that covers hyphens in strings, like if someone searches on Software Dev for tar -xvf. That should not interfere with -term (negative search) or --term (wrong syntax that we fix). It's possible we already have this test case.

@Oaphi Oaphi requested a review from ArtOfCode- January 29, 2026 02:56
@Oaphi
Copy link
Member Author

Oaphi commented Jan 29, 2026

That should not interfere with -term (negative search) or --term (wrong syntax that we fix). It's possible we already have this test case.

We have no way of supporting queries like tar -xvf in the first place, @cellio, at least not with our boolean FTS mode. -word is always interpreted as operator - + word (unless the length of the word is less than the minimum token length, which should be 3 or 4 chars in our case, in which case it doesn't even count as one, IIRC). We should add a special "in code" operator if we want to support such queries (try searching for wsl --shutdown, for example - it won't even parse as a valid search string due to --, even though there's at least one post with this exact command).

@cellio
Copy link
Member

cellio commented Jan 29, 2026

(try searching for wsl --shutdown, for example - it won't even parse as a valid search string due to --, even though there's at least one post with this exact command).

However, I can search for "wsl --shutdown" and that works. I just want to confirm that a - inside a quoted search string will continue to be treated as part of that string and not an operator.

@Oaphi
Copy link
Member Author

Oaphi commented Jan 29, 2026

However, I can search for "wsl --shutdown" and that works. I just want to confirm that a - inside a quoted search string will continue to be treated as part of that string and not an operator.

Ah, I see what you mean now - yeah, that's an important thing to keep track of, I'll add a test case (and handling if necessary) for it

@cellio
Copy link
Member

cellio commented Jan 29, 2026

Ah, I see what you mean now - yeah, that's an important thing to keep track of, I'll add a test case (and handling if necessary) for it

I failed to use quotes in my comment; I see why that was confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Search for "not (word)" by itself returns no results

4 participants