lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: lucene-solr:master: LUCENE-8291: Build Fix. Removing Demo Servlet.
Date Wed, 16 May 2018 06:45:07 GMT
Thanks!

I forgot to actually remove the file from Git checkout before committing/pushing, so it did
not make it into the tree.

Sorry for this,
Uwe

-----
Uwe Schindler
Achterdiek 19, D-28357 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de

> -----Original Message-----
> From: mkhl@apache.org <mkhl@apache.org>
> Sent: Wednesday, May 16, 2018 7:58 AM
> To: commits@lucene.apache.org
> Subject: lucene-solr:master: LUCENE-8291: Build Fix. Removing Demo Servlet.
> 
> Repository: lucene-solr
> Updated Branches:
>   refs/heads/master 11c6a7ad8 -> 09a789f53
> 
> 
> LUCENE-8291: Build Fix. Removing Demo Servlet.
> 
> 
> Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
> Commit: http://git-wip-us.apache.org/repos/asf/lucene-
> solr/commit/09a789f5
> Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/09a789f5
> Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/09a789f5
> 
> Branch: refs/heads/master
> Commit: 09a789f535007c907c8dc55f3ae4e4e9ca9c8ee3
> Parents: 11c6a7a
> Author: Mikhail Khludnev <mkhl@apache.org>
> Authored: Wed May 16 08:59:45 2018 +0300
> Committer: Mikhail Khludnev <mkhl@apache.org>
> Committed: Wed May 16 08:59:45 2018 +0300
> 
> ----------------------------------------------------------------------
>  .../demo/xmlparser/FormBasedXmlQueryDemo.java   | 162 -------------------
>  .../lucene/demo/xmlparser/package-info.java     |  21 ---
>  2 files changed, 183 deletions(-)
> ----------------------------------------------------------------------
> 
> 
> http://git-wip-us.apache.org/repos/asf/lucene-
> solr/blob/09a789f5/lucene/demo/src/java/org/apache/lucene/demo/xmlpa
> rser/FormBasedXmlQueryDemo.java
> ----------------------------------------------------------------------
> diff --git
> a/lucene/demo/src/java/org/apache/lucene/demo/xmlparser/FormBasedX
> mlQueryDemo.java
> b/lucene/demo/src/java/org/apache/lucene/demo/xmlparser/FormBasedX
> mlQueryDemo.java
> deleted file mode 100644
> index 8e8371c..0000000
> ---
> a/lucene/demo/src/java/org/apache/lucene/demo/xmlparser/FormBasedX
> mlQueryDemo.java
> +++ /dev/null
> @@ -1,162 +0,0 @@
> -/*
> - * Licensed to the Apache Software Foundation (ASF) under one or more
> - * contributor license agreements.  See the NOTICE file distributed with
> - * this work for additional information regarding copyright ownership.
> - * The ASF licenses this file to You 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.
> - */
> -package org.apache.lucene.demo.xmlparser;
> -
> -import java.io.BufferedReader;
> -import java.io.IOException;
> -import java.io.InputStream;
> -import java.io.InputStreamReader;
> -import java.nio.charset.StandardCharsets;
> -import java.util.Enumeration;
> -import java.util.Properties;
> -import java.util.StringTokenizer;
> -
> -import javax.servlet.RequestDispatcher;
> -import javax.servlet.ServletConfig;
> -import javax.servlet.ServletException;
> -import javax.servlet.http.HttpServlet;
> -import javax.servlet.http.HttpServletRequest;
> -import javax.servlet.http.HttpServletResponse;
> -
> -import org.apache.lucene.analysis.Analyzer;
> -import org.apache.lucene.analysis.standard.StandardAnalyzer;
> -import org.apache.lucene.document.Document;
> -import org.apache.lucene.document.Field;
> -import org.apache.lucene.document.FieldType;
> -import org.apache.lucene.document.TextField;
> -import org.apache.lucene.index.DirectoryReader;
> -import org.apache.lucene.index.IndexReader;
> -import org.apache.lucene.index.IndexWriter;
> -import org.apache.lucene.index.IndexWriterConfig;
> -import org.apache.lucene.queryparser.xml.CorePlusExtensionsParser;
> -import org.apache.lucene.queryparser.xml.QueryTemplateManager;
> -import org.apache.lucene.search.IndexSearcher;
> -import org.apache.lucene.search.Query;
> -import org.apache.lucene.search.ScoreDoc;
> -import org.apache.lucene.search.TopDocs;
> -import org.apache.lucene.store.RAMDirectory;
> -
> -/**
> - * Example servlet that uses the XML queryparser.
> - * <p>
> - * NOTE: you must provide CSV data in <code>/WEB-INF/data.tsv</code>
> - * for the demo to work!
> - */
> -public class FormBasedXmlQueryDemo extends HttpServlet {
> -
> -  private QueryTemplateManager queryTemplateManager;
> -  private CorePlusExtensionsParser xmlParser;
> -  private IndexSearcher searcher;
> -  private Analyzer analyzer = new StandardAnalyzer();
> -
> -  /** for instantiation by the servlet container */
> -  public FormBasedXmlQueryDemo() {}
> -
> -  @Override
> -  public void init(ServletConfig config) throws ServletException {
> -    super.init(config);
> -    try {
> -      openExampleIndex();
> -
> -      //load servlet configuration settings
> -      String xslFile = config.getInitParameter("xslFile");
> -      String defaultStandardQueryParserField =
> config.getInitParameter("defaultStandardQueryParserField");
> -
> -
> -      //Load and cache choice of XSL query template using
> QueryTemplateManager
> -      queryTemplateManager = new QueryTemplateManager(
> -          getServletContext().getResourceAsStream("/WEB-INF/" + xslFile));
> -
> -      //initialize an XML Query Parser for use by all threads
> -      xmlParser = new
> CorePlusExtensionsParser(defaultStandardQueryParserField, analyzer);
> -    } catch (Exception e) {
> -      throw new ServletException("Error loading query template", e);
> -    }
> -  }
> -
> -  @Override
> -  protected void doPost(HttpServletRequest request, HttpServletResponse
> response) throws ServletException, IOException {
> -    //Take all completed form fields and add to a Properties object
> -    Properties completedFormFields = new Properties();
> -    Enumeration<?> pNames = request.getParameterNames();
> -    while (pNames.hasMoreElements()) {
> -      String propName = (String) pNames.nextElement();
> -      String value = request.getParameter(propName);
> -      if ((value != null) && (value.trim().length() > 0)) {
> -        completedFormFields.setProperty(propName, value);
> -      }
> -    }
> -
> -    try {
> -      //Create an XML query by populating template with given user criteria
> -      org.w3c.dom.Document xmlQuery =
> queryTemplateManager.getQueryAsDOM(completedFormFields);
> -
> -      //Parse the XML to produce a Lucene query
> -      Query query = xmlParser.getQuery(xmlQuery.getDocumentElement());
> -
> -      //Run the query
> -      TopDocs topDocs = searcher.search(query, 10);
> -
> -      //and package the results and forward to JSP
> -      if (topDocs != null) {
> -        ScoreDoc[] sd = topDocs.scoreDocs;
> -        Document[] results = new Document[sd.length];
> -        for (int i = 0; i < results.length; i++) {
> -          results[i] = searcher.doc(sd[i].doc);
> -          request.setAttribute("results", results);
> -        }
> -      }
> -      RequestDispatcher dispatcher =
> getServletContext().getRequestDispatcher("/index.jsp");
> -      dispatcher.forward(request, response);
> -    }
> -    catch (Exception e) {
> -      throw new ServletException("Error processing query", e);
> -    }
> -  }
> -
> -  private void openExampleIndex() throws IOException {
> -    //Create a RAM-based index from our test data file
> -    RAMDirectory rd = new RAMDirectory();
> -    IndexWriterConfig iwConfig = new IndexWriterConfig(analyzer);
> -    IndexWriter writer = new IndexWriter(rd, iwConfig);
> -    InputStream dataIn = getServletContext().getResourceAsStream("/WEB-
> INF/data.tsv");
> -    BufferedReader br = new BufferedReader(new
> InputStreamReader(dataIn, StandardCharsets.UTF_8));
> -    String line = br.readLine();
> -    final FieldType textNoNorms = new FieldType(TextField.TYPE_STORED);
> -    textNoNorms.setOmitNorms(true);
> -    while (line != null) {
> -      line = line.trim();
> -      if (line.length() > 0) {
> -        //parse row and create a document
> -        StringTokenizer st = new StringTokenizer(line, "\t");
> -        Document doc = new Document();
> -        doc.add(new Field("location", st.nextToken(), textNoNorms));
> -        doc.add(new Field("salary", st.nextToken(), textNoNorms));
> -        doc.add(new Field("type", st.nextToken(), textNoNorms));
> -        doc.add(new Field("description", st.nextToken(), textNoNorms));
> -        writer.addDocument(doc);
> -      }
> -      line = br.readLine();
> -    }
> -    writer.close();
> -
> -    //open searcher
> -    // this example never closes it reader!
> -    IndexReader reader = DirectoryReader.open(rd);
> -    searcher = new IndexSearcher(reader);
> -  }
> -}
> 
> http://git-wip-us.apache.org/repos/asf/lucene-
> solr/blob/09a789f5/lucene/demo/src/java/org/apache/lucene/demo/xmlpa
> rser/package-info.java
> ----------------------------------------------------------------------
> diff --git
> a/lucene/demo/src/java/org/apache/lucene/demo/xmlparser/package-
> info.java
> b/lucene/demo/src/java/org/apache/lucene/demo/xmlparser/package-
> info.java
> deleted file mode 100644
> index 0b569dc..0000000
> --- a/lucene/demo/src/java/org/apache/lucene/demo/xmlparser/package-
> info.java
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -/*
> - * Licensed to the Apache Software Foundation (ASF) under one or more
> - * contributor license agreements.  See the NOTICE file distributed with
> - * this work for additional information regarding copyright ownership.
> - * The ASF licenses this file to You 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.
> - */
> -
> -/**
> - * Demo servlet for the XML Query Parser.
> - */
> -package org.apache.lucene.demo.xmlparser;


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message