comparison lucene/src/luan/modules/lucene/LuceneIndex.java @ 312:d34be4588556

add lucene query parsing git-svn-id: https://luan-java.googlecode.com/svn/trunk@313 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Wed, 24 Dec 2014 11:15:27 +0000
parents fdb4bd391c28
children 23b99a5039b5
comparison
equal deleted inserted replaced
311:22ca4f3a65c3 312:d34be4588556
17 import org.apache.lucene.index.Term; 17 import org.apache.lucene.index.Term;
18 import org.apache.lucene.index.SnapshotDeletionPolicy; 18 import org.apache.lucene.index.SnapshotDeletionPolicy;
19 import org.apache.lucene.store.Directory; 19 import org.apache.lucene.store.Directory;
20 import org.apache.lucene.store.FSDirectory; 20 import org.apache.lucene.store.FSDirectory;
21 import org.apache.lucene.util.Version; 21 import org.apache.lucene.util.Version;
22 import org.apache.lucene.search.Query;
22 import org.apache.lucene.search.TermQuery; 23 import org.apache.lucene.search.TermQuery;
23 import org.apache.lucene.search.TopDocs; 24 import org.apache.lucene.search.TopDocs;
25 import org.apache.lucene.queryparser.flexible.standard.StandardQueryParser;
26 import org.apache.lucene.queryparser.flexible.core.QueryNodeException;
24 import luan.modules.Utils; 27 import luan.modules.Utils;
25 import luan.Luan; 28 import luan.Luan;
26 import luan.LuanState; 29 import luan.LuanState;
27 import luan.LuanTable; 30 import luan.LuanTable;
28 import luan.LuanFunction; 31 import luan.LuanFunction;
186 public void close() throws IOException { 189 public void close() throws IOException {
187 writer.close(); 190 writer.close();
188 reader.close(); 191 reader.close();
189 } 192 }
190 193
194
195 public Query parse(String s) throws QueryNodeException {
196 StandardQueryParser qp = new StandardQueryParser();
197 qp.setQueryNodeProcessor(new LuanQueryNodeProcessor(this,qp.getQueryNodeProcessor()));
198 return qp.parse(s,null);
199 }
200
191 } 201 }