Last updated by maurice 3 years ago
all
Summary
A class mapping option that controls the "all" field for instances of a class.Syntax
all falseall options
Description
Unless you decide otherwise, a field known as the "all" field is created in the index for each class instance's data. This "all" field contains the combined searchable text for that instance.The reason for the "all" field is due to the way Lucene thinks.Each class instance is represented in the Lucene index as one Lucene document_. A _document has many fields and each field has one or more values. Think of it like a multi-valued Map.When you search with Lucene you can choose to prefix your query terms with the field to match in, like "name:bill", which will only return hits if the index contains a document with a field whose value contains "bill".But what about query terms that are not prefixed? How does Lucene cope? It doesn't! That responsibility is pushed back to the user. So when you query a Lucene index you also have to tell Lucene which field to search in for terms in the query that are not prefixed.To save you the bother of all this, Compass creates a field known as the "all" field, which combines all of the instance's searchable data, and makes that field the default for un-prefixed query terms.The first syntax disables creation of the all field. In this case you would have to prefix query terms with the properties you wish to query, otherwise they won't match anything.The second syntax allows you to provide a
Map of options that change the built-in "all" field default settings.Parameters
- @options@ - A
Mapof options
Options
- @analyzer@ - The name of a configured Analyzer used to analyze the searchable text.
- @name@ - The name of the all field. If not defined, defaults to the global Compass setting.
- @termVector@ - Should the term-vector data be collected for the "all" field? One of @"yes"@, @"no"@, @"with_positions@", @"with_offsets@", @"with_positions_offsets@". If not defined inherits the class's term-vector mapping. This is required for more-like-this searches.
Examples
// Disable the "all" field for this class static searchable = { all false }
// Enable term-vectors for the "all" field // This is required for more-like-this searches static searchable = { all termVector: "yes" }
// Define some "all" field settings within a nested "mapping" closure static searchable = { mapping { all name: "__all_field__", analyzer: "my_analyzer" } }



