--- /dev/null
+/*
+ * Copyright (C) 2001, 2002, 2003 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir 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 Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+package mircoders.search;
+
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import mir.entity.Entity;
+import mir.entity.EntityList;
+import mir.storage.StorageObjectFailure;
+import mircoders.entity.EntityContent;
+import mircoders.storage.DatabaseContentToTopics;
+
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+
+
+public class TopicMatrixSearchTerm extends SearchTerm{
+
+
+ public static String matchField = "topic";
+ public static String paramName = "search_topicmatrix";
+
+ public void index(Document doc, Entity entity) throws StorageObjectFailure{
+ EntityList topics = DatabaseContentToTopics.getInstance().getTopics((EntityContent) entity);
+ if (topics != null && topics.size()>0){
+ for(int k=0;k<topics.size();k++){
+ doc.add(Field.UnStored(matchField,(topics.elementAt(k)).getValue("title")));
+ }
+ }
+ }
+
+ public String makeTerm(HttpServletRequest req){
+ String queryTerm = "";
+ for (int x=0;x<10;x++){
+ String[] values = req.getParameterValues("search_topicmatrix_"+Integer.toString(x));
+
+ if (values != null && values.length > 0){
+ String subqueryTerm = "(";
+ for (int i=0;i<values.length;i++){
+ subqueryTerm = subqueryTerm + " " + matchField + ":" + "\"" + values[i] + "\"";
+ }
+ subqueryTerm = subqueryTerm + ")";
+ queryTerm = queryTerm + " +" + subqueryTerm;
+ }
+ }
+ if (queryTerm.equals("")){
+ return null;
+ }
+ else {
+ return "( "+queryTerm+ " )";
+ }
+
+ }
+
+ public void returnMeta(Map result,Document doc){
+ return;
+ }
+
+
+}
+
+
import mircoders.search.KeywordSearchTerm;
import mircoders.search.TextSearchTerm;
import mircoders.search.TopicSearchTerm;
+import mircoders.search.TopicMatrixSearchTerm;
import mircoders.search.UnIndexedSearchTerm;
import mircoders.search.VideoSearchTerm;
import mircoders.storage.DatabaseComment;
* open-postings to the newswire
*
* @author mir-coders group
- * @version $Id: ServletModuleOpenIndy.java,v 1.89.2.1 2003/05/17 16:21:14 john Exp $
+ * @version $Id: ServletModuleOpenIndy.java,v 1.89.2.2 2003/06/03 20:58:30 john Exp $
*
*/
TextSearchTerm descriptionTerm = new TextSearchTerm("description", "search_content", "description", "description", "description");
ContentSearchTerm contentTerm = new ContentSearchTerm("content_data", "search_content", "content", "", "");
TopicSearchTerm topicTerm = new TopicSearchTerm();
+ TopicMatrixSearchTerm topicMatrixTerm = new TopicMatrixSearchTerm();
ImagesSearchTerm imagesTerm = new ImagesSearchTerm();
AudioSearchTerm audioTerm = new AudioSearchTerm();
VideoSearchTerm videoTerm = new VideoSearchTerm();
queryString = queryString + " +" + topicFragment;
}
+ String topicMatrixFragment = topicMatrixTerm.makeTerm(req);
+ if (topicMatrixFragment != null) {
+ queryString = queryString + " +" + topicMatrixFragment;
+ }
+
String imagesFragment = imagesTerm.makeTerm(req);
if (imagesFragment != null) {
queryString = queryString + " +" + imagesFragment;