Skip to content

Commit d39e00d

Browse files
committed
Small tweak to only use new defs search rules if ONLY the defs field is populated, as per tarzanek's concerns
1 parent 7987f70 commit d39e00d

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,21 @@ public int getSize() {
200200
return queries.size();
201201
}
202202

203+
/**
204+
* Used to tell if this search only has the "definitions" field filled in
205+
*
206+
* @return whether above statement is true or false
207+
*/
208+
public boolean isDefSearch() {
209+
210+
return ((getQueryText(FULL) == null) &&
211+
(getQueryText(REFS) == null) &&
212+
(getQueryText(PATH) == null) &&
213+
(getQueryText(HIST) == null) &&
214+
(getQueryText(DEFS) != null))
215+
? true : false;
216+
}
217+
203218
/**
204219
* Build a new query based on the query text that has been passed in to this
205220
* builder.

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,8 @@ public static void prettyPrint(Writer out, SearchHelper sh, int start,
202202
FileReader r = genre == Genre.PLAIN
203203
? new FileReader(new File(sh.sourceRoot, rpath))
204204
: null;
205-
boolean isDefSearch = (sh.builder.getDefs() != null) ? true : false;
206-
sh.sourceContext.getContext(r, out, xrefPrefix,
207-
morePrefix, rpath, tags, true, isDefSearch, null);
205+
sh.sourceContext.getContext(r, out, xrefPrefix, morePrefix,
206+
rpath, tags, true, sh.builder.isDefSearch(), null);
208207
}
209208
}
210209
if (sh.historyContext != null) {

0 commit comments

Comments
 (0)