Search code examples
luceneluke

How to use Lucene Luke for testing search results on more than one field?


I am using Lucene Luke to test search index results and noticed that I cannot select more than one field in 'Default field' drop down list. Is this by design or we cannot use Luke tool for searching against multiple fields?

Basically I would like to know SOLR qf(query field) equivalent in Lucene.

Thanks


Solution

  • You can search using format field:query. For details see: https://lucene.apache.org/core/8_0_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package.description

    Lucene supports fielded data. When performing a search you can either specify a field, or use the default field. The field names and default field is implementation specific.

    You can search any field by typing the field name followed by a colon ":" and then the term you are looking for.

    As an example, let's assume a Lucene index contains two fields, title and text and text is the default field. If you want to find the document entitled "The Right Way" which contains the text "don't go this way", you can enter:

    title:"The Right Way" AND text:go or

    title:"The Right Way" AND go Since text is the default field, the field indicator is not required.

    Note: The field is only valid for the term that it directly precedes, so the query

    title:The Right Way Will only find "The" in the title field. It will find "Right" and "Way" in the default field (in this case the text field).