Not the results you expected?
Search Tips
If you have run a search that returned no results there are a few things to try. By default searchcode
prioritizes system survival (hey its a free service!), and as such might do some load shedding, which can
mean you don't see results you expect. You can do some things to help with this.
Filters
Filtering by language or source will cut down the number of results searchcode needs to look at. If you
know a result for instance a term can be found in python code, specifying python re.compile lang:python
via the lang:python syntax, or the sidebar filters.
This works in reverse too, if you specify a filter and are not getting what you expect, try removing the filter.
You can also filter by filename database file:content where the filename must match
at the start what you supply.
Add more terms or longer terms
Adding more search terms will now only improve relevance it will reduce the number of results that
searchcode needs to inspect. So rather than searching for test consider trying unittest
or test random .
Keep in mind searchcode uses AND logic. This means search will look for all of the terms you enter split by whitespace. So a search
for *testing.T randomstring will look for documents
which contain both *testing.T and randomstring in any order in a document, with a
preference to displaying snippets where the terms are close together.
Literal search
Searchcode will literal search on anything, split by whitespace. This allows you to search for i++;
if you like but it does mean that no advanced search query syntax is supported (for the moment anyway) outside of filters and exact match.
Exact match search
You can search for exact matches by enclosing them in quotes "class ScopSearch(unittest.TestCase):"
Smallest term size
The smallest term you can search for in searchcode is 3 characters long. This is because it uses
a trigram index to search on. So a search for two characters, such as i+ will never return a
result. However i++ will. Note that while 2 character terms are not searched for if they
are in a search with other longer terms it may be used for matching and displaying code snippets.
Case insensitive
Generally consider searchcode case insensitive. It actually lowercase's everything it indexes, so it won't
work as expected for some unicode points. Note that highlighting is real unicode case insensitive using simple
case fold rules.
duckduckgo.cpp git://pkgs.fedoraproject.org/kdeplasma-addons | C++ | 170 lines
43
44 KUrl url = KUrl("http://api.duckduckgo.com /?q=futurama+characters&format=json&pretty=1");
45 // "http://api.duckduckgo.com /?q=define+ostensibly&format=json&pretty=1");
duckduck.go git://github.com/ajanicij/goduckgo.git | Go | 112 lines
94 query_enc := url.QueryEscape(query)
95 ddgurl := fmt.Sprintf("http://api.duckduckgo.com ?q=%s&format=json&pretty=1", query_enc)
96 resp, err := http.Get(ddgurl)
abstract.coffee git://github.com/github/hubot-scripts.git | CoffeeScript | 45 lines
17 robot.respond /(abs|abstract) (.+)/i, (res) ->
18 abstract_url = "http://api.duckduckgo.com /?format=json&q=#{encodeURIComponent(res.match[2])}"
19 res.http(abstract_url)
API.php git://github.com/duckduckgo/php5-duckduckgo.git | PHP | 163 lines
25 /**
26 * The API base URL. This defaults to api.duckduckgo.com .
27 */
58 $this->noDisambiguations = FALSE;
59 $this->baseURL = 'api.duckduckgo.com ';
60 }
README.md git://github.com/ajanicij/goduckgo.git | Markdown | 104 lines
14
15 [http://api.duckduckgo.com /?q=New+York+City&format=json&pretty=1](http://api.duckduckgo.com /?q=New+York+City&format=json&pretty=1)
16
index.html https://github.com/victusfate/Image-Matrix.git | HTML | 246 lines
177 + "&callback=?";
178 // var apiurl = "http://api.duckduckgo.com /?q=" + encodeURIComponent(key) + "&format=json&callback=?";
179 CreateImagesWithUrl(apiurl, bindex, key);
duckduckgo.js https://github.com/gildean/dunn.git | JavaScript | 87 lines
65 var options = {
66 hostname: 'api.duckduckgo.com ',
67 path: qPath
main.py https://github.com/akshaytyagi/quantum.git | Python | 189 lines
32 t=l.replace (" ", "+")
33 link="http://api.duckduckgo.com /?q="+t+"&format=json&pretty=1"
34 try:
duckduckgo.py git://github.com/Reisen/bruh.git | Python | 76 lines
49 request = Request(
50 'https://api.duckduckgo.com /?{}'.format(urlencode({
51 'q': msg,
ddg.py https://bitbucket.org/dwfreed/guppy.git | Python | 55 lines
42 request = "+".join(args)
43 sock = urllib.request.urlopen("http://api.duckduckgo.com /?q=%s&o=json" % request)
44 data = sock.read()
duckduckgo.py https://bitbucket.org/agiliq/searchapi | Python | 17 lines
7 def __init__(self):
8 self.end_point='http://api.duckduckgo.com /?q='
9
duckduckgo.com.rb https://bitbucket.org/andey/bestofama.git | Ruby | 12 lines
4 include HTTParty
5 base_uri 'api.duckduckgo.com '
6