1. string: IF the value of search_field is stored as one token (string field type), THEN you may be able to use a wildcard pattern or a regular expression to match the value. To match single-token string type fields, where an A appears before a B:
q=search_field:*A*B*
or
q=search_field:/.*A.*B.*/
For more, see this Solr Regex Tutorial. In the tutorial example the same value is stored twice, once in a string field and once in a text field.
An example of this in the Solr "techproducts" example data is the field pair: author (text) and author_s (string). Order is siginificant: The query q=author_s:*g*t* returns books by George R.R. Martin, and the query
q=author_s:*t*g* returns a book by Grant Ingersoll.
2. text: IF the value of search_field is indexed as multiple tokens (such as when each word is a token), and A is in a separate token from B, THEN you may be able to use the Complex Phrase Query Parser with inOrder=true (default).
2a. text, adjacent tokens: IF A and B must appear in adjacent tokens in the field value, THEN a complex phrase query with no ~ proximity can be used:
{!complexphrase}search_field:"*A* *B*"
{!complexphrase}search_field:"/.*A.*/ /.*B.*/"
Adjacency example: In the "techproducts" sample data, {!complexphrase}author:"*t* *g*" does return the book by Grant Ingersoll, but {!complexphrase}author:"*g* *t*" does not return the books by George R.R. Martin.
2b. text, nearby: IF the tokens are not necessarily adjacent but are nearby, THEN use a complex phrase query, suffixed with a ~ proximity token count. For example, within 10 words or tokens:
{!complexphrase}search_field:"*A* *B*"~10
{!complexphrase}search_field:"/.*A.*/ /.*B.*/"~10
In the "techproducts" sample data, {!complexphrase}author:"*g* *t*"~10 does return the books by George R.R. Martin and not the book by Grant Ingersoll.
Note: neither 2a nor 2b will match single token values where A is followed by B. To also include single-token value matches, specify the OR of a single token pattern and a multiple token pattern:
{!complexphrase} search_field:*A*B* OR search_field:"*A* *B*"~10