Skip to content

Commit bee0118

Browse files
committed
Simplify uniqueDefinition handling (no functional change)
1 parent 044a0d2 commit bee0118

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/web/SearchHelper.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
/*
2121
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
2222
* Portions copyright (c) 2011 Jens Elkner.
23-
* Portions Copyright (c) 2017-2019, Chris Fraire <[email protected]>.
23+
* Portions Copyright (c) 2017-2020, Chris Fraire <[email protected]>.
2424
*/
2525
package org.opengrok.indexer.web;
2626

@@ -401,7 +401,7 @@ public SearchHelper executeQuery() {
401401
// one single definition term AND we have exactly one match AND there
402402
// is only one definition of that symbol in the document that matches.
403403
boolean uniqueDefinition = false;
404-
if (isSingleDefinitionSearch && hits != null && hits.length == 1) {
404+
if (isCrossRefSearch && isSingleDefinitionSearch && hits != null && hits.length == 1) {
405405
Document doc = searcher.doc(hits[0].doc);
406406
if (doc.getField(QueryBuilder.TAGS) != null) {
407407
byte[] rawTags = doc.getField(QueryBuilder.TAGS).binaryValue().bytes;
@@ -412,9 +412,7 @@ public SearchHelper executeQuery() {
412412
}
413413
}
414414
}
415-
// @TODO fix me. I should try to figure out where the exact hit is
416-
// instead of returning a page with just _one_ entry in....
417-
if (uniqueDefinition && hits != null && hits.length > 0 && isCrossRefSearch) {
415+
if (uniqueDefinition) {
418416
redirect = contextPath + Prefix.XREF_P
419417
+ Util.URIEncodePath(searcher.doc(hits[0].doc).get(QueryBuilder.PATH))
420418
+ '#' + Util.URIEncode(((TermQuery) query).getTerm().text());

0 commit comments

Comments
 (0)