Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Search Engine (issue 535) #97

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3916bcd
Added search bar UI
halfcurry May 18, 2017
17b6d5f
Worked on SearchResults classes
halfcurry May 23, 2017
e052d70
New tab opens but is Singleton
halfcurry May 26, 2017
e3a44e5
Work on Search results page title
halfcurry May 29, 2017
695f257
Multiple tabs open but bugs exist
halfcurry May 31, 2017
5f749b4
Attempt at connecting to Solr Server
halfcurry Jun 4, 2017
883460a
Minor changes to the search classes
halfcurry Jun 7, 2017
34597da
Added an index button to do full import
halfcurry Jun 9, 2017
c08b492
Attempt at presentation of results on screen
halfcurry Jun 12, 2017
cfa0418
Results rendering but views not changing
halfcurry Jun 13, 2017
882cc0e
Fixed Search results view changing issue and cleaned code
halfcurry Jun 14, 2017
8dd81b4
[Issue #535]: Attempt at opening a project on clicking project search…
halfcurry Jun 22, 2017
b533347
[Issue #535]:Contacts, OrgUnits open on clicking results
halfcurry Jun 27, 2017
0fc5440
[Issue 535]: Made search results pretty
halfcurry Jun 28, 2017
049a3ee
[Issue 535]:Added search filtering and resolved first-time connection…
halfcurry Jun 28, 2017
14db114
[Issue #535]:Added icons to differentiate between types of results
halfcurry Jun 30, 2017
9d15b0a
[Issue #535]:Added filtering (using existing permissions of user) for…
halfcurry Jul 5, 2017
d3e1fb3
[Issue #535]: Contacts and OrgUnits permmission filtering and cleanin…
halfcurry Jul 7, 2017
dd095d6
[Issue #535]: Added an auto full-data import indexing job
halfcurry Jul 9, 2017
0604656
[Issue #535]: Modified pom.xml to include global sigmah core url prop…
halfcurry Jul 9, 2017
1fd1e1c
[Issue #535]:Added solr sonfig files
halfcurry Jul 10, 2017
44ef000
[Issue #535]: Added a panel in admin settings for solr settings
halfcurry Jul 16, 2017
bec9e80
[Issue #535]:Added a column to table organization to store and use so…
halfcurry Jul 19, 2017
ae9af1a
[Issue #535]:Multiple failed attempts at querying the database for a …
halfcurry Jul 28, 2017
b235197
[Issue #535]:Added File indexing capability via existing command patt…
halfcurry Jul 30, 2017
9b2bdd4
[Issue #535]:Small error in last commit
halfcurry Jul 30, 2017
1f7d1f3
[Issue #535]:Modified automatic and manual indexing to include files …
halfcurry Jul 30, 2017
035c728
[Issue #535]:Presentation of files in search results
halfcurry Aug 2, 2017
05abe0b
[Issue #535]:Made UI changes and very rudimentary files results filte…
halfcurry Aug 5, 2017
fb2f93e
[Issue #535]:Multiple changes to UIs of search bar, results and admin
halfcurry Aug 6, 2017
39b19a1
[Issue #535]:Added proper errror messages for different cases
halfcurry Aug 8, 2017
6b2ed5f
[Issue #535]:Code cleanup #1
halfcurry Aug 12, 2017
4999b3a
[Issue #535]:Code cleanup #2, added comments
halfcurry Aug 12, 2017
8f9281a
[Issue #535]:Added Global Permission SEARCH for viewing search bar
halfcurry Aug 13, 2017
9df59b2
[Issue #535]:Added a search button image
halfcurry Aug 13, 2017
4e9ea32
[Issue #535]:Final few changes and code cleanup
halfcurry Aug 21, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
<hibernate.dialect>org.hibernate.dialect.PostgreSQLDialect</hibernate.dialect>
<hibernate.connection.driver_class>org.postgresql.Driver</hibernate.connection.driver_class>
<hibernate.hbm2ddl.auto>update</hibernate.hbm2ddl.auto>
<hibernate.show_sql>true</hibernate.show_sql>
<hibernate.show_sql>false</hibernate.show_sql>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My two cents about this: instead of modifying the common pom.xml file, you should rather maintain your own Maven settings.xml file as very recently documented here: http://wiki.sigmah.org/doku.php?id=contributorguide:preparebuildenvironment#step_3your_first_build

Enjoy !

<hibernate.format_sql>true</hibernate.format_sql>
<hibernate.connection.url>${sigmah.database.url}</hibernate.connection.url>
<hibernate.connection.username>${sigmah.database.user}</hibernate.connection.username>
Expand Down Expand Up @@ -551,6 +551,15 @@
<artifactId>mail</artifactId>
<version>1.4.5</version>
</dependency>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please ignore any local changes I have made. The only one which matters is this solr dependency.

<!-- SolrJ -->
<dependency>
<artifactId>solr-solrj</artifactId>
<groupId>org.apache.solr</groupId>
<version>6.5.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>

<!-- MISC -->
<dependency>
Expand Down Expand Up @@ -1039,6 +1048,13 @@
<id>sigmah-dev</id>
<properties>

<!-- Overrride properties for your local profile here... -->
<sigmah.database.url>jdbc:postgresql://localhost:5432/sigmah_demo</sigmah.database.url>
<sigmah.database.user>sigmah</sigmah.database.user>
<sigmah.database.password>hamsig</sigmah.database.password>
<files.repository.name>/home/sigmah_dev</files.repository.name>
<archives.repository.name>/home/sigmah_dev/archives</archives.repository.name>

<gwt.style>PRETTY</gwt.style>

<!-- Logger properties. -->
Expand All @@ -1047,7 +1063,7 @@

<!-- Hibernate properties. -->

<hibernate.show_sql>true</hibernate.show_sql>
<hibernate.show_sql>false</hibernate.show_sql>

<!-- Mailer properties. -->

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/sigmah/client/Sigmah.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ private void clientInitializing() {
injector.getAppLoaderPresenter();
injector.getMenuBannerPresenter();
injector.getMessageBannerPresenter();
injector.getSearchPresenter();

// Pages.
injector.getLoginPresenter();
Expand Down Expand Up @@ -165,6 +166,7 @@ private void clientInitializing() {
injector.getReportCreatePresenter();
injector.getAttachFilePresenter();
injector.getImportationPresenter();
injector.getSearchResultsPresenter();

injector.getAdminPresenter();
injector.getUsersAdminPresenter();
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/sigmah/client/inject/ClientModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.sigmah.client.security.AuthenticationProvider;
import org.sigmah.client.security.SecureDispatchAsync;
import org.sigmah.client.security.SecureExceptionHandler;
import org.sigmah.client.ui.presenter.zone.SearchPresenter;
import org.sigmah.client.ui.theme.SigmahTheme;
import org.sigmah.client.ui.theme.Theme;

Expand Down Expand Up @@ -66,6 +67,9 @@ protected void configure() {
// StateManager (for indicators).
bind(IStateManager.class).to(GXTStateManager.class);

//possibly later, also other search related classes, like results view
//bind(SearchPresenter.class).in(Singleton.class);

}

}
6 changes: 6 additions & 0 deletions src/main/java/org/sigmah/client/inject/Injector.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.sigmah.client.ui.presenter.HelpPresenter;
import org.sigmah.client.ui.presenter.LoginPresenter;
import org.sigmah.client.ui.presenter.MockUpPresenter;
import org.sigmah.client.ui.presenter.SearchResultsPresenter;
import org.sigmah.client.ui.presenter.admin.AdminPresenter;
import org.sigmah.client.ui.presenter.admin.CategoriesAdminPresenter;
import org.sigmah.client.ui.presenter.admin.ParametersAdminPresenter;
Expand Down Expand Up @@ -99,6 +100,7 @@
import org.sigmah.client.ui.presenter.zone.MessageBannerPresenter;
import org.sigmah.client.ui.presenter.zone.OfflineBannerPresenter;
import org.sigmah.client.ui.presenter.zone.OrganizationBannerPresenter;
import org.sigmah.client.ui.presenter.zone.SearchPresenter;
import org.sigmah.client.ui.theme.Theme;
import org.sigmah.offline.dao.FileDataAsyncDAO;
import org.sigmah.offline.dao.TransfertAsyncDAO;
Expand Down Expand Up @@ -178,6 +180,8 @@ public interface Injector extends Ginjector {
MenuBannerPresenter getMenuBannerPresenter();

MessageBannerPresenter getMessageBannerPresenter();

SearchPresenter getSearchPresenter();

CreditsPresenter getCreditsPresenter();

Expand All @@ -204,6 +208,8 @@ public interface Injector extends Ginjector {
AttachFilePresenter getAttachFilePresenter();

ImportationPresenter getImportationPresenter();

SearchResultsPresenter getSearchResultsPresenter();

// ---- Project presenters.

Expand Down
6 changes: 5 additions & 1 deletion src/main/java/org/sigmah/client/page/Page.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ public enum Page implements IsSerializable {
CREDITS("credits", true),
HELP("help", true),
CREATE_PROJECT("create-project", true),
IMPORT_VALUES("import-values"), ;
IMPORT_VALUES("import-values"),
//aditya
SEARCH_RESULTS("search-results") ;

private final String parentKey;
private final String token;
Expand Down Expand Up @@ -320,6 +322,8 @@ public static String getTitle(final Page page) {
return I18N.CONSTANTS.adminboard();
case CREATE_PROJECT:
return I18N.CONSTANTS.createProject();
case SEARCH_RESULTS:
return "Search Results";
default:
return PropertyName.error(page.token);
}
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/org/sigmah/client/search/SearchService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.sigmah.client.search;

import java.util.ArrayList;

import org.sigmah.shared.dto.search.SearchResultsDTO;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

@RemoteServiceRelativePath("search")
public interface SearchService extends RemoteService {
//TODO Add method stubs here
ArrayList<SearchResultsDTO> search(String searchStr);
Boolean index();
}
13 changes: 13 additions & 0 deletions src/main/java/org/sigmah/client/search/SearchServiceAsync.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.sigmah.client.search;

import java.util.ArrayList;

import org.sigmah.shared.dto.search.SearchResultsDTO;
import com.google.gwt.user.client.rpc.AsyncCallback;


public interface SearchServiceAsync {

public void search(String searchStr, AsyncCallback<ArrayList<SearchResultsDTO>> callback);
public void index(AsyncCallback<Boolean> callback);
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.sigmah.client.ui.presenter.zone.MessageBannerPresenter;
import org.sigmah.client.ui.presenter.zone.OfflineBannerPresenter;
import org.sigmah.client.ui.presenter.zone.OrganizationBannerPresenter;
import org.sigmah.client.ui.presenter.zone.SearchPresenter;
import org.sigmah.client.ui.view.ApplicationView;
import org.sigmah.client.ui.view.base.ViewInterface;
import org.sigmah.client.ui.view.base.ViewPopupInterface;
Expand Down Expand Up @@ -95,7 +96,7 @@ public static interface View extends ViewInterface {
*/
void initZones(OrganizationBannerPresenter.View organizationBannerView, AuthenticationBannerPresenter.View authenticationBannerPresenter,
OfflineBannerPresenter.View offlineBannerPresenter, AppLoaderPresenter.View appLoaderPresenter, MenuBannerPresenter.View menuBannerPresenter,
MessageBannerPresenter.View messageBannerPresenter);
MessageBannerPresenter.View messageBannerPresenter, SearchPresenter.View searchPresenter);

/**
* Returns the <em>credits</em> widget capable of handling a {@code ClickHandler}.
Expand Down Expand Up @@ -142,7 +143,7 @@ public ApplicationPresenter(final View view, final Injector injector) {

view.initZones(injector.getOrganizationBannerPresenter().getView(), injector.getAuthenticationBannerPresenter().getView(), injector
.getOfflineBannerPresenter().getView(), injector.getAppLoaderPresenter().getView(), injector.getMenuBannerPresenter().getView(), injector
.getMessageBannerPresenter().getView());
.getMessageBannerPresenter().getView(), injector.getSearchPresenter().getView());

}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
package org.sigmah.client.ui.presenter;

import java.io.IOException;

/*
* #%L
* Sigmah
* %%
* Copyright (C) 2010 - 2016 URD
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/


import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.sigmah.client.dispatch.CommandResultHandler;
import org.sigmah.client.dispatch.monitor.LoadingMask;
import org.sigmah.client.i18n.I18N;
import org.sigmah.client.inject.Injector;
import org.sigmah.client.page.Page;
import org.sigmah.client.page.PageRequest;
import org.sigmah.client.page.RequestParameter;
import org.sigmah.client.search.SearchService;
import org.sigmah.client.search.SearchServiceAsync;
import org.sigmah.client.ui.presenter.base.AbstractPagePresenter;
import org.sigmah.client.ui.presenter.contact.dashboardlist.ContactsListWidget;
import org.sigmah.client.ui.presenter.project.treegrid.ProjectsListWidget;
import org.sigmah.client.ui.presenter.project.treegrid.ProjectsListWidget.LoadingMode;
import org.sigmah.client.ui.presenter.project.treegrid.ProjectsListWidget.RefreshMode;
import org.sigmah.client.ui.res.icon.IconImageBundle;
import org.sigmah.client.ui.view.DashboardView;
import org.sigmah.client.ui.view.SearchResultsView;
import org.sigmah.client.ui.view.base.ViewInterface;
import org.sigmah.client.ui.widget.HasTreeGrid.TreeGridEventHandler;
import org.sigmah.client.ui.widget.WorkInProgressWidget;
import org.sigmah.client.ui.widget.orgunit.OrgUnitTreeGrid;
import org.sigmah.client.ui.widget.tab.Tab;
import org.sigmah.client.ui.widget.tab.TabId;
import org.sigmah.client.util.ClientUtils;
import org.sigmah.shared.command.GetMonitoredPoints;
import org.sigmah.shared.command.GetOrgUnits;
import org.sigmah.shared.command.GetReminders;
import org.sigmah.shared.command.result.ListResult;
import org.sigmah.shared.dto.orgunit.OrgUnitDTO;
import org.sigmah.shared.dto.referential.GlobalPermissionEnum;
import org.sigmah.shared.dto.reminder.MonitoredPointDTO;
import org.sigmah.shared.dto.reminder.ReminderDTO;
import org.sigmah.shared.util.ProfileUtils;

import com.allen_sauer.gwt.log.client.Log;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.Component;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.inject.ImplementedBy;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import org.sigmah.client.event.OfflineEvent;
import org.sigmah.client.event.UpdateEvent;
import org.sigmah.client.event.handler.OfflineHandler;
import org.sigmah.client.event.handler.UpdateHandler;
import org.sigmah.client.ui.notif.ConfirmCallback;
import org.sigmah.client.ui.notif.N10N;
import org.sigmah.client.ui.zone.Zone;
import org.sigmah.client.ui.zone.ZoneRequest;
import org.sigmah.client.util.profiler.Checkpoint;
import org.sigmah.client.util.profiler.Execution;
import org.sigmah.client.util.profiler.ExecutionAsyncDAO;
import org.sigmah.client.util.profiler.Profiler;
import org.sigmah.client.util.profiler.Scenario;
import org.sigmah.offline.status.ApplicationState;
import org.sigmah.offline.sync.UpdateDates;
import org.sigmah.shared.command.SendProbeReport;
import org.sigmah.shared.command.result.Result;
import org.sigmah.shared.conf.PropertyName;
import org.sigmah.shared.dto.profile.CheckPointDTO;
import org.sigmah.shared.dto.profile.ExecutionDTO;
import org.sigmah.shared.dto.search.SearchResultsDTO;

/**
* Dashboard page presenter.
*
* @author Tom Miette ([email protected])
* @author Denis Colliot ([email protected])
*/
@Singleton
public class SearchResultsPresenter extends AbstractPagePresenter<SearchResultsPresenter.View> {

/**
* View interface.
*/
@ImplementedBy(SearchResultsView.class)
public interface View extends ViewInterface {
void initialize(String searchText);
void addSearchData(Object searchData);
}

/**
* Presenters's initialization.
*
* @param view
* Presenter's view interface.
* @param injector
* Injected client injector.
*/
@Inject
public SearchResultsPresenter(final View view, final Injector injector) {
super(view, injector);
}

/**
* {@inheritDoc}
*/
@Override
public Page getPage() {
return Page.SEARCH_RESULTS;
}

@Override
public void onPageRequest(PageRequest request){
// TODO Auto-generated method stub
//view.initialize() is default
String title = request.getData(RequestParameter.TITLE).toString();
Window.alert("Title is " + title );
view.initialize(title);
view.addSearchData(request.getData(RequestParameter.CONTENT));
}


}
Loading