Reverse query matching solr
Asked Answered
E

1

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.

Enoch answered 31/8, 2012 at 17:38 Comment(1)
This would be a great feature and have been trying to think of a way to do the same thing. Another search product I use has this functionality called "profiler" thunderstone.com/site/vortexman/profiler.htmlWestlund
C
7

Can you consider switching to elasticsearch? Sorry but the usecase looks perfect for the Percolate API, a really useful feature that elasticsearch provides.

You would be indexing your queries instead of documents, giving them an unique id. Then you could send your documents one by one and get back which queries match on them, without even indexing the documents. Check it out!

Chapeau answered 31/8, 2012 at 18:46 Comment(3)
This looks perfect is right :) I can set up a different engine for this purpose. Would love to know how this works under the bonnet and use with solr but this answers my question. Thank youEnoch
wow... looks like i'll be exploring elasticsearch this weekend!Westlund
It would be nice to address this in Solr, as OP originally asked for Solr. Even if the answer is "there is no way to do this in Solr".Lotuseater

© 2022 - 2024 — McMap. All rights reserved.