Women in Technology

Hear us Roar



Article:
  Using Lucene to Search Java Source Code
Subject:   Searching on multiple fields
Date:   2007-06-23 02:10:27
From:   SimoneB
Hello, I liked your article very much, and I have a question on a point I don't understand completely.


In the last snippet you say that the query can contain multiple fields, say, q="imports:some code:some"


But then when you parse the query you use the code field.


Query query = QueryParser.parse(q, "code", analyzer);


I don't understand what's the relation between the query parser and the analyzer here. You create an analyzer which supports multiple fields, fine, so is it enough to support multiple field search or you have to use a query parser which parses the query on multiple fields?


Thank you very much!

Main Topics Oldest First

Showing messages 1 through 1 of 1.

  • Searching on multiple fields
    2008-03-20 02:27:15  天草剑歌 [View]

    sorry,my english is poor.
    in my opinion,
    in "Query query = QueryParser.parse(q, "code", analyzer);", "code" is specify the default field when the query string isn't specify field.

    in "q="imports:some code:some""

    "import" and "code" is specify the field want to search.