GR:Gravity/Xref/Queries/Enhancing a Simple Query
Enhancing a simple search query
The simple Xref query runs a full-text search using the provided word or words.
The syntax that can be used in a search is based on the Lucene Query Language where a combination of words and operators are called a clause. A clause can be a simple term (word) or a specific search for terms in a field. A query can be enhanced with wild cards and operators to include advanced Xref searching capabilities. For a more thorough explanation of the Lucene Query Language see the section Xref Search Capabilities.
An alternative for the simple Xref query dialog is the Advanced query dialog which has support for all the Xref query fields and allows a search based on individually set fields, see Advanced Query Dialog. From the advanced dialog, the following query fields can be set:
- full-text search
- search for a definition
- search for a symbol
- include a file path(s) in the search
- include a source type in the search
From the advanced dialog, you can also set the locations to be included in a search, if none is set then all locations are used in the search.
The ability to use the different terms in a search is highly dependent upon the scanned and indexed source files. If a source file is not of a supported language type then only a full-text search will be possible. See the below Language Type support for the list of source language types that will be analyzed with respect to definitions and references.
Language Type support
You can limit the search to a specific language type by providing the 'type' field. For example by selecting the type 'java', the query will be limited to searching in the files with the extension 'java'. The following languages have type definition:
- c = C
- clojure = Clojure
- csharp = C#
- cxx = C++
- erlang = Erlang
- fortran = Fortran
- golang = Golang
- haskell = Haskell
- java = Java
- javaclass = Java class
- javascript = JavaScript
- json = Json
- kotlin = Kotlin
- lisp = Lisp
- lua = Lua
- pascal = Pascal
- perl = Perl
- php = PHP
- plain = Plain Text
- plsql = PL/SQL
- python = Python
- rust = Rust
- scala = Scala
- sh = Shell script
- sql = SQL
- tcl = Tcl
- troff = Troff
- vb = Visual Basic
- xml = XML
NOTE. If a type is not in the list of supported languages then the file types to be included in a search can be set using a file extension in the path field. Be aware that when using the term 'type' in combination with the term 'path' that the last will take precedence.