I create a Lucene index and add documents.
I have a multi-valued field, for this example I will use categories.
An item can have many categories, for example, jeans can fall under clothes, pants, men's, women's, etc.
When adding fields to a document, do commas make a difference? Will Lucen just ignore them? if I change the commas to spaces, will there be a difference? Does this automatically make the field ambiguous?
String categoriesForItem = getCategories(); // returns "category1, category2, cat3" from a DB call categoriesForItem = categoriesForItem.replaceAll(",", " ").trim(); // not sure if to remove comma doc.add(new StringField("categories", categoriesForItem , Field.Store.YES)); // doc is a Document
Am I doing it right? or is there another way to create multi-valued fields?
Any help / advice is appreciated.
source share