Skip to content

Commit 9a4361e

Browse files
Lubos KoscoLubos Kosco
authored andcommitted
field type adjustments, ui fixes
1 parent ceddad3 commit 9a4361e

File tree

12 files changed

+97
-88
lines changed

12 files changed

+97
-88
lines changed

src/org/opensolaris/opengrok/analysis/AnalyzerGuru.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,8 @@ public void populateDocument(Document doc, File file, String path,
279279
}
280280
fa.analyze(doc, StreamSource.fromFile(file), xrefOut);
281281

282-
String fileType = fa.getFileTypeName();
283-
doc.add(new StringField(QueryBuilder.FILETYPE, fileType, Store.YES));
282+
String type = fa.getFileTypeName();
283+
doc.add(new StringField(QueryBuilder.TYPE, type, Store.YES));
284284
}
285285
}
286286

src/org/opensolaris/opengrok/search/QueryBuilder.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class QueryBuilder {
4949
public static final String REFS = "refs";
5050
public static final String PATH = "path";
5151
public static final String HIST = "hist";
52-
public static final String FILETYPE = "fileType";
52+
public static final String TYPE = "type";
5353
/**
5454
* Fields we use in lucene internal ones
5555
*/
@@ -163,22 +163,22 @@ public String getHist() {
163163
}
164164

165165
/**
166-
* Set search string for the "fileType" field.
166+
* Set search string for the "type" field.
167167
*
168-
* @param fileType query string to set
168+
* @param type query string to set
169169
* @return this instance
170170
*/
171-
public QueryBuilder setFileType(String fileType) {
172-
return addQueryText(FILETYPE, fileType);
171+
public QueryBuilder setType(String type) {
172+
return addQueryText(TYPE, type);
173173
}
174174

175175
/**
176-
* Get search string for the "fileType" field.
176+
* Get search string for the "type" field.
177177
*
178178
* @return {@code null} if not set, the query string otherwise.
179179
*/
180-
public String getFileType() {
181-
return getQueryText(FILETYPE);
180+
public String getType() {
181+
return getQueryText(TYPE);
182182
}
183183

184184
/**

src/org/opensolaris/opengrok/search/Search.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ final class Search {
4343
"\t -p Path\n" +
4444
"\t -h History\n" +
4545
"\t -f Full text\n" +
46-
"\t -t File Type";
46+
"\t -t Type";
4747

4848
private SearchEngine engine;
4949
final List<Hit> results = new ArrayList<Hit>();
@@ -90,7 +90,7 @@ protected boolean parseCmdLine(String[] argv) {
9090
engine.setFreetext(getopt.getOptarg());
9191
break;
9292
case 't':
93-
engine.setFileType(getopt.getOptarg());
93+
engine.setType(getopt.getOptarg());
9494
break;
9595
}
9696
}

src/org/opensolaris/opengrok/search/SearchEngine.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ public class SearchEngine {
9696
*/
9797
private String symbol;
9898
/**
99-
* Holds value of property fileType
99+
* Holds value of property type
100100
*/
101-
private String fileType;
101+
private String type;
102102
/**
103103
* Holds value of property indexDatabase.
104104
*/
@@ -141,7 +141,7 @@ private QueryBuilder createQueryBuilder() {
141141
.setRefs(symbol)
142142
.setPath(file)
143143
.setHist(history)
144-
.setFileType(fileType);
144+
.setType(type);
145145
}
146146

147147
public boolean isValidQuery() {
@@ -495,20 +495,20 @@ public void setSymbol(String symbol) {
495495
}
496496

497497
/**
498-
* Getter for property fileType.
498+
* Getter for property type.
499499
*
500-
* @return Value of property fileType.
500+
* @return Value of property type.
501501
*/
502-
public String getFileType() {
503-
return this.fileType;
502+
public String getType() {
503+
return this.type;
504504
}
505505

506506
/**
507-
* Setter for property fileType.
507+
* Setter for property type.
508508
*
509-
* @param fileType New value of property fileType.
509+
* @param type New value of property type.
510510
*/
511-
public void setFileType(String fileType) {
512-
this.fileType = fileType;
511+
public void setType(String fileType) {
512+
this.type = fileType;
513513
}
514514
}

src/org/opensolaris/opengrok/web/PageConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ public QueryBuilder getQueryBuilder() {
466466
.setRefs(req.getParameter("refs"))
467467
.setPath(req.getParameter("path"))
468468
.setHist(req.getParameter("hist"))
469-
.setFileType(req.getParameter("type"));
469+
.setType(req.getParameter("type"));
470470

471471
// This is for backward compatibility with links created by OpenGrok
472472
// 0.8.x and earlier. We used to concatenate the entire query into a

web/default/style.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ tbody tr:nth-child(EVEN) { /* alternate color for odd rows */
4545
}
4646

4747
input, button {
48-
border: 1px #bbbbff #755;
48+
border: 1px solid #bbbbff;
4949
border-radius: 0.75ex;
5050
-moz-border-radius: 0.75ex;
5151
background-color: #a3b8cb;
@@ -465,7 +465,7 @@ table#dirlist { /* the "Name" column */
465465
display: inline-block;
466466
width: 6ex;
467467
text-align: right;
468-
padding-right: 0 1ex;
468+
padding-right: 0;
469469
margin-right: .5ex;
470470
background-color: #dddddd;
471471
color: #666;

web/help.jsp

Lines changed: 47 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,44 @@ include file="menu.jspf"
5353
</div>
5454
<div id="help">
5555
<p>
56+
57+
<dfn><b>Examples:</b></dfn>
58+
<pre class="example">
59+
60+
To find where setResourceMonitors is defined:
61+
<a href="search?q=&amp;defs=setResourceMonitors">defs:setResourceMonitors</a>
62+
63+
To find files that use sprintf in usr/src/cmd/cmd-inet/usr.sbin/:
64+
<a href="search?refs=sprintf&amp;path=usr%2Fsrc%2Fcmd%2Fcmd-inet%2Fusr.sbin%2F"
65+
>refs:sprintf path:usr/src/cmd/cmd-inet/usr.sbin</a>
66+
67+
To find assignments to variable foo:
68+
<a href="search?q=%22foo+%3D%22">"foo ="</a>
69+
70+
To find Makefiles where pstack binary is being built:
71+
<a href="search?q=pstack&amp;path=Makefile">pstack path:Makefile</a>
72+
73+
to search for phrase "Bill Joy":
74+
<a href="search?q=%22Bill+Joy%22">"Bill Joy"</a>
75+
76+
To find perl files that do not use /usr/bin/perl but something else:
77+
<a href="search?q=-%22%2Fusr%2Fbin%2Fperl%22+%2B%22%2Fbin%2Fperl%22"
78+
>-"/usr/bin/perl" +"/bin/perl"</a>
79+
80+
To find all strings begining with foo use the wildcard:
81+
<a href="search?q=foo*">foo*</a>
82+
83+
To find all files which have . c in their name(dot is a token!):
84+
<a href="search?path=%22. c%22">". c"</a>
85+
86+
To find all files which start with "ma" and then have only alphabet characters do:
87+
<a href="search?path=/ma[a-zA-Z]*/">path:/ma[a-zA-Z]*/</a>
88+
89+
To find all main methods in all files analyzed by C analyzer (so .c, .h, ...) do:
90+
<a href="search?q=main&type=c">main type:c</a>
91+
</pre>
92+
<br/>
93+
<dfn><b>More info:</b></dfn><br/><br/>
5694
A <dfn>Query</dfn> is a series of clauses. A clause may be prefixed by:</p>
5795
<ul>
5896
<li>a plus "<b>+</b>" or a minus "<b>-</b>" sign, indicating that the clause
@@ -81,7 +119,7 @@ A <dfn>Query</dfn> is a series of clauses. A clause may be prefixed by:</p>
81119
e.g. /[mb]an/ - will search for man or for ban;<br>
82120
NOTE: path field search escapes "/" by default, so it only supports
83121
regexps when the search string <u>starts and ends</u> with "/".<br>
84-
More info can be found on <a href="http://lucene.apache.org/core/4_3_0/core/org/apache/lucene/util/automaton/RegExp.html?is-external=true">lucene regexp page</a>.
122+
More info can be found on <a href="http://lucene.apache.org/core/4_3_1/core/org/apache/lucene/util/automaton/RegExp.html?is-external=true">lucene regexp page</a>.
85123
</li>
86124
<li>to perform a single character wildcard search use the "<b>?</b>" symbol,
87125
e.g. te?t</li>
@@ -129,59 +167,29 @@ So searching for <b>\+1</b> or <b>\+ 1</b> will both find <b>+1</b> and <b>+ 1</
129167
<dd>Search through all text tokens(words,strings,identifiers,numbers) in index.</dd>
130168

131169
<dt>defs</dt>
132-
<dd>Only finds symbol definitions.</dd>
170+
<dd>Only finds symbol definitions(where e.g. a variable(function, ...) is defined).</dd>
133171

134172
<dt>refs</dt>
135-
<dd>Only finds symbols.</dd>
173+
<dd>Only finds symbols(e.g. methods, classes, functions, variables).</dd>
136174

137175
<dt>path</dt>
138-
<dd>path of the source file.</dd>
176+
<dd>path of the source file(no need to use dividers).</dd>
139177

140178
<dt>hist</dt>
141179
<dd>History log comments.</dd>
180+
181+
<dt>type</dt>
182+
<dd>Type of analyzer used to scope down to certain file types(e.g. just C sources).<br/>Current mappings: <%=SearchHelper.getFileTypeDescirptions().toString()%></dd>
183+
142184
</dl>
143185

144186
<p>
145187
the term(phrases) can be boosted (making it more relevant) using a caret
146188
<b>^</b> , e.g. help^4 opengrok - will make term help boosted
147189
</p>
148190

149-
<dfn><b>Examples:</b></dfn>
150-
<pre class="example">
151-
152-
To find where setResourceMonitors is defined:
153-
<a href="search?q=&amp;defs=setResourceMonitors">defs:setResourceMonitors</a>
154-
155-
To find files that use sprintf in usr/src/cmd/cmd-inet/usr.sbin/:
156-
<a href="search?refs=sprintf&amp;path=usr%2Fsrc%2Fcmd%2Fcmd-inet%2Fusr.sbin%2F"
157-
>refs:sprintf path:usr/src/cmd/cmd-inet/usr.sbin</a>
158-
159-
To find assignments to variable foo:
160-
<a href="search?q=%22foo+%3D%22">"foo ="</a>
161-
162-
To find Makefiles where pstack binary is being built:
163-
<a href="search?q=pstack&amp;path=Makefile">pstack path:Makefile</a>
164-
165-
to search for phrase "Bill Joy":
166-
<a href="search?q=%22Bill+Joy%22">"Bill Joy"</a>
167-
168-
To find perl files that do not use /usr/bin/perl but something else:
169-
<a href="search?q=-%22%2Fusr%2Fbin%2Fperl%22+%2B%22%2Fbin%2Fperl%22"
170-
>-"/usr/bin/perl" +"/bin/perl"</a>
171-
172-
To find all strings begining with foo use the wildcard:
173-
<a href="search?q=foo*">sefoo*</a>
174-
175-
To find all files which have . c in their name(dot is a token!):
176-
<a href="search?path=%22. c%22">". c"</a>
177-
178-
To find all files which start with "ma" and then have only alphabet characters do:
179-
<a href="search?path=/ma[a-zA-Z]*/">/ma[a-zA-Z]*/</a>
180-
181-
</pre>
182-
183191
<p>Opengrok search is powered by <a href="http://lucene.apache.org/"
184-
>lucene</a>, for more detail on query syntax refer to <a href="http://lucene.apache.org/core/4_3_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package_description">lucene docs</a>.<br>
192+
>lucene</a>, for more detail on query syntax refer to <a href="http://lucene.apache.org/core/4_3_1/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package_description">lucene docs</a>.<br>
185193
</p>
186194
</div>
187195
<%

web/httpheader.jspf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ include file="pageconfig.jspf"
5555
<head>
5656
<meta name="robots" content="noindex,nofollow" />
5757
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
58-
<meta name="generator" content="<%=Info.getVersion()%> (<%=Info.getRevision()%>)" />
58+
<meta name="generator" content="{OpenGrok <%=Info.getVersion()%> (<%=Info.getRevision()%>)" />
5959
<meta http-equiv="X-UA-Compatible" content="IE=8" />
6060
<link rel="icon" href="<%=styleDir%>/img/icon.png" type="image/png" />
6161
<link rel="stylesheet" type="text/css" media="all"

web/menu.jspf

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,34 +78,34 @@ org.opensolaris.opengrok.web.Util"
7878
<div id="qtbl">
7979
<table>
8080
<tr>
81-
<td><label for="s1">Full&nbsp;Search</label></td>
81+
<td><label for="s1" title="The text token(s) or other fields to be found(lucene query, this is not full text!)">Full&nbsp;Search</label></td>
8282
<td><input tabindex="1" class="q" name="q" id="q" value="<%=
8383
Util.formQuoteEscape(queryParams.getFreetext()) %>"/></td>
8484
</tr>
8585
<tr>
86-
<td><label for="s2">Definition</label></td>
86+
<td><label for="s2" title="Definition of function/variable/class">Definition</label></td>
8787
<td><input class="q" tabindex="2" name="defs" id="defs" value="<%=
8888
Util.formQuoteEscape(queryParams.getDefs()) %>"/></td>
8989
</tr>
9090
<tr>
91-
<td><label for="s3">Symbol</label></td>
91+
<td><label for="s3" title="Usage of function/variable/class">Symbol</label></td>
9292
<td><input class="q" tabindex="3" name="refs" id="refs" value="<%=
9393
Util.formQuoteEscape(queryParams.getRefs()) %>"/></td>
9494
</tr>
9595
<tr>
96-
<td><label for="s4">File&nbsp;Path</label></td>
96+
<td><label for="s4" title="path or parts of it, no need to use dividers">File&nbsp;Path</label></td>
9797
<td><input class="q" tabindex="4" name="path" id="path" value="<%=
9898
Util.formQuoteEscape(queryParams.getPath()) %>"/></td>
9999
</tr>
100100
<tr>
101-
<td><label for="s5">History</label></td>
101+
<td><label for="s5" title="Search in log messages">History</label></td>
102102
<td><input class="q" tabindex="5" name="hist" id="hist" value="<%=
103103
Util.formQuoteEscape(queryParams.getHist()) %>"/></td>
104104
</tr>
105105
<tr>
106106
<td><label for="s5">Type</label></td>
107107
<td><select class="q" tabindex="6" name="type" id="type"><%
108-
String selection = queryParams.getFileType();
108+
String selection = queryParams.getType();
109109
%>
110110
<option value="">Any</option><%
111111
for (Map.Entry<String, String> d : SearchHelper.getFileTypeDescirptions()) {
@@ -186,12 +186,12 @@ org.opensolaris.opengrok.web.Util"
186186
}
187187
%>
188188

189-
<p><input
190-
tabindex="9" class="submit" type="submit" value="Search"/> <input
191-
tabindex="10" class="submit" onclick="javascript: clearSearchFrom();" type="button"
192-
value=" Clear "/> <button class="help"
193-
tabindex="11" onclick="window.open('help.jsp')">Help</button>
194-
</p>
189+
<p><input tabindex="9" class="submit" type="submit" value="Search"/>
190+
<input tabindex="10" class="submit" onclick="javascript: clearSearchFrom();"
191+
type="button" value=" Clear "/>
192+
<button class="help" tabindex="11" onclick="window.open('help.jsp');">Help
193+
</button>
194+
</p>
195195
</form>
196196
<%
197197
}

web/polished/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ tbody tr:nth-child(EVEN) { /* alternate color for odd rows */
4646
}
4747

4848
input, button {
49-
border: 1px solid #bbb #755;
49+
border: 1px solid #bbb;
5050
border-radius: 0.75ex;
5151
-moz-border-radius: 0.75ex;
5252
background-image: -webkit-gradient(

0 commit comments

Comments
 (0)