Juan Carlos Picado Herrera avatar Juan Carlos Picado Herrera committed 4b59e70

ENCUESTAME-137 Renamed interface

Comments (0)

Files changed (4)

encuestame-business/src/main/java/org/encuestame/business/search/GlobalSearchItem.java

+/*
+ ************************************************************************************
+ * Copyright (C) 2001-2011 encuestame: system online surveys Copyright (C) 2009
+ * encuestame Development Team.
+ * Licensed under the Apache Software License version 2.0
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to  in writing,  software  distributed
+ * under the License is distributed  on  an  "AS IS"  BASIS,  WITHOUT  WARRANTIES  OR
+ * CONDITIONS OF ANY KIND, either  express  or  implied.  See  the  License  for  the
+ * specific language governing permissions and limitations under the License.
+ ************************************************************************************
+ */
+package org.encuestame.business.search;
+
+
+public class GlobalSearchItem {
+
+    //private String
+
+
+}

encuestame-business/src/main/java/org/encuestame/business/service/SearchService.java

 import org.apache.lucene.search.Searcher;
 import org.apache.lucene.search.TopScoreDocCollector;
 import org.apache.lucene.util.Version;
-import org.encuestame.business.service.imp.ISearchService;
+import org.encuestame.business.service.imp.SearchServiceOperations;
 import org.encuestame.persistence.domain.survey.Poll;
 import org.encuestame.search.utils.Search;
 
 /**
  * Search Service.
+ *
  * @author Morales, Diana Paola paola AT encuestame.org
  * @since February 09, 2011
  * @version $Id$
  */
-public class SearchService extends AbstractIndexService  implements ISearchService {
+public class SearchService extends AbstractIndexService implements
+        SearchServiceOperations {
 
     private Search search;
 
-    public void indexDocument(final String indexDirPath, final String indexDirStore) throws IOException{
+    public void indexDocument(final String indexDirPath,
+            final String indexDirStore) throws IOException {
         search.getIndexer(indexDirPath);
 
     }
 
-    public void searchContent(final String dirPath){
+    public void searchContent(final String dirPath) {
 
     }
 
-    public void IndexPoll(Poll poll, String path) throws IOException{
+    public void IndexPoll(Poll poll, String path) throws IOException {
 
     }
 
     /**************************************************************************/
 
-
-
-    public List<Poll> searchPolls(String searchString, String path, String fieldName,
-            int results) throws IOException, ParseException {
+    public List<Poll> searchPolls(String searchString, String path,
+            String fieldName, int results) throws IOException, ParseException {
         List<Poll> pollList = new ArrayList<Poll>();
-        //IndexReader reader = IndexReader.open(path, true);
-        //IndexReader reader = IndexReader.open(path);
-        //Searcher searcher = new IndexSearcher(reader);
+        // IndexReader reader = IndexReader.open(path, true);
+        // IndexReader reader = IndexReader.open(path);
+        // Searcher searcher = new IndexSearcher(reader);
         Searcher searcher = null;
         QueryParser qp = new QueryParser(Version.LUCENE_29, fieldName,
                 new StandardAnalyzer(Version.LUCENE_29));
         return pollList;
     }
 
-
     public Map<String, Object> searchPollPaginateResults(String searchString,
             String path, String fieldName, int page, int results)
             throws IOException, ParseException {
         Map<String, Object> map = new HashMap<String, Object>();
         List<Poll> articles = new ArrayList<Poll>();
-        //Searcher searcher = new IndexSearcher(IndexReader.open(path));
-        //IndexReader reader = IndexReader.open(path);
-        //Searcher searcher = new IndexSearcher(reader);
+        // Searcher searcher = new IndexSearcher(IndexReader.open(path));
+        // IndexReader reader = IndexReader.open(path);
+        // Searcher searcher = new IndexSearcher(reader);
         Searcher searcher = null;
         QueryParser qp = new QueryParser(Version.LUCENE_29, fieldName,
                 new StandardAnalyzer(Version.LUCENE_29));
         Query query = qp.parse(searchString);
-        TopScoreDocCollector collector = TopScoreDocCollector.create(page * results, true);
+        TopScoreDocCollector collector = TopScoreDocCollector.create(page
+                * results, true);
         searcher.search(query, collector);
         ScoreDoc[] docs = collector.topDocs().scoreDocs;
         map.put("resultados", collector.getTotalHits());
         return map;
     }
 
-
-    public List<Poll> searchArticle(String searchString, String path, String fieldName,
-            int results) throws IOException, ParseException {
+    public List<Poll> searchArticle(String searchString, String path,
+            String fieldName, int results) throws IOException, ParseException {
         List<Poll> articles = new ArrayList<Poll>();
-        //IndexReader reader = IndexReader.open(path);
-        //Searcher searcher = new IndexSearcher(reader);
+        // IndexReader reader = IndexReader.open(path);
+        // Searcher searcher = new IndexSearcher(reader);
         Searcher searcher = null;
         QueryParser qp = new QueryParser(Version.LUCENE_29, fieldName,
                 new StandardAnalyzer(Version.LUCENE_29));
         return articles;
     }
 
-    public void searchArticleWithPagination(String path)
-        throws IOException, ParseException {
+    public void searchArticleWithPagination(String path) throws IOException,
+            ParseException {
         SearchService searcher = new SearchService();
-        Map<String, Object> map = searcher.searchPollPaginateResults("articulo", path, "POLLNAME", 1, 2);
+        Map<String, Object> map = searcher.searchPollPaginateResults(
+                "articulo", path, "POLLNAME", 1, 2);
         List<Poll> articles = (List<Poll>) map.get("articulos");
-        System.out.println("Búsqueda finalizada, resultados: " + articles.size() + " de " + map.get("resultados"));
+        System.out.println("Búsqueda finalizada, resultados: "
+                + articles.size() + " de " + map.get("resultados"));
         for (Poll articlePoll : articles) {
-        System.out.println("ID " + articlePoll.getPollId());
-        System.out.println("NAME POLL " + articlePoll.getName());
+            System.out.println("ID " + articlePoll.getPollId());
+            System.out.println("NAME POLL " + articlePoll.getName());
         }
     }
 
-
     private Document generateDocumentFromPoll(Poll poll) {
         Document doc = new Document();
         doc.add(new Field("ID", String.valueOf(poll.getPollId()),
                 Field.Store.YES, Field.Index.NO));
-        doc.add(new Field("POLLNAME", poll.getName(),
-                Field.Store.YES, Field.Index.ANALYZED));
+        doc.add(new Field("POLLNAME", poll.getName(), Field.Store.YES,
+                Field.Index.ANALYZED));
         return doc;
     }
 
     public void indexPoll(Poll poll, String path) throws IOException {
         IndexWriter writer = search.getIndexer(path);
-         try {
+        try {
             Document doc = generateDocumentFromPoll(poll);
             writer.addDocument(doc);
             writer.commit();
         }
     }
 
-
 }

encuestame-business/src/main/java/org/encuestame/business/service/imp/ISearchService.java

-/*
- ************************************************************************************
- * Copyright (C) 2001-2009 encuestame: system online surveys Copyright (C) 2009
- * encuestame Development Team.
- * Licensed under the Apache Software License version 2.0
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to  in writing,  software  distributed
- * under the License is distributed  on  an  "AS IS"  BASIS,  WITHOUT  WARRANTIES  OR
- * CONDITIONS OF ANY KIND, either  express  or  implied.  See  the  License  for  the
- * specific language governing permissions and limitations under the License.
- ************************************************************************************
- */
-package org.encuestame.business.service.imp;
-
-/**
- * Search Service.
- * @author Morales, Diana Paola paola AT encuestame.org
- * @since February 09, 2011
- * @version $Id$
- */
-public interface ISearchService {
-
-}

encuestame-business/src/main/java/org/encuestame/business/service/imp/SearchServiceOperations.java

+/*
+ ************************************************************************************
+ * Copyright (C) 2001-2009 encuestame: system online surveys Copyright (C) 2009
+ * encuestame Development Team.
+ * Licensed under the Apache Software License version 2.0
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to  in writing,  software  distributed
+ * under the License is distributed  on  an  "AS IS"  BASIS,  WITHOUT  WARRANTIES  OR
+ * CONDITIONS OF ANY KIND, either  express  or  implied.  See  the  License  for  the
+ * specific language governing permissions and limitations under the License.
+ ************************************************************************************
+ */
+package org.encuestame.business.service.imp;
+
+/**
+ * Search Service Operations.
+ * @author Morales, Diana Paola paola AT encuestame.org
+ * @since February 09, 2011
+ */
+public interface SearchServiceOperations {
+
+
+
+}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.