private int findLocations(int fieldIndex) {
		Field f = currentLayout.getField(fieldIndex);
		if (!(f instanceof ListingField field)) {
			return 0;
		}
		FieldFactory ff = field.getFieldFactory();
		String fieldName = ff.getFieldName();
		if (!doSearchField(fieldName)) {
			return 0;
		}

		int fieldCount = 1; // we always match on one field, unless it is the Mnemonic/Operand combo

		// if field is the Mnemonic, and instructions or data are
		// being searched, get the next field as well
		boolean isMnemonic = fieldName.equals(MnemonicFieldFactory.FIELD_NAME);
		boolean isInstructionsOrData =
			options.searchAllFields() || options.searchBothDataMnemonicsAndOperands() ||
				options.searchBothInstructionMnemonicAndOperands();
		if (isMnemonic && isInstructionsOrData) {
			if (currentFieldIndex <= currentLayout.getNumFields() - 2) {
				Field f2 = currentLayout.getField(fieldIndex + 1);
				if ((f2 instanceof ListingField opField) && opField.getFieldFactory()
						.getFieldName()
						.equals(OperandFieldFactory.FIELD_NAME)) {
					findMnemonicOperandLocations(field, opField);
					fieldCount = 2; // if we match here, then signal that we matched across two fields
				}
			}
			else {
				findLocations(field);
			}
		}
		else {
			findLocations(field);
		}

		if (results.size() > 0) {
			// we found a match!
			return fieldCount;
		}
		return 0;
	}
Returns the number of fields used in the match.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/searchtext/ListingDisplaySearcher.java