private boolean isSameLocation(ProgramLocation loc) {
		if (startLocation == null || !(loc instanceof OperandFieldLocation) ||
			!(startLocation instanceof OperandFieldLocation)) {
			return false;
		}

		OperandFieldLocation opStartLoc = (OperandFieldLocation) startLocation;
		OperandFieldLocation opLoc = (OperandFieldLocation) loc;
		if (!opStartLoc.getAddress().equals(opLoc.getAddress())) {
			return false;
		}
		// note: the program database search generates a location with sub op index as -1,
		// so treat this as the same location if the sub op index is -1;
		// this happens when transitioning from a database search to listing display search.
		return (opStartLoc.getSubOperandIndex() < 0 &&
			opStartLoc.getOperandIndex() == opLoc.getOperandIndex());
	}
Returns the number of fields used in the match.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/searchtext/ListingDisplaySearcher.java