代码之家  ›  专栏  ›  技术社区  ›  leontalbot

Clojure-Java-Lucene:具有多个字段的ComplexPhraseQueryParser

  •  0
  • leontalbot  · 技术社区  · 6 年前

    我能用谁 ComplexPhraseQueryParser 在多个领域?

    现在,我的代码使用 MultiFieldQueryParser. 看起来是这样的:

    (defn parse-multi-query
      "Parses term query-string and searches against all indexed-keys
      with AND condition, OR condition being reached with comma sep in input-term.
      Appends to input-term AND account_id
      Parses term (string) and look for result in all index keys
      except when a key is specified in query string (e.g. color:blue)"
      [^String query-string]
      (.parse (doto (MultiFieldQueryParser. ;; ComplexPhraseQueryParser
                     (into-array ["color" "id" "other-id"])
                     (ClassicTokenizer.))
                (.setDefaultOperator QueryParser$Operator/AND))
              query-string))
    

    这可以很好地工作,但无法执行受支持的复杂查询 ComplexPhraseQueryParser语法分析器

    我不能通过 (into-array (map #(str (name %)) indexed-keys)) ComplexPhraseQueryParser语法分析器

    0 回复  |  直到 6 年前