0

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?

Cygorger
  • 772
  • 7
  • 15
  • have you tried "search all phrases" OR "search phrases" – Omair Shamshir Jun 26 '14 at 06:08
  • @omair_77 That gets the results, but the ordering is not intuitive. One would expect documents containing "search all phrases" to be presented before "search phrases" but this is not the case The documents are sorted according to rank, which is simply the date of upload And it isn't clear how we can define our own sort rank based on the number of common words. – Cygorger Jun 26 '14 at 08:30
  • They are still working on it... see the answer to this question: "Custom scoring is one of our top priority feature requests" http://stackoverflow.com/questions/20659188/google-app-engine-search-api?lq=1 – Nicholas Franceschina Jul 16 '14 at 04:23
  • 1
    you also might experiment with the "stemming" operator they provide (prefix search term with "~"): https://developers.google.com/appengine/docs/python/search/query_strings#Python_Stemming – Nicholas Franceschina Jul 16 '14 at 04:25

0 Answers0