I'm new to Apache Lucene. I'm using the latest version: 6.3.0 in combination with facet library. Based on the examples I found on github: https://github.com/apache/lucene-solr/tree/master/lucene/demo/src/java/org/apache/lucene/demo/facet
I have the following Document
Document doc = new Document();
doc.add(new FacetField("Author", "Bob"));
doc.add(new FacetField("Publish Date", "2010", "10", "15"));
doc.add(new FacetField("Tags", "A"));
doc.add(new FacetField("Tags", "B"));
//[FacetField(dim=Author path=[Bob]), FacetField(dim=Publish Date path=[2010, 10, 15]), FacetField(dim=Tags path=[A]), FacetField(dim=Tags path=[B])]
System.out.println(doc.getFields());
//null
System.out.println(doc.getField("Author"));
doc.getFields()
returns all the fields, but doc.getField("Author")
returns null.
Am I doing something wrong?
Digging further if I do something like this:
for(IndexableField myField:doc.getFields()){
System.out.println(myField.name());
}
The following is printed:
dummy
dummy
dummy
dummy
And if I do something like this doc.getField("dummy")
it will indeed return the first field(Author).
Looking at FacetField source code: https://github.com/apache/lucene-solr/blob/branch_6_3/lucene/facet/src/java/org/apache/lucene/facet/FacetField.java It seems that all facet fields are created with "dummy": https://github.com/apache/lucene-solr/blob/branch_6_3/lucene/facet/src/java/org/apache/lucene/facet/FacetField.java
public FacetField(String dim, String... path) {
super("dummy", TYPE);
Is this a bug?