Files
ofbiz-framework/applications/content/widget/cms/index.bsh
T
Jacopo Cappellato d4d3f3d355 License change from MIT to ASL2.0 for the files of the content component.
Thanks to Scott Gray for the patch (Apache OFBIZ-87).

git-svn-id: https://svn.apache.org/repos/asf/incubator/ofbiz/trunk@422872 13f79535-47bb-0310-9956-ffa450edef68
2006-07-17 21:12:16 +00:00

69 lines
2.7 KiB
Plaintext

/*
* Copyright 2001-2006 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. 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.
*/
import org.ofbiz.base.util.UtilHttp;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.StringUtil;
import org.ofbiz.content.search.SearchWorker;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.search.Searcher;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.Hits;
import org.apache.lucene.queryParser.QueryParser;
import org.ofbiz.widget.html.HtmlFormWrapper;
delegator = request.getAttribute("delegator");
paramMap = UtilHttp.getParameterMap(request);
indexContentIds = paramMap.get("indexContentIds");
Debug.logInfo("in search, indexContentIds:" + indexContentIds, "");
indexAll = paramMap.get("indexAll");
Debug.logInfo("in search, indexAll:" + indexAll, "");
/*
formDefFile = page.getProperty("formDefFile");
singleFormName = page.getProperty("singleFormName");
HtmlFormWrapper singleWrapper = new HtmlFormWrapper(formDefFile, singleFormName, request, response);
context.put("singleWrapper", singleWrapper);
singleFormName2 = page.getProperty("singleFormName2");
HtmlFormWrapper singleWrapper2 = new HtmlFormWrapper(formDefFile, singleFormName2, request, response);
context.put("singleWrapper2", singleWrapper2);
*/
if (UtilValidate.isEmpty(indexAll) || !indexAll.equalsIgnoreCase("true")) {
if (UtilValidate.isNotEmpty(indexContentIds)) {
context = new HashMap();
contentIdList = StringUtil.split(indexContentIds, " " );
Debug.logInfo("in index, contentIdList:" + contentIdList, "");
SearchWorker.indexContentList(contentIdList, delegator, context);
//iter = contentIdList.iterator();
//while (iter.hasNext()) {
//contentId = iter.next();
//Debug.logInfo("in search, contentId:" + contentId, "");
//SearchWorker.indexContent(contentId, null, delegator, context);
//}
}
} else {
request.setAttribute("errorMsgReq", "Index all not operable.");
}