We are currently storing documents in an index in Search API
The documents have a TextField containing a phrase.
We would like to query the Documents index with phrases and be able to return partian phrase matches.
For example, let's we've indexed three documents, with the following phrases:
"search phrases" "search all phrases" "some random string"
We would like to query the index with the query "search all phrases" and return the document containing the Field value "search all phrases" as well as "search phrases" The second is only a partial phrase match, but we would like to get this back in the results.
This is possible if phrase the query as "search OR all OR phrase" but the problem with this query is that it doesn't rank matches according to number of common words
So the above query might actually return "search phrases" as the top document despite their being another matched document where all words have actually matched up with the query phrase words.
How do we accomplish this?
Thanks
UPDATE:
We also tried extended queries in this manner: "(search all phrases) OR (search phrases)"
This does return results but the sort order is not intuitive. One would expect a full match, i.e a document where all the query words matched, to be at the top. Unfortunately, this isn't the case.
How do we sort this such that the documents with query words matching fully show up at the top. Can we do a sort by length of common snippet or something along those lines?