0
votes

I am trying to match a field that contains all the words in a phrase but so far have only been able to use ^ and $ to do it. For instance

^Word1 Word2$

Returns a record named "Word1 Word2" but not "Word3 Word1 Word2".

However what I want in fact is also "Word2 Word1"

So I get how to use the ^ and $ to mean start and end of the field but that forces the words I put in to be in particular order. Clearly I could also search for "Word2 Word1" but it gets more complex (3+ word terms, etc)

Is there a way to tell sphinx to look in an entire field in any order. In other words I want "Word1 Word2" to match "Word1 Word2" and "Word2 Word1" but not "Word3 Word2 Word1"

1

1 Answers

0
votes

Well can use NEAR/ or the proximity operator to require the words ajoining(but in any order), but there isnt really a good way to require 'entire field'.

Closest would probably to use index_field_lengths, then get the field len can use in a custom ranking expression. But if multiple fields in your index will be very tricky to implement.