Hi Johannes, I suspect that Scott's answer would be more efficient than the following, and I may be misunderstanding the problem!
This type of search is supported at the Lucene level by a SpanNearQuery with inOrder set to false. So, how do you get a SpanQuery in Solr? You might want to look at the SurroundQueryParser, and I have an alternate (LUCENE-5205/SOLR-5410) here: https://github.com/tballison/lucene-addons. If you do find an appropriate parser, make sure that your position increment gap is > 0 on your text field definition, and then you'd never incorrectly get a hit across field entries of: [0] A B [1] C Best, Tim On Wed, Dec 16, 2015 at 8:38 AM, Johannes Riedl < johannes.ri...@uni-tuebingen.de> wrote: > Hello all, > > we are facing the following problem: we use a multivalued string field > that contains entries of the kind A/B/C/, where A,B,C are terms. > We are now looking for a simple way to also find all permutations of > A/B/C, so e.g. B/A/C. As a workaround we added a new field that > contains all entries alphabetically sorted and guarantee sorting on the user > side. > However - since this is limited in some ways - is there a simple way > to either index in a way such that solely A/B/C and all permutations > are found (using e.g. type=text is not an option since a term could > occur in a different entry of the multivalued field) or trigger an > alphabetical sorting of incoming queries. > > Thanks a lot for your feedback, best regards > > Johannes > > -- Scott Stults | Founder & Solutions Architect | OpenSource Connections, LLC | 434.409.2780 http://www.opensourceconnections.com