Analyzer to store a document in n possible combinations (n being no. of words in doc)

If a document value is "jerry tom micky"
it has to be anlayzed and stored as below
"jerry tom micky"
"jerry micky tom"
"tom micky jerry"
"tom jerry micky "
"micky jerry tom"
"micky tom jerry"

Any idea to achieve this?

Hi @tamil,

I fear it is not possible to store this as this would lead to a combinatorial explosion and hence an insanely huge index. Just consider what would happen if one document contained just 20 words. This would lead to 20! = 2432902008176640000 combinations.

But maybe there is another way to solve this problem. Can you please describe what you want to achieve?