Tests for indexing a PHP AST with Lucene search engine;
[phpeclipse.git] / net.sourceforge.phpeclipse.tests / src / net / sourceforge / phpdt / core / tests / lucene / PHPSearcher.java
index 035c752..05ce6bb 100644 (file)
@@ -44,6 +44,26 @@ public class PHPSearcher {
                return hits;
        }
 
+       public Hits getIncludeInfo(String ident) {
+               Hits hits = null;
+               try {
+//                     Query query = QueryParser.parse(ident, "f", new StandardAnalyzer());
+                       Query query = new TermQuery(new Term("i", 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("i").length; j++) {
+                                       System.out.println(doc.getValues("i")[j]);
+                               }
+                       }
+               } catch (IOException e) {
+                       e.printStackTrace();
+               }
+               return hits;
+       }
+
        public Hits getFunctionInfo(String ident) {
                Hits hits = null;
                try {