tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

searchfox_search.rst (5014B)


      1 .. _searchfox_search:
      2 
      3 Searchfox Query Language Documentation
      4 ======================================
      5 
      6 Searchfox provides a powerful query language for searching code
      7 repositories. The system is designed with simplicity in mind - you can
      8 start with basic searches and refine them interactively, while also
      9 supporting advanced query syntax for power users.
     10 
     11 .. contents:: Table of Contents
     12 
     13 Basic Search
     14 ------------
     15 
     16 The simplest way to search is to just type what you're looking for. No
     17 special syntax is required:
     18 
     19 https://searchfox.org/mozilla-central/search?q=AudioContext
     20 
     21 This will search for:
     22 
     23 - Text occurrences in files
     24 - Symbol/identifier matches (prefix-based)
     25 - File names containing the term
     26 
     27 The path filter input on the right hand side supports glob patterns that
     28 supports the following features:
     29 
     30 - ``*`` : matches any characters except path separators (``/``)
     31 - ``**`` : matches any characters including path separators
     32 - ``?`` : matches any single character
     33 - ``{a,b,c}``: matches any of the comma-separated alternatives
     34 - ``^`` and ``$``: regex anchors (preserved as-is)
     35 - Literal parentheses, pipes, and dots are escaped
     36 
     37 The same syntax is used whenever globbing is expected in searchfox.
     38 
     39 Query Parameters
     40 ----------------
     41 
     42 Searches can be customized using URL parameters:
     43 
     44 Case Sensitivity
     45 ~~~~~~~~~~~~~~~~
     46 
     47 -  **Parameter**: ``case``
     48 -  **Values**: ``true`` for case-sensitive, anything else for
     49   case-insensitive (default)
     50 
     51 https://searchfox.org/mozilla-central/search?q=AudioContext&case=true
     52 
     53 Regular Expressions
     54 ~~~~~~~~~~~~~~~~~~~
     55 
     56 -  **Parameter**: ``regexp``
     57 -  **Values**: ``true`` to treat query as regex, anything else for
     58   literal search
     59 -  **Note**: Regex mode only performs textual content search, not semantic search
     60   unless ``symbol:`` or ``id:`` prefixes are used
     61 
     62 https://searchfox.org/mozilla-central/search?q=AudioContext%3A%3A.*Panner*&regexp=true
     63 
     64 Path Filtering
     65 ~~~~~~~~~~~~~~
     66 
     67 -  **Parameter**: ``path``
     68 -  **Description**: Filter results by file paths using glob patterns
     69 -  **Example**: ``?q=MyFunction&path=src/main/*``
     70 
     71 For example, finding media playback tests (not Web Audio tests that are in
     72 ``dom/media/webaudio/tests``) that use an ``AudioContext``:
     73 
     74 https://searchfox.org/mozilla-central/search?q=path%3Adom%2Fmedia%2Ftest+AudioContext&path=&case=false&regexp=false
     75 
     76 Advanced Query Syntax
     77 ---------------------
     78 
     79 The query language supports ``term:value`` syntax for more precise searches.
     80 
     81 **Important**: ``term:value`` syntax must be placed before any search terms.
     82 The search endpoint stops parsing once it encounters an unrecognized term.
     83 
     84 ``path:``
     85 ~~~~~~~~~
     86 
     87 Filters results by file paths using glob patterns (same as path
     88 parameter):
     89 
     90 ::
     91 
     92   path:src/components/* MyFunction
     93 
     94 ``pathre:``
     95 ~~~~~~~~~~~
     96 
     97 Filters results using regular expressions for paths:
     98 
     99 ::
    100 
    101    pathre:^src/(main|test)/.*\.js$ MyFunction
    102 
    103 Example, finding all tests for the ``PannerNode``, in WPT and Mochitests:
    104 
    105 https://searchfox.org/mozilla-central/search?q=pathre%3Atesting%5C%2Fwpt%7Cdom%5C%2Fmedia%5C%2Fwebaudio%5C%2Ftest+PannerNode
    106 
    107 Context
    108 ~~~~~~~
    109 
    110 Allows displaying the result and surrounding context. A current limitation is
    111 that this only works with fulltext search via ``text:`` or ``re:`` and if you
    112 forget to use one, you may get semantic results without any context.
    113 
    114 ::
    115 
    116    context:3 re:AudioContext::.*Create
    117 
    118 Search for all factory methods of an AudioContext, with 3 lines of context,
    119 above and below the search hit:
    120 
    121 https://searchfox.org/mozilla-central/search?q=context%3A3+re%3AAudioContext%3A%3A.*Create
    122 
    123 Search Type Terms
    124 ~~~~~~~~~~~~~~~~~
    125 
    126 ``symbol:``
    127 ^^^^^^^^^^^
    128 
    129 Search only for symbols/identifiers
    130 
    131 ::
    132 
    133   symbol:cubeb_stream_init
    134 
    135 -  Multiple symbols can be comma-separated: ``symbol:Foo,Bar``
    136 -  Dot notation is normalized to hash: ``symbol:obj.method`` becomes
    137   ``symbol:obj#method``
    138 - Note: in C++, this requires the mangled symbol name, and so it is best access by clicking on a member
    139 
    140 ``id:``
    141 ^^^^^^^
    142 
    143 Exact-match identifier search (not prefix-based like the default search):
    144 
    145 ::
    146 
    147   id:main
    148 
    149 This means ``id:creategain`` won't match ``createGainNode()`` calls, that are
    150 also present indexed code.
    151 
    152 ``text:``
    153 ^^^^^^^^^
    154 
    155 Exact text match, this escapes regexp characters
    156 
    157 ::
    158 
    159   text:function main()
    160 
    161 ``re:``
    162 ^^^^^^^
    163 
    164 Treat remainder of query as regular expression
    165 
    166 ::
    167 
    168   re:get\w+Value
    169 
    170 ``nresult:``
    171 ^^^^^^^^^^^^
    172 
    173 Show the `nsresult` definition for given hex or decimal notation.
    174 
    175 ::
    176 
    177   nsresult:0x80004005
    178   nsresult:80004005
    179   nsresult:2147500037
    180 
    181 Sharing and Collaboration
    182 -------------------------
    183 
    184 All non-default searches are encoded in URLs, making them easy to
    185 bookmark for later use, sharing with team members, include in
    186 documentation or bug reports, and building into automated tools.
    187 
    188 When including a searchfox link in source code, consider using a
    189 permalink to a revision when it makes sense.
    190 
    191 **Update Schedule**: It takes up to 12 hours for trees other than
    192 the Firefox tree to receive the latest enhancements and fixes.