You probably need to start much simpler than this. You need to build the following queries as the user types into the field:
nodeName:d*
nodeName:de*
nodeName:des*
nodeName:desi*
and so on.
If you want to search over more than one field, build the following queries:
nodeName:d* bodyText:d*
nodeName:de* bodyText:de*
nodeName:des* bodyText:des*
nodeName:desi* bodyText:desi*
This will perform an OR search, search both as optional fields. Adding a +
to the front of nodeName
will make that matching nodeName
mandatory but bodyText
optional, e.g:
+nodeName:d* bodyText:d*
If the user specifies more than one term, use regex to sanitize the input (remove all the non letter number characters), split string based upon spaces and build the following:
nodeName:graphic* nodeName:desi* bodyText:graphic* bodyText:desi*
Or making nodeName
mandatory:
+(nodeName:graphic* nodeName:desi*) bodyText:graphic* bodyText:desi*