Tech Tip: Searching for Multi-Value Fields, Part One
By: Connie Anderson, Technical Writer
Multi-value fields enable you to store more than one value per field. For example, you might have two people who authored a document in your repository. You can add them both as authors of the document in the same “Author” field.
If you perform a search for a value in a multi-value field, documents will be returned if they contain that value anywhere in the field. For instance, if a document has the values “John,” “Bill,” and “Sally,” in the “Author” field and you search for documents with “Sally” in the “Author” field, that document will be returned.
You can also perform a variety of advanced multi-value field searches using the advanced search syntax. (For more information about advanced searches, see Performing Advanced Searches in the Laserfiche User Guide.) This week and next week, we will explore ways that you can use advanced searches to find your documents with multi-value fields.
The following search syntax will return documents with a multi-value field containing at least one of the values:
- {[]:[field]=“fieldvalue”} | {[]:[field]=“fieldvalue”}
For example, to search for entries with a multi-value “Author” field containing at least “Jonathan” or “Justin,” the syntax would be:
- {[]:[Author]=“Jonathan”} | {[]:[Author]=“Justin”}
To search for documents that have exactly two specific values in a multi-value field, you would use the following syntax:
- {[]:[field]=(“fieldvalue”, “fieldvalue”)}
For example, to search for documents with a multi-value “Author” field containing only “Bill” and “John,” the syntax would be:
- {[]:[Author]=(“Bill”,”John”)}
This search will return all entries assigned the multi-value “Author” field containing exactly “Bill” and “John.” If this multi-value field also contains another author, the document will not be returned.
To search for documents that have two specific values in a multi-value field, plus any other value(s), you would use the following syntax:
- {[]:[field]=“fieldvalue”}& {[]:[field]=“fieldvalue”)
For example, you might want to return all documents that Bill and John worked on with other people. You would use the following syntax:
- {[]:[Author]=“Bill”}&{[]:[Author=”John”}
This search will return all documents assigned the multi-value “Author” field containing “Bill” and “John,” as well as any other author(s) regardless of who the other author(s) might be. If this multi-value field also contains “Connie” and “Roger,” the document will be returned.
Note: You can also restrict multi-value field searches by template. For instance, the advanced search {[Human Resources]:[Author]=”Bill”}&{[Human Resources]:[Author=”John”} would return documents authored by both Bill and John that have the “Human Resources” template applied to them, but would not return documents authored by Bill and John that have the “Sales” template.