2

Tl;Dr:

As of November 2022, is Google still the best option to search for posts including specific code methods?


I'm trying to find questions with code generated by the Google Sheets Macro Recorder. OPs do not always mention that the code was generated using this tool. It could be "detected" as the automatically generated code very commonly has a lot of lines as the following examples:

spreadsheet.getRange(hardcode_a1Notation_reference).activate();
spreadsheet.getCurrentCell().setFormula(hardcoded_formula);

Another pattern

var currentCell = spreadsheet.getCurrentCell();
spreadsheet.getSelection().getNextDataRange(SpreadsheetApp.Direction.DOWN).activate();
currentCell.activateAsCurrentCell();
currentCell = spreadsheet.getCurrentCell();

I tried

  • [google-sheets] code:activate() 55 results
    • some results don't include activate, but not the parenthesis, and others include variants of the activate word, like active not in code blocks / inline code.
  • [google-sheets] code:"activate()" 24 results
    • includes results having activate() in inline code without having nothing else before or after
  • [google-sheets] activate() 1,627 results
    • No surprises: a lot results include variants of activate like active
  • [google-sheets] "activate()" 337 results
    • A bit surprised as expected for exact / verbatim matches, a lot results include variants of activate like active

A comment from 2016 suggest to use an "insecure" website.

Replace the built-in Elastic Search with results from Google instead from 2014 and other more recent posts suggest that Google is better.

Related


After reading the Makoto's answer instead of searching around activate() I tried searching a single line of code double-quote enclosed using Google:

"var currentCell = spreadsheet.getCurrentCell();"

then clicking on "more results from stackoverflow.com", that automatically adds site:stackoverflow.com as expected. For an early approximation is good enough but the results apparantly were very similar (I didn't compared result by result, and didn't discarted "false positives").

Google returned 32 results including one from ru.stackoverflow.com

code:"var currentCell = spreadsheet.getCurrentCell();" returned 35 results

Both searches were done practically at the same time.


I just thought about code plagiarism checkers, so I tried to search

code plagiarism checker

The results includes several entries that looks interesting, but I will explore them later.


The following question includes four instances of spreadsheet.getRange(something).activate();, where something is 'K1', 'N1', 'P1', in code blocks but it's not included in the search results of [google-sheets] code:"activate()":

Another missing question in the previous search

8
  • 12
    Yes. On-site search is still generally worthless Commented Nov 8, 2022 at 21:46
  • 5
    Whoever is in charge of implementing search on SO could just search SO to find out how to do it correctly ... oh wait, never mind.
    – JK.
    Commented Nov 8, 2022 at 23:38
  • Are there only two options? Aren't there some specialised search engines? Commented Nov 9, 2022 at 17:43
  • @PeterMortensen Are you aware of another option worthy to mention / explore? Do you have any suggestion about how to search for SO questions? How about searching for multiple lines of code?
    – Wicket
    Commented Nov 9, 2022 at 17:53
  • @PeterMortensen added a "progress update"
    – Wicket
    Commented Nov 9, 2022 at 18:09
  • 1
    @Rubén: There was one, once mentioned in several places on MSE, but it stopped working in April 2022. Commented Nov 10, 2022 at 13:37
  • 1
    Here is a list of them (requires more than 10,000 reputation points to see). I don't know how obsolete the list is. Commented Nov 10, 2022 at 14:01
  • The whole idea behind Stack Overflow is to essentially be the top X search results when you do a web search. Readily available answers. It is not intended to be a replacement for the web, so it makes little sense to do a search specifically on stack overflow. The built-in site search has more use to finding stuff to write an answer for rather than to find answers to a problem you have.
    – Gimby
    Commented Nov 10, 2022 at 14:04

1 Answer 1

7

Yes. Google Search is vastly more effective in finding things mostly related to code snippets.

You must log in to answer this question.

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