查询的入口
/** Lower-level search API. * * <p>{@link LeafCollector#collect(int)} is called for every matching document. * * @throws BooleanQuery.TooManyClauses If a query would exceed * {@link BooleanQuery#getMaxClauseCount()} clauses. */ public void search(Query query, Collector results) throws IOException { query = rewrite(query); search(leafContexts, createWeight(query, results.needsScores(), 1), results); }
可以看到,查询时需要传入Query接口的实现,其实现主要有:
/** The abstract base class for queries. <p>Instantiable subclasses are: <ul> <li> {@link TermQuery} <li> {@link BooleanQuery} <li> {@link WildcardQuery} <li> {@link PhraseQuery} <li> {@link PrefixQuery} <li> {@link MultiPhraseQuery} <li> {@link FuzzyQuery} <li> {@link RegexpQuery} <li> {@link TermRangeQuery} <li> {@link PointRangeQuery} <li> {@link ConstantScoreQuery} <li> {@link DisjunctionMaxQuery} <li> {@link MatchAllDocsQuery} </ul> <p>See also the family of {@link org.apache.lucene.search.spans Span Queries} and additional queries available in the <a href="{@docRoot}/../queries/overview-summary.html">Queries module</a> */
还有spanQuery跨度查询
太多了,需要一个个看