Skip to content
Browse files

Oops. Expand PhraseQuery queries too

  • Loading branch information...
1 parent 17d3c5a commit 25100215e744f2b6ee37370d526346002948d08c @marktriggs committed Aug 7, 2011
Showing with 15 additions and 0 deletions.
  1. +15 −0 src/net/dishevelled/mailindex.clj
View
15 src/net/dishevelled/mailindex.clj
@@ -394,6 +394,21 @@ Also adds fields for the line and character count of the message."
(.setQuery clause (expand-query (.getQuery clause))))
query)
+ (and (instance? PhraseQuery query))
+ (if-let [linked-fields (:linked-fields
+ (parse-rules (.field
+ (first (.getTerms query)))))]
+ (let [new-query (BooleanQuery.)]
+ (.add new-query query BooleanClause$Occur/SHOULD)
+ (doseq [field linked-fields]
+ (let [phrase (PhraseQuery.)]
+ (doseq [term (.getTerms query)]
+ (.add phrase (Term. field (.text term))))
+ (.add new-query phrase BooleanClause$Occur/SHOULD)))
+ new-query)
+ query)
+
+
(instance? TermQuery query)
(let [term (.getTerm query)]
(if-let [linked-fields (:linked-fields (parse-rules (.field term)))]

0 comments on commit 2510021

Please sign in to comment.
Something went wrong with that request. Please try again.