aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReid 'arrdem' McKenzie <reid@factual.com>2015-08-12 18:32:40 -0700
committerReid 'arrdem' McKenzie <reid@factual.com>2015-08-12 18:32:40 -0700
commit3534b2334f71c86a48fd79149bb7a8af50c24dc7 (patch)
treef6c1e32a5563d871071d786c3fd76c8c555b4b6c
parent1280ae4869a3dea425257aa7a96836449687fb57 (diff)
downloadclucy-3534b2334f71c86a48fd79149bb7a8af50c24dc7.tar.gz
clucy-3534b2334f71c86a48fd79149bb7a8af50c24dc7.tar.xz
clucy-3534b2334f71c86a48fd79149bb7a8af50c24dc7.zip
Add :all support as a query value
Because sometimes you'll want to select all records flat out
-rw-r--r--src/clucy/core.clj6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/clucy/core.clj b/src/clucy/core.clj
index 227b7d1..9dd831b 100644
--- a/src/clucy/core.clj
+++ b/src/clucy/core.clj
@@ -8,7 +8,7 @@
(org.apache.lucene.queryparser.classic QueryParser)
(org.apache.lucene.search BooleanClause BooleanClause$Occur
BooleanQuery IndexSearcher Query ScoreDoc
- Scorer TermQuery)
+ Scorer TermQuery MatchAllDocsQuery)
(org.apache.lucene.search.highlight Highlighter QueryScorer
SimpleHTMLFormatter)
(org.apache.lucene.util Version AttributeSource)
@@ -208,7 +208,9 @@ fragments."
:or
,,QueryParser/OR_OPERATOR)))
- query (.parse parser query)
+ query (if (= query :all)
+ (MatchAllDocsQuery.)
+ (.parse parser query))
hits (if (= max-results :all)
(.search searcher query)
(.search searcher query (int max-results)))