25

Is there a syntax to explicitly disable word stemming in the search Q&A?

For example, I want to search for usages of locals(), a built-in python function, and I want to disable stemming of that word otherwise there are many irrelevant results that use terms such as "local variable".

Edit: The answer below does not work, nor any of the suggestions in the comments below it, and I am still searching for an acceptable answer to this question. There does not seem to be a way to add bounties on meta questions, otherwise I would have added one here..

0

1 Answer 1

1

Simply put the word(s) you want to search for into double quotes. In this case, you have to search for the following:

"locals"

(probably combined with [python] considering you're looking for posts about a Python function)

20
  • 1
    Hmmm, nope, no good. It removes uses I do want, which look like locals().
    – wim
    Nov 30, 2016 at 23:52
  • 7
    [python] code:"locals"
    – user4639281
    Dec 1, 2016 at 0:31
  • 1
    @TinyGiant still not working ... searching user:me code:"locals" finds zero results, but it should find this result, amongst others ...
    – wim
    Dec 1, 2016 at 4:29
  • 6
    user:674039 code:"locals()"
    – user4639281
    Dec 1, 2016 at 4:55
  • 3
    @TinyGiant Yeah, but that kinda misses the point, doesn't it? If you know exactly what the code snippet looks like, there's no need to search. What about a method with parameters?
    – Basic
    Dec 2, 2016 at 16:40
  • 2
    Indeed, it misses the point. It still does not find this result, as mentioned in my previous comment.
    – wim
    Dec 2, 2016 at 16:44
  • 5
    @Basic You're providing conflicting requirements. You want the search to sometimes* look for instances where the entire token matches that text, and you want it to sometimes not look for just that token, and instead look for instances where it's just a part of a token. You can do one or the other, but you can't sometimes let it be a part of the token and sometimes not, based on whether or not it's a token you want to match.
    – Servy
    Dec 2, 2016 at 16:44
  • 2
    Isn't the point that if you search for locals() and get results, that searching for locals should give those same results plus possibly any more that match? This is not happening.
    – DavidG
    Dec 2, 2016 at 16:46
  • @Servy Actually, I think what we're looking for here is a tokeniser that understands code better, but until then, the ability to do an exact string match that doesn't neccesarly match token boundaries would do nicely.
    – Basic
    Dec 2, 2016 at 16:49
  • @Basic All you need to do for that is to remove the quotes. The problem is that when he looks for matches that aren't a complete token he gets lots of false positives.
    – Servy
    Dec 2, 2016 at 16:50
  • @DavidG That's because you're going out of your way to use an exact match. If you don't want an exact match, then don't tell it to search for an exact match. You can do one or the other, but you can't say, "search for the specific inexact matches that I personally care about, while not ever searching for the inexact matches that I'm not interested in" because the computer can't read your mind.
    – Servy
    Dec 2, 2016 at 16:51
  • 2
    Just saw your edit.... What is imprecise about "give me every document that contains the string locals"? I'll stop now to avoid pointless clutter...
    – Basic
    Dec 2, 2016 at 16:53
  • 8
    @Servy The problem is the tokenizer finds local, which he does not want. Requirement is "find every string that begins with locals". More advanced search options (for example, SQL LIKE syntax even) would help that.
    – Joe
    Dec 2, 2016 at 17:00
  • 3
    Wait... you mean the search function is less than perfect, leaves something to be desired, and has a few quirks? Say it ain't so.
    – user4639281
    Dec 2, 2016 at 17:15
  • 10
    I remember a time when regular expressions were the key piece of any respectable search function. Then the web came. Now you grunt at the machine, it guesses what you meant, and you can only get what you want if you guess what it's going to guess. Progress.
    – user2404501
    Dec 2, 2016 at 18:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .