07-30-2023, 01:41 PM
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:
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:
public FacetField(String dim, String... path) {
super("dummy", TYPE);
Is this a bug?
Based on the examples I found on github:
[To see links please register here]
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:
[To see links please register here]
It seems that all facet fields are created with "dummy":[To see links please register here]
public FacetField(String dim, String... path) {
super("dummy", TYPE);
Is this a bug?