On 26/09/2016 14:14, Honza Bambas wrote:
> Today I tried to search for an identifier on DXR. Something that was so
> easy with MXR...
>
> I wanted to find usage of a member called "io_pending". Typing that
> string to the DXR search field gives me a number of results that are
> definitely not what I'm looking for, like lines containing
> ERROR_IO_PENDING. Using var:io_pending or ref:io_pending returns zero
> results, despite the identifier is definitely used in the code base.
> So, I tried to look only for assignments to this identifier (a member
> variable, actually), so I typed "io_pending = " to the search field.
> And what a surprise! I got the same result as for pure "io_pending", so
> very far from what I was looking for and expecting to get.
>
>
> Questions:
>
> - how can I look for a string as always _case sensitive_ and _whole word
> only_ ? MXR was capable of searching for 'identifiers', why doesn't DXR
> provide something simple as that as well?
'io_pending =
(note leading quote - you can close the quote as well to search for that
specific string, but it's quicker not to, of course...)
By default dxr tokenizes your input, so if you put "foo bar" (without
quotes) it will give you lines that contain both foo and bar,
individually. That is sometimes helpful, but not here.
> - how can I simply limit search to be performed only in a certain
> directory and it's sub-dirs?
foo path:browser/base/content/test/
will give only results containing 'foo' from files that match that path.
Note that the path is not 'leading' specific, so e.g. path:.gif or
path:browser_ are also valid expressions that might be useful in
specific searches.
~ Gijs