Question: I have indexed my field in SOLR using field type "string". 
My field contains two values "APA" and "APA LN".
I have queried SOLR with **q=field:"APA"**.
With the above query i ma getting the results for both APA and APA LN.
I have to query SOLR to just get "APA".
Any help is appreciated

Answer: 
To achieve this most effectively you need To achieve this most effectively you need To achieve this most effectively you need to use recursion use recursion use recursion.

Using this pattern means that the array will always be filled no matter how many levels of nested object you have. Try this:

```js
var data = [{
  "id": "111111",
  "name": "Parent",
  "steps": [{
    "id": "22222",
    "name": "Child",
    "steps": [{
      "id": "333333",
      "name": "Child -Child",
      "steps": [{
        "id": "444444",
        "name": "Child - Child - Child",
        "steps": [{
          "id": "5555",
          "name": "Child - Child - Child - Child"
        }, {
          "id": "522e9327-0747-4080-b6e2-d57e726b5b26",
          "name": "Child - Child - Child - Child 2"
        }],

      }],

    }],

  }],
}]

var names = [];
function getNames(arr) {
    for (var i = 0; i < arr.length; i++) {
        names.push(arr[i].name);
        if (arr[i].steps && arr[i].steps.length)
            getNames(arr[i].steps);
    }
}

getNames(data);

console.log(names);
```
You can achieve this using the javascript map function & recursion

```
var jsonArray = [{
  "id": "111111",
  "name": "Parent",
  "steps": [{
    "id": "22222",
    "name": "Child",
    "steps": [{
      "id": "333333",
      "name": "Child -Child",
      "steps": [{
        "id": "444444",
        "name": "Child - Child - Child",
        "steps": [{
          "id": "5555",
          "name": "Child - Child - Child - Child"
        }, {
          "id": "522e9327-0747-4080-b6e2-d57e726b5b26",
          "name": "Child - Child - Child - Child 2"
        }],

      }],

    }],

  }],
}]

var namesArray = [];
var recur = function(obj) {
  namesArray.push(obj.name);
  if(obj.steps) {
    obj.steps.map(recur);
  }
}

jsonArray.map(recur);
console.log(namesArray);

```