X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpdt/core/tests/lucene/PHPSearcher.java b/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpdt/core/tests/lucene/PHPSearcher.java deleted file mode 100644 index 035c752..0000000 --- a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpdt/core/tests/lucene/PHPSearcher.java +++ /dev/null @@ -1,105 +0,0 @@ -package net.sourceforge.phpdt.core.tests.lucene; - -import java.io.IOException; - -import org.apache.lucene.analysis.standard.StandardAnalyzer; -import org.apache.lucene.document.Document; -import org.apache.lucene.index.Term; -import org.apache.lucene.queryParser.ParseException; -import org.apache.lucene.queryParser.QueryParser; -import org.apache.lucene.search.Hits; -import org.apache.lucene.search.IndexSearcher; -import org.apache.lucene.search.Query; -import org.apache.lucene.search.TermQuery; - -public class PHPSearcher { - private IndexSearcher fSearcher; - private StandardAnalyzer analyzer; - - public PHPSearcher(String indexPath) { - try { - fSearcher = new IndexSearcher(indexPath); - analyzer = new StandardAnalyzer(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - public Hits getClassInfo(String ident) { - Hits hits = null; - try { - Query query = new TermQuery(new Term("c", ident)); - hits = fSearcher.search(query); - int hitCount = hits.length(); - Document doc; - for (int i = 0; (i < hitCount && i < 10); i++) { - doc = hits.doc(i); - for (int j = 0; j < doc.getValues("c").length; j++) { - System.out.println(doc.getValues("c")[j]); - } - } - } catch (IOException e) { - e.printStackTrace(); - } - return hits; - } - - public Hits getFunctionInfo(String ident) { - Hits hits = null; - try { -// Query query = QueryParser.parse(ident, "f", new StandardAnalyzer()); - Query query = new TermQuery(new Term("f", ident)); - hits = fSearcher.search(query); - int hitCount = hits.length(); - Document doc; - for (int i = 0; (i < hitCount && i < 10); i++) { - doc = hits.doc(i); - for (int j = 0; j < doc.getValues("f").length; j++) { - System.out.println(doc.getValues("f")[j]); - } - } - } catch (IOException e) { - e.printStackTrace(); - } - return hits; - } - - public Hits getMethodInfo(String ident) { - Hits hits = null; - try { -// Query query = QueryParser.parse(ident, "m", new StandardAnalyzer()); - Query query = new TermQuery(new Term("m", ident)); - hits = fSearcher.search(query); - int hitCount = hits.length(); - Document doc; - for (int i = 0; (i < hitCount && i < 10); i++) { - doc = hits.doc(i); - for (int j = 0; j < doc.getValues("m").length; j++) { - System.out.println(doc.getValues("m")[j]); - } - } - } catch (IOException e) { - e.printStackTrace(); - } - return hits; - } - public Hits getAttributeInfo(String ident) { - Hits hits = null; - try { -// Query query = QueryParser.parse(ident, "m", new StandardAnalyzer()); - Query query = new TermQuery(new Term("a", ident)); - hits = fSearcher.search(query); - int hitCount = hits.length(); - Document doc; - for (int i = 0; (i < hitCount && i < 10); i++) { - doc = hits.doc(i); - for (int j = 0; j < doc.getValues("a").length; j++) { - System.out.println(doc.getValues("a")[j]); - } - } - } catch (IOException e) { - e.printStackTrace(); - } - return hits; - } -}