This project is read-only.

Lucene query syntax for taxonomy searchs

Topics: Customizing Orchard
Sep 25, 2013 at 4:23 PM
Hi, I've got a taxonomy called Location. Taxonomy terms are indexed as Location-id. The raw indexed representation of a content item with a Location Taxonomy field set to a value with two ancestors (/58/56/59) might look like this:

Location-id 59
Location-id 56
Location-id 58

However, the query Location-id:59 doesn't return anything. Nor does Location-id:59 56 58.

I've wondered if this is because they are numeric not strings, but in any case, can anyone offer guidance regarding the syntax to query indexed taxonomy terms?

Sep 27, 2013 at 2:04 PM
Edited Sep 27, 2013 at 2:04 PM
I've solved my own issue. In order to develop the appropriate queries within Orchard, I had been testing them in Luke (Lucene Index Toolbox). According to
  1. Untokenized fields are best added directly to queries, and not through the query parser. If a field's values are generated programmatically by the application, then so should query clauses for this field. An analyzer, which the query parser uses, is designed to convert human-entered text to terms. Program-generated values, like dates, keywords, etc., should be consistently program-generated.
I think this has something to do with why my queries failed in Luke, but searching on the taxonomy term id using SearchBuilder.WithField() worked perfectly.