Polish the Lucene search page. Integrate both search mechanisms.
4 files renamed
9 files modified
| | |
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.wicket.pages.ActivityPage;
|
| | | import com.gitblit.wicket.pages.BasePage;
|
| | | import com.gitblit.wicket.pages.BlamePage;
|
| | | import com.gitblit.wicket.pages.BlobDiffPage;
|
| | | import com.gitblit.wicket.pages.BlobPage;
|
| | |
| | | import com.gitblit.wicket.pages.CommitPage;
|
| | | import com.gitblit.wicket.pages.DocsPage;
|
| | | import com.gitblit.wicket.pages.FederationRegistrationPage;
|
| | | import com.gitblit.wicket.pages.GitSearchPage;
|
| | | import com.gitblit.wicket.pages.GravatarProfilePage;
|
| | | import com.gitblit.wicket.pages.HistoryPage;
|
| | | import com.gitblit.wicket.pages.LogPage;
|
| | | import com.gitblit.wicket.pages.LuceneSearchPage;
|
| | | import com.gitblit.wicket.pages.MarkdownPage;
|
| | | import com.gitblit.wicket.pages.MetricsPage;
|
| | | import com.gitblit.wicket.pages.PatchPage;
|
| | | import com.gitblit.wicket.pages.RawPage;
|
| | | import com.gitblit.wicket.pages.RepositoriesPage;
|
| | | import com.gitblit.wicket.pages.ReviewProposalPage;
|
| | | import com.gitblit.wicket.pages.SearchPage;
|
| | | import com.gitblit.wicket.pages.SummaryPage;
|
| | | import com.gitblit.wicket.pages.TagPage;
|
| | | import com.gitblit.wicket.pages.TagsPage;
|
| | |
| | | mount("/commitdiff", CommitDiffPage.class, "r", "h");
|
| | | mount("/patch", PatchPage.class, "r", "h", "f");
|
| | | mount("/history", HistoryPage.class, "r", "h", "f");
|
| | | if (GitBlit.getBoolean(Keys.lucene.enable, false)) {
|
| | | // TODO switch this to LucenePage when it is ready
|
| | | mount("/search", SearchPage.class);
|
| | | } else {
|
| | | mount("/search", SearchPage.class);
|
| | | }
|
| | | mount("/search", GitSearchPage.class);
|
| | | mount("/metrics", MetricsPage.class, "r");
|
| | | mount("/blame", BlamePage.class, "r", "h", "f");
|
| | |
|
| | |
| | |
|
| | | mount("/activity", ActivityPage.class, "r", "h");
|
| | | mount("/gravatar", GravatarProfilePage.class, "h");
|
| | | mount("/lucene", LuceneSearchPage.class);
|
| | | }
|
| | |
|
| | | private void mount(String location, Class<? extends WebPage> clazz, String... parameters) {
|
| | |
| | | public Class<? extends Page> getHomePage() {
|
| | | return RepositoriesPage.class;
|
| | | }
|
| | | |
| | | /**
|
| | | * Returns the preferred search page class.
|
| | | * |
| | | * @return a Wicket class representing a search page
|
| | | */
|
| | | public Class<? extends BasePage> getSearchPageClass() {
|
| | | if (GitBlit.getBoolean(Keys.lucene.enable, false)) {
|
| | | // TODO switch this to LucenePage when it is ready
|
| | | return SearchPage.class;//LucenePage.class;
|
| | | }
|
| | | return SearchPage.class;
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public final Session newSession(Request request, Response response) {
|
| | |
| | | gb.workingCopy = working copy
|
| | | gb.workingCopyWarning = this repository has a working copy and can not receive pushes
|
| | | gb.query = query
|
| | | gb.queryHelp = write brief explanation of Lucene syntax here
|
| | | gb.queryHelp = Standard query syntax is supported.<p/><p/>Please see <a target="_new" href="http://lucene.apache.org/core/old_versioned_docs/versions/3_5_0/queryparsersyntax.html">Lucene Query Parser Syntax</a> for details.
|
| | | gb.authored = authored
|
| | | gb.committed = committed
|
| | | gb.indexedBranches = indexed branches
|
| | | gb.indexedBranchesDescription = select the branches to include in your Lucene index
|
| | | gb.noIndexedRepositoriesWarning = none of your repositories are configured for Lucene indexing
|
| | | gb.undefinedQueryWarning = query is undefined!
|
| | | gb.gb.noSelectedRepositoriesWarning = please select one or more repositories! |
| | | gb.noSelectedRepositoriesWarning = please select one or more repositories! |
File was renamed from src/com/gitblit/wicket/pages/SearchPage.java |
| | |
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.panels.SearchPanel;
|
| | |
|
| | | public class SearchPage extends RepositoryPage {
|
| | | public class GitSearchPage extends RepositoryPage {
|
| | |
|
| | | public SearchPage(PageParameters params) {
|
| | | public GitSearchPage(PageParameters params) {
|
| | | super(params);
|
| | |
|
| | | String value = WicketUtils.getSearchString(params);
|
| | |
| | | boolean hasMore = search.hasMore();
|
| | | add(search);
|
| | |
|
| | | add(new BookmarkablePageLink<Void>("firstPageTop", SearchPage.class,
|
| | | add(new BookmarkablePageLink<Void>("firstPageTop", GitSearchPage.class,
|
| | | WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType))
|
| | | .setEnabled(pageNumber > 1));
|
| | | add(new BookmarkablePageLink<Void>("prevPageTop", SearchPage.class,
|
| | | add(new BookmarkablePageLink<Void>("prevPageTop", GitSearchPage.class,
|
| | | WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType,
|
| | | prevPage)).setEnabled(pageNumber > 1));
|
| | | add(new BookmarkablePageLink<Void>("nextPageTop", SearchPage.class,
|
| | | add(new BookmarkablePageLink<Void>("nextPageTop", GitSearchPage.class,
|
| | | WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType,
|
| | | nextPage)).setEnabled(hasMore));
|
| | |
|
| | | add(new BookmarkablePageLink<Void>("firstPageBottom", SearchPage.class,
|
| | | add(new BookmarkablePageLink<Void>("firstPageBottom", GitSearchPage.class,
|
| | | WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType))
|
| | | .setEnabled(pageNumber > 1));
|
| | | add(new BookmarkablePageLink<Void>("prevPageBottom", SearchPage.class,
|
| | | add(new BookmarkablePageLink<Void>("prevPageBottom", GitSearchPage.class,
|
| | | WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType,
|
| | | prevPage)).setEnabled(pageNumber > 1));
|
| | | add(new BookmarkablePageLink<Void>("nextPageBottom", SearchPage.class,
|
| | | add(new BookmarkablePageLink<Void>("nextPageBottom", GitSearchPage.class,
|
| | | WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType,
|
| | | nextPage)).setEnabled(hasMore));
|
| | |
|
File was renamed from src/com/gitblit/wicket/pages/LucenePage.html |
| | |
| | | <button class="btn btn-primary" type="submit" value="Search"><wicket:message key="gb.search"></wicket:message></button>
|
| | | </div>
|
| | | <div style="margin-top:10px;">
|
| | | <div style="margin-left:0px;" class="span4">
|
| | | <div style="margin-left:0px;" class="span3">
|
| | | <div class="alert alert">
|
| | | <b>type:</b> commit or blob<br/>
|
| | | <b>commit:</b> commit id<br/>
|
| | | <b>path:</b> blob path<br/>
|
| | | <b>path:</b> path/to/blob<br/>
|
| | | <b>branch:</b> refs/heads/master<br/>
|
| | | <b>author:</b><br/>
|
| | | <b>committer:</b><br/>
|
| | | <b>tag:</b> tag<br/>
|
| | | <b>author:</b> or <b>committer:</b> |
| | | </div>
|
| | | </div>
|
| | | <div class="span5">
|
| | | <div class="span4"> |
| | | <div class="alert alert-info">
|
| | | type:commit AND "bug fix"<br/>
|
| | | type:commit AND author:james*<br/>
|
| | | type:blob AND "int errorCode"<br/>
|
| | | type:blob AND test AND path:*.java<br/>
|
| | | commit:d91e5*
|
| | | </div>
|
| | | </div>
|
| | | <div class="span2">
|
| | | <wicket:message key="gb.queryHelp"></wicket:message>
|
| | | </div>
|
| | | </div>
|
File was renamed from src/com/gitblit/wicket/pages/LucenePage.java |
| | |
| | | import com.gitblit.wicket.panels.LinkPanel;
|
| | | import com.gitblit.wicket.panels.PagerPanel;
|
| | |
|
| | | public class LucenePage extends RootPage {
|
| | | public class LuceneSearchPage extends RootPage {
|
| | |
|
| | | public LucenePage() {
|
| | | public LuceneSearchPage() {
|
| | | super();
|
| | | setup(null);
|
| | | }
|
| | |
|
| | | public LucenePage(PageParameters params) {
|
| | | public LuceneSearchPage(PageParameters params) {
|
| | | super(params);
|
| | | setup(params);
|
| | | }
|
| | |
| | | PageParameters params = new PageParameters();
|
| | | params.put("repositories", StringUtils.flattenStrings(repositoriesModel.getObject()));
|
| | | params.put("query", queryModel.getObject());
|
| | | setResponsePage(LucenePage.class, params);
|
| | | setResponsePage(LuceneSearchPage.class, params);
|
| | | }
|
| | | };
|
| | |
|
| | | ListMultipleChoice<String> selections = new ListMultipleChoice<String>("repositories",
|
| | | repositoriesModel, availableRepositories, new StringChoiceRenderer());
|
| | | selections.setMaxRows(10);
|
| | | selections.setMaxRows(8);
|
| | | form.add(selections);
|
| | | form.add(new TextField<String>("query", queryModel));
|
| | | add(form);
|
| | |
| | | totalPages = (results.get(0).totalHits / pageSize) + (results.get(0).totalHits % pageSize > 0 ? 1 : 0);
|
| | | }
|
| | |
|
| | | add(new PagerPanel("topPager", page, totalPages, LucenePage.class, pagerParams));
|
| | | add(new PagerPanel("bottomPager", page, totalPages, LucenePage.class, pagerParams));
|
| | | add(new PagerPanel("topPager", page, totalPages, LuceneSearchPage.class, pagerParams));
|
| | | add(new PagerPanel("bottomPager", page, totalPages, LuceneSearchPage.class, pagerParams));
|
| | | }
|
| | |
|
| | | // private String buildPager(int currentPage, int count, int total) {
|
| | |
| | | import com.gitblit.PagesServlet;
|
| | | import com.gitblit.SyndicationServlet;
|
| | | import com.gitblit.models.RepositoryModel;
|
| | | import com.gitblit.utils.ArrayUtils;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.utils.TicgitUtils;
|
| | | import com.gitblit.wicket.GitBlitWebApp;
|
| | | import com.gitblit.wicket.GitBlitWebSession;
|
| | | import com.gitblit.wicket.PageRegistration;
|
| | | import com.gitblit.wicket.PageRegistration.OtherPageLink;
|
| | |
| | |
|
| | | protected Component createPersonPanel(String wicketId, PersonIdent identity,
|
| | | Constants.SearchType searchType) {
|
| | | GitBlitWebApp app = (GitBlitWebApp) GitBlitWebSession.get().getApplication();
|
| | | final Class<? extends BasePage> searchPageClass = app.getSearchPageClass();
|
| | | String name = identity == null ? "" : identity.getName();
|
| | | String address = identity == null ? "" : identity.getEmailAddress();
|
| | | boolean showEmail = GitBlit.getBoolean(Keys.web.showEmailAddresses, false);
|
| | |
| | | }
|
| | | }
|
| | | Fragment partial = new Fragment(wicketId, "partialPersonIdent", this);
|
| | | LinkPanel link = new LinkPanel("personName", "list", value, searchPageClass,
|
| | | LinkPanel link = new LinkPanel("personName", "list", value, GitSearchPage.class,
|
| | | WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType));
|
| | | setPersonSearchTooltip(link, value, searchType);
|
| | | partial.add(link);
|
| | | return partial;
|
| | | } else {
|
| | | Fragment fullPerson = new Fragment(wicketId, "fullPersonIdent", this);
|
| | | LinkPanel nameLink = new LinkPanel("personName", "list", name, searchPageClass,
|
| | | LinkPanel nameLink = new LinkPanel("personName", "list", name, GitSearchPage.class,
|
| | | WicketUtils.newSearchParameter(repositoryName, objectId, name, searchType));
|
| | | setPersonSearchTooltip(nameLink, name, searchType);
|
| | | fullPerson.add(nameLink);
|
| | |
|
| | | LinkPanel addressLink = new LinkPanel("personAddress", "list", "<" + address + ">",
|
| | | searchPageClass, WicketUtils.newSearchParameter(repositoryName, objectId,
|
| | | GitSearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId,
|
| | | address, searchType));
|
| | | setPersonSearchTooltip(addressLink, address, searchType);
|
| | | fullPerson.add(addressLink);
|
| | |
| | | break;
|
| | | }
|
| | | }
|
| | | GitBlitWebApp app = (GitBlitWebApp) GitBlitWebSession.get().getApplication();
|
| | | setResponsePage(app.getSearchPageClass(),
|
| | | Class<? extends BasePage> searchPageClass = GitSearchPage.class;
|
| | | RepositoryModel model = GitBlit.self().getRepositoryModel(repositoryName);
|
| | | if (!ArrayUtils.isEmpty(model.indexedBranches)) {
|
| | | // this repository is Lucene-indexed
|
| | | searchPageClass = LuceneSearchPage.class;
|
| | | }
|
| | | setResponsePage(searchPageClass,
|
| | | WicketUtils.newSearchParameter(repositoryName, null, searchString, searchType));
|
| | | }
|
| | | }
|
| | |
| | | getRootPageParameters()));
|
| | | pages.add(new PageRegistration("gb.activity", ActivityPage.class, getRootPageParameters()));
|
| | | if (GitBlit.getBoolean(Keys.lucene.enable, false)) {
|
| | | pages.add(new PageRegistration("gb.search", LucenePage.class));
|
| | | pages.add(new PageRegistration("gb.search", LuceneSearchPage.class));
|
| | | }
|
| | | if (showAdmin) {
|
| | | pages.add(new PageRegistration("gb.users", UsersPage.class));
|
| | |
| | | import com.gitblit.models.Activity;
|
| | | import com.gitblit.models.Activity.RepositoryCommit;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.wicket.GitBlitWebApp;
|
| | | import com.gitblit.wicket.GitBlitWebSession;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.pages.BasePage;
|
| | | import com.gitblit.wicket.pages.CommitDiffPage;
|
| | | import com.gitblit.wicket.pages.CommitPage;
|
| | | import com.gitblit.wicket.pages.LogPage;
|
| | | import com.gitblit.wicket.pages.SearchPage;
|
| | | import com.gitblit.wicket.pages.GitSearchPage;
|
| | | import com.gitblit.wicket.pages.SummaryPage;
|
| | | import com.gitblit.wicket.pages.TreePage;
|
| | |
|
| | |
| | | super(wicketId);
|
| | |
|
| | | Collections.sort(recentActivity);
|
| | | |
| | | GitBlitWebApp app = (GitBlitWebApp) GitBlitWebSession.get().getApplication();
|
| | | final Class<? extends BasePage> searchPageClass = app.getSearchPageClass();
|
| | |
|
| | | DataView<Activity> activityView = new DataView<Activity>("activity",
|
| | | new ListDataProvider<Activity>(recentActivity)) {
|
| | |
| | | // author search link
|
| | | String author = commit.getAuthorIdent().getName();
|
| | | LinkPanel authorLink = new LinkPanel("author", "list", author,
|
| | | searchPageClass, WicketUtils.newSearchParameter(commit.repository,
|
| | | GitSearchPage.class, WicketUtils.newSearchParameter(commit.repository,
|
| | | commit.getName(), author, Constants.SearchType.AUTHOR), true);
|
| | | setPersonSearchTooltip(authorLink, author, Constants.SearchType.AUTHOR);
|
| | | fragment.add(authorLink);
|
| | |
| | | import com.gitblit.models.RepositoryModel;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.wicket.GitBlitWebApp;
|
| | | import com.gitblit.wicket.GitBlitWebSession;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.pages.BasePage;
|
| | | import com.gitblit.wicket.pages.BranchesPage;
|
| | | import com.gitblit.wicket.pages.CommitPage;
|
| | | import com.gitblit.wicket.pages.LogPage;
|
| | | import com.gitblit.wicket.pages.MetricsPage;
|
| | | import com.gitblit.wicket.pages.SearchPage;
|
| | | import com.gitblit.wicket.pages.GitSearchPage;
|
| | | import com.gitblit.wicket.pages.TreePage;
|
| | |
|
| | | public class BranchesPanel extends BasePanel {
|
| | |
| | | add(new Label("branches", new StringResourceModel("gb.branches", this, null)));
|
| | | }
|
| | |
|
| | | GitBlitWebApp app = (GitBlitWebApp) GitBlitWebSession.get().getApplication();
|
| | | final Class<? extends BasePage> searchPageClass = app.getSearchPageClass();
|
| | |
|
| | | ListDataProvider<RefModel> branchesDp = new ListDataProvider<RefModel>(branches);
|
| | | DataView<RefModel> branchesView = new DataView<RefModel>("branch", branchesDp) {
|
| | | private static final long serialVersionUID = 1L;
|
| | |
| | |
|
| | | String author = entry.getAuthorIdent().getName();
|
| | | LinkPanel authorLink = new LinkPanel("branchAuthor", "list", author,
|
| | | searchPageClass, WicketUtils.newSearchParameter(model.name,
|
| | | GitSearchPage.class, WicketUtils.newSearchParameter(model.name,
|
| | | entry.getName(), author, Constants.SearchType.AUTHOR));
|
| | | setPersonSearchTooltip(authorLink, author, Constants.SearchType.AUTHOR);
|
| | | item.add(authorLink);
|
| | |
| | | import com.gitblit.models.RefModel;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.wicket.GitBlitWebApp;
|
| | | import com.gitblit.wicket.GitBlitWebSession;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.pages.BasePage;
|
| | | import com.gitblit.wicket.pages.BlobDiffPage;
|
| | | import com.gitblit.wicket.pages.BlobPage;
|
| | | import com.gitblit.wicket.pages.CommitDiffPage;
|
| | | import com.gitblit.wicket.pages.CommitPage;
|
| | | import com.gitblit.wicket.pages.HistoryPage;
|
| | | import com.gitblit.wicket.pages.SearchPage;
|
| | | import com.gitblit.wicket.pages.GitSearchPage;
|
| | | import com.gitblit.wicket.pages.TreePage;
|
| | |
|
| | | public class HistoryPanel extends BasePanel {
|
| | |
| | | // breadcrumbs
|
| | | add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, path, objectId));
|
| | |
|
| | | GitBlitWebApp app = (GitBlitWebApp) GitBlitWebSession.get().getApplication();
|
| | | final Class<? extends BasePage> searchPageClass = app.getSearchPageClass();
|
| | |
|
| | | ListDataProvider<RevCommit> dp = new ListDataProvider<RevCommit>(commits);
|
| | | DataView<RevCommit> logView = new DataView<RevCommit>("commit", dp) {
|
| | | private static final long serialVersionUID = 1L;
|
| | |
| | | // author search link
|
| | | String author = entry.getAuthorIdent().getName();
|
| | | LinkPanel authorLink = new LinkPanel("commitAuthor", "list", author,
|
| | | searchPageClass, WicketUtils.newSearchParameter(repositoryName, objectId,
|
| | | GitSearchPage.class,
|
| | | WicketUtils.newSearchParameter(repositoryName, objectId,
|
| | | author, Constants.SearchType.AUTHOR));
|
| | | setPersonSearchTooltip(authorLink, author, Constants.SearchType.AUTHOR);
|
| | | item.add(authorLink);
|
| | |
| | | import com.gitblit.models.RefModel;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.wicket.GitBlitWebApp;
|
| | | import com.gitblit.wicket.GitBlitWebSession;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.pages.BasePage;
|
| | | import com.gitblit.wicket.pages.CommitDiffPage;
|
| | | import com.gitblit.wicket.pages.CommitPage;
|
| | | import com.gitblit.wicket.pages.LogPage;
|
| | | import com.gitblit.wicket.pages.SearchPage;
|
| | | import com.gitblit.wicket.pages.GitSearchPage;
|
| | | import com.gitblit.wicket.pages.TreePage;
|
| | |
|
| | | public class LogPanel extends BasePanel {
|
| | |
| | | WicketUtils.newRepositoryParameter(repositoryName)));
|
| | | }
|
| | |
|
| | | GitBlitWebApp app = (GitBlitWebApp) GitBlitWebSession.get().getApplication();
|
| | | final Class<? extends BasePage> searchPageClass = app.getSearchPageClass();
|
| | |
|
| | | ListDataProvider<RevCommit> dp = new ListDataProvider<RevCommit>(commits);
|
| | | DataView<RevCommit> logView = new DataView<RevCommit>("commit", dp) {
|
| | | private static final long serialVersionUID = 1L;
|
| | |
| | | // author search link
|
| | | String author = entry.getAuthorIdent().getName();
|
| | | LinkPanel authorLink = new LinkPanel("commitAuthor", "list", author,
|
| | | searchPageClass, WicketUtils.newSearchParameter(repositoryName, objectId,
|
| | | author, Constants.SearchType.AUTHOR));
|
| | | GitSearchPage.class, WicketUtils.newSearchParameter(repositoryName,
|
| | | objectId, author, Constants.SearchType.AUTHOR));
|
| | | setPersonSearchTooltip(authorLink, author, Constants.SearchType.AUTHOR);
|
| | | item.add(authorLink);
|
| | |
|
| | |
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.pages.CommitDiffPage;
|
| | | import com.gitblit.wicket.pages.CommitPage;
|
| | | import com.gitblit.wicket.pages.SearchPage;
|
| | | import com.gitblit.wicket.pages.GitSearchPage;
|
| | | import com.gitblit.wicket.pages.TreePage;
|
| | |
|
| | | public class SearchPanel extends BasePanel {
|
| | |
| | | // author search link
|
| | | String author = entry.getAuthorIdent().getName();
|
| | | LinkPanel authorLink = new LinkPanel("commitAuthor", "list", author,
|
| | | SearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId,
|
| | | GitSearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId,
|
| | | author, Constants.SearchType.AUTHOR));
|
| | | setPersonSearchTooltip(authorLink, author, Constants.SearchType.AUTHOR);
|
| | | item.add(authorLink);
|