summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/models/SearchResult.java
blob: 32edc2d797922b450a45a66b6960349e12ac6c09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package com.gitblit.models;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import com.gitblit.Constants.SearchObjectType;

/**
 * Model class that represents a search result.
 *
 * @author James Moger
 *
 */
public class SearchResult implements Serializable {

	private static final long serialVersionUID = 1L;

	public int hitId;

	public int totalHits;

	public float score;

	public Date date;

	public String author;

	public String committer;

	public String summary;

	public String fragment;

	public String repository;

	public String branch;

	public String commitId;

	public String path;

	public List<String> tags;

	public SearchObjectType type;

	public SearchResult() {
	}

	public String getId() {
		switch (type) {
		case blob:
			return path;
		case commit:
			return commitId;
		}
		return commitId;
	}

	@Override
	public String toString() {
		return  score + " : " + type.name() + " : " + repository + " : " + getId() + " (" + branch + ")";
	}
}