5

I have a list of user queries to solr from a website (100's of thousands of them). My requirement is to return all the queries, in the given list, that are true for a document. I know I could index that one document and loop through the list of 100000 queries to see if the document is returned but is there any faster method?

eg. :

  1. cartype=BMW AND colour=RED
  2. cartype=FORD AND doors=4
  3. cartype=FORD AND colour=GREEN

    document: <cartype>FORD</cartype> <colour>GREEN</colour> <doors>4</doors>

So this document in question would return queries 2 & 3.

Ideally I would like to do some sort of reverse search. Index the search queries and send the contents of the document to return the matches. Anybody know how I might go about this or has it been tried before?

Any input put be greatly appreciated thanks.

4

1 に答える 1

8

Elasticsearchへの切り替えを検討できますか?申し訳ありませんが、ユースケースはPercolate APIに最適に見えます。これは、elasticsearchが提供する非常に便利な機能です。

ドキュメントの代わりにクエリのインデックスを作成し、一意のIDを指定します。次に、ドキュメントを1つずつ送信し、ドキュメントのインデックスを作成しなくても、ドキュメントに一致するクエリを取得できます。見てみな!

于 2012-08-31T18:46:08.710 に答える