You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I've been trying to create a query that searches for documents that have an empty field. Currently, when creating the index I am just setting a documents' empty fields to a specific keyword like "EMPTYBLUGEFIELD" and creating a query for it. I was wondering if there was a more proper way to perform this search?
What I've been doing:
When creating index:
If field != "" {
doc.AddField(bluge.NewKeywordField("Field", "FieldValue").StoreValue())
} else {
doc.AddField(bluge.NewKeywordField("Field", "EMPTYBLUGEFIELD").StoreValue())
}
So, there is nothing wrong with this approach, but it is worth pointing out that when using the keyword analyzer, the empty value is fine for indexing and searching as is. The keyword analyzer does not change the input at all, and the empty string is still a valid term (length 0).
I've added a test-case to illustrate this here: #110
This should perform the same, so if you already got it working there probably isn't a compelling reason to change, unless you just want to simplify things.
Hi, I've been trying to create a query that searches for documents that have an empty field. Currently, when creating the index I am just setting a documents' empty fields to a specific keyword like "EMPTYBLUGEFIELD" and creating a query for it. I was wondering if there was a more proper way to perform this search?
What I've been doing:
When creating index:
When searching:
The text was updated successfully, but these errors were encountered: