Mercurial Hosting > luan
comparison lucene/src/luan/modules/lucene/LuceneSearcher.java @ 285:582e8db4cdb6
add lucene Web_search
git-svn-id: https://luan-java.googlecode.com/svn/trunk@286 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Tue, 02 Dec 2014 06:17:45 +0000 |
parents | 8afe9f2fdfec |
children | 4d53e9fc1bd9 |
comparison
equal
deleted
inserted
replaced
284:8870840251ea | 285:582e8db4cdb6 |
---|---|
17 import org.apache.lucene.search.BooleanQuery; | 17 import org.apache.lucene.search.BooleanQuery; |
18 import org.apache.lucene.search.BooleanClause; | 18 import org.apache.lucene.search.BooleanClause; |
19 import org.apache.lucene.search.Collector; | 19 import org.apache.lucene.search.Collector; |
20 import org.apache.lucene.search.TotalHitCountCollector; | 20 import org.apache.lucene.search.TotalHitCountCollector; |
21 import org.apache.lucene.search.Scorer; | 21 import org.apache.lucene.search.Scorer; |
22 import org.apache.lucene.search.MatchAllDocsQuery; | |
22 import org.apache.lucene.index.AtomicReaderContext; | 23 import org.apache.lucene.index.AtomicReaderContext; |
23 import luan.Luan; | 24 import luan.Luan; |
24 import luan.LuanState; | 25 import luan.LuanState; |
25 import luan.LuanTable; | 26 import luan.LuanTable; |
26 import luan.LuanFunction; | 27 import luan.LuanFunction; |
177 return true; | 178 return true; |
178 } | 179 } |
179 } | 180 } |
180 | 181 |
181 public Object[] search( final LuanState luan, LuanTable queryTbl, Object nObj, LuanTable sortTbl ) throws LuanException, IOException { | 182 public Object[] search( final LuanState luan, LuanTable queryTbl, Object nObj, LuanTable sortTbl ) throws LuanException, IOException { |
182 Query query = query(queryTbl); | 183 Query query; |
183 if( query == null ) | 184 if( queryTbl == null ) { |
184 throw luan.exception("invalid query"); | 185 query = new MatchAllDocsQuery(); |
186 } else { | |
187 query = query(queryTbl); | |
188 if( query == null ) | |
189 throw luan.exception("invalid query"); | |
190 } | |
185 if( nObj instanceof LuanFunction ) { | 191 if( nObj instanceof LuanFunction ) { |
186 final LuanFunction fn = (LuanFunction)nObj; | 192 final LuanFunction fn = (LuanFunction)nObj; |
187 Collector col = new MyCollector() { | 193 Collector col = new MyCollector() { |
188 @Override public void collect(int doc) { | 194 @Override public void collect(int doc) { |
189 try { | 195 try { |